Merge branch 'hugang'
This commit is contained in:
43
interface/check_oldconf.py
Normal file
43
interface/check_oldconf.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/python
|
||||
#! coding: utf-8
|
||||
|
||||
ins_xml = './install.xml'
|
||||
import Tkinter
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
message = {}
|
||||
message['english'] = 'The system detects the presence of the last\n \
|
||||
installation to retain the configuration file, whether to use'
|
||||
message['chinese'] = '系统检测到存在上次安装保留的配置文件,是否使用它'
|
||||
|
||||
|
||||
def ok():
|
||||
cmd='rm -rf ' + ins_xml
|
||||
subprocess.Popen(cmd,shell=True)
|
||||
root.destroy()
|
||||
|
||||
def cancel():
|
||||
root.destroy()
|
||||
|
||||
def init(language):
|
||||
global root
|
||||
root = Tkinter.Tk()
|
||||
root.geometry("%sx%s+%d+%d" % (root.winfo_screenwidth()/2,\
|
||||
root.winfo_screenheight()/2,\
|
||||
root.winfo_screenwidth()/4,
|
||||
root.winfo_screenheight()/4))
|
||||
txt = message[language]
|
||||
lab = Tkinter.Label(root,text=txt)
|
||||
lab.grid(row=1,column=1)
|
||||
btn1 = Tkinter.Button(root,text='OK',command=sys.modules[__name__].ok)
|
||||
btn2 = Tkinter.Button(root,text='Cancle',command=sys.modules[__name__].cancel)
|
||||
btn1.grid(row=2,column=0,padx=40,pady=100,ipadx=20)
|
||||
btn2.grid(row=2,column=2,padx=20,pady=100,ipadx=15)
|
||||
root.rowconfigure(1,weight=2)
|
||||
root.columnconfigure(1,weight=1)
|
||||
root.rowconfigure(2,weight=1)
|
||||
root.mainloop()
|
||||
|
||||
init(sys.argv[1])
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
''' handle commands.'''
|
||||
|
||||
import ri_widget
|
||||
import os
|
||||
|
||||
def quit():
|
||||
''' correspond to quit button '''
|
||||
@@ -32,8 +33,9 @@ def next():
|
||||
|
||||
ri_widget.Widget.dict[wid_name].show()
|
||||
else:
|
||||
ri_widget.MessageBox.dict["next"].show()
|
||||
|
||||
code = ri_widget.MessageBox.dict["next"].show()
|
||||
if code == True:
|
||||
os.execl('/usr/bin/python','python','ri_install.py', "-d","tk")
|
||||
from ri_tk_cmd import *
|
||||
|
||||
|
||||
|
||||
@@ -571,6 +571,12 @@ p_node - xml node (parent node)'''
|
||||
srvs.appendChild(srv)
|
||||
p_node.appendChild(srvs)
|
||||
|
||||
def install_information():
|
||||
to_xml()
|
||||
xmldoc = minidom.parse(install_xml)
|
||||
root = xmldoc.firstChild
|
||||
return root.toxml()
|
||||
|
||||
def init():
|
||||
''' initialize '''
|
||||
Partition.init_from_os()
|
||||
|
||||
@@ -103,7 +103,7 @@ def create_widget_sub(w, p_win):
|
||||
|
||||
# process action init
|
||||
if 'action' in dir(w) and 'init' in w.action.dict:
|
||||
getattr(sys.modules['ri_cmd'], w.action.dict['init'])()
|
||||
getattr(sys.modules['ri_cmd'], w.action.dict['init'])(w_win)
|
||||
|
||||
# handle scroll bar for sub_widgets
|
||||
if 'action' in dir(w):
|
||||
@@ -162,7 +162,8 @@ def create_message_box(w):
|
||||
''' display MessageBox
|
||||
w - MessageBox instance'''
|
||||
disp = getattr(tkMessageBox, w.tp)
|
||||
disp(translate_text(w.title), translate_text(w.message))
|
||||
code = disp(translate_text(w.title), translate_text(w.message))
|
||||
return code
|
||||
|
||||
def create_top_window(w):
|
||||
''' display TopWindow
|
||||
|
||||
@@ -9,13 +9,13 @@ import re
|
||||
import copy
|
||||
import sys
|
||||
|
||||
def serial_no_init():
|
||||
def serial_no_init(w):
|
||||
display.var_dict['serial_no.number'].set(value=ri_data.SerialNumber.value)
|
||||
|
||||
def serial_no_quit():
|
||||
ri_data.SerialNumber.value = display.var_dict['serial_no.number'].get()
|
||||
|
||||
def mount_list_init():
|
||||
def mount_list_init(w):
|
||||
''' initialize mount list '''
|
||||
ri_data.MountPoint.init_from_internal()
|
||||
l = []
|
||||
@@ -33,7 +33,7 @@ def mount_list_modify(*args):
|
||||
tw = ri_widget.TopWindow.dict['mount_list_modify']
|
||||
tw.show()
|
||||
|
||||
def mp_top_init():
|
||||
def mp_top_init(w):
|
||||
''' mount dir top window initialize '''
|
||||
ml_win = ri_widget.Widget.dict['mount.list'].tk_widget
|
||||
idxs = ml_win.curselection()
|
||||
@@ -90,7 +90,7 @@ def mp_top_cancel():
|
||||
ri_widget.TopWindow.dict['mount_list_modify'].hide()
|
||||
pass
|
||||
|
||||
def network_init():
|
||||
def network_init(w):
|
||||
''' network initialize '''
|
||||
display.var_dict['network_host_name']. set(value=ri_data.Network.hostname)
|
||||
ri_widget.Widget.dict['network_config_%s' %(ri_data.Network.configuration and ri_data.Network.configuration or 'static')].tk_widget.invoke()
|
||||
@@ -191,7 +191,7 @@ def software_group_optional_quit():
|
||||
i.install = display.var_dict[vn].get()
|
||||
print i.name, i.install
|
||||
|
||||
def dependency_list_init():
|
||||
def dependency_list_init(w):
|
||||
''' init function for list in dependency step '''
|
||||
ri_dep.construct_depending()
|
||||
ri_dep.resolve_recursive_depending()
|
||||
@@ -220,7 +220,7 @@ w - Widget instance '''
|
||||
wi.grid_location.dict['row'] = idx / int(w.grid_management.columns)
|
||||
w.add_sub_widget(wi)
|
||||
|
||||
def service_init():
|
||||
def service_init(w):
|
||||
''' initialize service checkboxes, based on package selection '''
|
||||
# first refresh service state
|
||||
ri_data.Service.change_state()
|
||||
@@ -238,7 +238,7 @@ def service_quit():
|
||||
vn = "service_%s" %(i.name)
|
||||
i.start = display.var_dict[vn].get()
|
||||
|
||||
def raid_raw_init():
|
||||
def raid_raw_init(w):
|
||||
''' initialize raid raw devices (parttion with id 'fd' '''
|
||||
global raid_raw_initialized
|
||||
if not raid_raw_initialized:
|
||||
@@ -283,7 +283,7 @@ def raid_spare_to_raw():
|
||||
''' move device from spare to raw '''
|
||||
list_to_list('raid_spare.list', 'raid_spare_devs', 'raid_raw_devs')
|
||||
|
||||
def raid_device_init():
|
||||
def raid_device_init(w):
|
||||
''' initialize raid device list '''
|
||||
raid_devs = [ r.device for r in ri_data.Raid.list ]
|
||||
display.var_dict['raid_devs'].set(value=tuple(raid_devs))
|
||||
@@ -356,3 +356,9 @@ def raid_device_list_detail(*args):
|
||||
display.var_dict['raid_detail_level'].set(value='level: %s' %(str(r.level)))
|
||||
|
||||
raid_raw_initialized = False
|
||||
|
||||
def install_information_init(w):
|
||||
'''install information initialize'''
|
||||
ins_info = ri_data.install_information()
|
||||
w.insert(1.0,ins_info)
|
||||
|
||||
|
||||
@@ -106,7 +106,8 @@ class MessageBox:
|
||||
|
||||
def show(self):
|
||||
''' display dialog'''
|
||||
display.create_message_box(self)
|
||||
code = display.create_message_box(self)
|
||||
return code
|
||||
|
||||
class TopWindow:
|
||||
''' implement top_window in interface.xml - top_window corresponds to Toplevel in Tkinter '''
|
||||
|
||||
@@ -722,7 +722,8 @@ row 4 | |
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<message_box name='next' type='showinfo' title='install sequence' message='#last-step'/>
|
||||
<message_box name='check_old_conf' type='askokcancel' title='check old config' message='#check-old-config'/>
|
||||
<message_box name='next' type='askokcancel' title='install sequence' message='#installation-confirmation'/>
|
||||
<message_box name='previous' type='showinfo' title='install sequence' message='#first-step'/>
|
||||
<message_box name='raid_add_warning' type='showwarning' title='raid adding' message='#raid-add-warning'/>
|
||||
<message_box name='raid_delete_warning' type='showwarning' title='raid deleting' message='#raid-delete-warning'/>
|
||||
@@ -815,10 +816,44 @@ row 4 | |
|
||||
</widget>
|
||||
</top_window>
|
||||
|
||||
<text key='#Copyright'>
|
||||
<English>Copyright 2001-2010 Linx Technology Co., Ltd.</English>
|
||||
<Chinese>北京凝思科技有限公司 版权所有</Chinese>
|
||||
</text>
|
||||
<!--
|
||||
column1 column2 column3
|
||||
_____________________________________________________
|
||||
| |
|
||||
| ____________________ |
|
||||
| | | ^ |
|
||||
| | | | |
|
||||
| | | | |
|
||||
| | | | |
|
||||
| |____________________| v |
|
||||
| <- - - - - - - - - - -> |
|
||||
|_____________________________________________________|
|
||||
|
||||
-->
|
||||
|
||||
<widget type='Frame' name='install_information'>
|
||||
<grid_management rows='2' columns='2'>
|
||||
<configure row='0' weight='1'/>
|
||||
<configure column='0' weight='1'/>
|
||||
</grid_management>
|
||||
<grid_location row='2' column='1' columnspan='2' sticky='NSWE'/>
|
||||
<action>
|
||||
<scroll scrolling='install_information.scroll.v' scrolled='install_information.list'/>
|
||||
<scroll scrolling='install_information.scroll.h' scrolled='install_information.list'/>
|
||||
</action>
|
||||
<widget type='Text' name='install_information.list'>
|
||||
<grid_location row='0' column='0' padx='30' pady='30' sticky='NSWE'/>
|
||||
<action init='install_information_init'/>
|
||||
</widget>
|
||||
<widget type='Scrollbar' name='install_information.scroll.v'>
|
||||
<widget_attribute orient='vertical'/>
|
||||
<grid_location row='0' column='1' pady='30' sticky='NS'/>
|
||||
</widget>
|
||||
<widget type='Scrollbar' name='install_information.scroll.h'>
|
||||
<widget_attribute orient='horizontal'/>
|
||||
<grid_location row='1' column='0' padx='30' sticky='WE'/>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<text key='#first-step'>
|
||||
<English>You have already been in the first step.</English>
|
||||
@@ -851,11 +886,21 @@ row 4 | |
|
||||
</text>
|
||||
|
||||
<text key='#Welcome'>
|
||||
<English>Welcome to use
|
||||
Linx Rocky Secure Operating System v4.2</English>
|
||||
<Chinese>欢迎使用
|
||||
凝思磐石安全操作系统 v4.2</Chinese>
|
||||
<English>Welcome to useLinx Rocky Secure Operating System v4.2</English>
|
||||
<Chinese>欢迎使用凝思磐石安全操作系统 v4.2</Chinese>
|
||||
</text>
|
||||
|
||||
<text key='#Installation-confirmation'>
|
||||
<English>installation Configuration is completed, press the OK button to start the installation</English>
|
||||
<Chinese>安装配置完成,按确定键开始安装</Chinese>
|
||||
</text>
|
||||
|
||||
<text key='#check-old-config'>
|
||||
<English>The system detects the presence of the last installation to retain the configuration file, whether to use</English>
|
||||
<Chinese>系统检测到存在上次安装保留的配置文件,是否使用它</Chinese>
|
||||
</text>
|
||||
|
||||
|
||||
|
||||
<text>
|
||||
<English>Active</English>
|
||||
@@ -1071,5 +1116,6 @@ Linx Rocky Secure Operating System v4.2</English>
|
||||
<widget name='software group'/>
|
||||
<widget name='dependency'/>
|
||||
<widget name='service'/>
|
||||
<widget name='install_information'/>
|
||||
</sequence>
|
||||
</interface>
|
||||
|
||||
Reference in New Issue
Block a user