Shows the steps to install information
This commit is contained in:
37
interface/ri_check_oldconf.py
Normal file
37
interface/ri_check_oldconf.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/pyhton
|
||||
import tkMessageBox
|
||||
import Tkinter
|
||||
from xml.dom import minidom
|
||||
|
||||
itf_xml = '../xml/interface.xml'
|
||||
xmldoc = minidom.parse(itf_xml)
|
||||
root = xmldoc.firstChild
|
||||
def getmessage(language):
|
||||
for child in root.childNodes:
|
||||
if child.nodeType == child.ELEMENT_NODE and child.nodeName == 'message_box'\
|
||||
and child.attributes['name'].value == 'check_old_conf':
|
||||
message_key = child.attributes['message'].value
|
||||
for child in root.childNodes:
|
||||
if child.nodeType == child.ELEMENT_NODE and child.nodeName == 'text'\
|
||||
and child.hasAttribute('key')and child.attributes['key'].value == message_key:
|
||||
if language == 'english':
|
||||
return child.childNodes[1].firstChild.data
|
||||
else:
|
||||
return child.childNodes[3].firstChild.data
|
||||
|
||||
|
||||
def init(language='english'):
|
||||
'''base_w -base widget instance'''
|
||||
root_window = Tkinter.Tk()
|
||||
|
||||
root_window.geometry("%sx%s+0+0" %(root_window.winfo_screenwidth(),root_window.winfo_screenheight()))
|
||||
root_window.title('Linx')
|
||||
|
||||
# bind WM_DELETE_WINDOW
|
||||
root_window.protocol("WM_DELETE_WINDOW", root_window.quit)
|
||||
message_info = getmessage(language)
|
||||
code = tkMessageBox.askokcancel(message=message_info)
|
||||
root_window.destroy()
|
||||
return code
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ def next():
|
||||
|
||||
ri_widget.Widget.dict[wid_name].show()
|
||||
else:
|
||||
ri_widget.MessageBox.dict["next"].show()
|
||||
code = ri_widget.MessageBox.dict["next"].show()
|
||||
return code
|
||||
|
||||
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 '''
|
||||
|
||||
@@ -6,6 +6,7 @@ import ri_data
|
||||
|
||||
import sys
|
||||
import getopt
|
||||
import ri_check_oldconf
|
||||
from xml.dom import minidom
|
||||
import os.path
|
||||
|
||||
@@ -39,7 +40,11 @@ xmldoc = minidom.parse(itf_xml)
|
||||
ri_data.install_xml = ins_xml
|
||||
|
||||
if os.path.isfile(ins_xml):
|
||||
ri_data.init_from_xml()
|
||||
code = ri_check_oldconf.init(ri_tk.language)
|
||||
if code == True:
|
||||
ri_data.init_from_xml()
|
||||
else:
|
||||
ri_data.init()
|
||||
else:
|
||||
ri_data.init()
|
||||
|
||||
|
||||
@@ -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