From f6667ff5437b71c2275d2608dc3c5fb7ebbdf4fd Mon Sep 17 00:00:00 2001 From: root Date: Mon, 20 Sep 2010 11:44:48 +0800 Subject: [PATCH] Shows the steps to install information --- interface/ri_check_oldconf.py | 37 ++++++++++++++++++++ interface/ri_cmd.py | 3 +- interface/ri_data.py | 6 ++++ interface/ri_tk.py | 5 +-- interface/ri_tk_cmd.py | 22 +++++++----- interface/ri_widget.py | 3 +- interface/test.py | 7 +++- xml/interface.xml | 64 ++++++++++++++++++++++++++++++----- 8 files changed, 125 insertions(+), 22 deletions(-) create mode 100644 interface/ri_check_oldconf.py diff --git a/interface/ri_check_oldconf.py b/interface/ri_check_oldconf.py new file mode 100644 index 0000000..e2d149f --- /dev/null +++ b/interface/ri_check_oldconf.py @@ -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 + + diff --git a/interface/ri_cmd.py b/interface/ri_cmd.py index 7c0e2b1..a106151 100644 --- a/interface/ri_cmd.py +++ b/interface/ri_cmd.py @@ -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 * diff --git a/interface/ri_data.py b/interface/ri_data.py index 7420ee3..8da2f55 100644 --- a/interface/ri_data.py +++ b/interface/ri_data.py @@ -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() diff --git a/interface/ri_tk.py b/interface/ri_tk.py index ed449f8..773213b 100644 --- a/interface/ri_tk.py +++ b/interface/ri_tk.py @@ -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 diff --git a/interface/ri_tk_cmd.py b/interface/ri_tk_cmd.py index affa4c4..7923d8b 100644 --- a/interface/ri_tk_cmd.py +++ b/interface/ri_tk_cmd.py @@ -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) + diff --git a/interface/ri_widget.py b/interface/ri_widget.py index fd2d87c..674f869 100644 --- a/interface/ri_widget.py +++ b/interface/ri_widget.py @@ -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 ''' diff --git a/interface/test.py b/interface/test.py index a5a22da..5c8d806 100644 --- a/interface/test.py +++ b/interface/test.py @@ -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() diff --git a/xml/interface.xml b/xml/interface.xml index b03dbdf..40dacf2 100644 --- a/xml/interface.xml +++ b/xml/interface.xml @@ -722,7 +722,8 @@ row 4 | | - + + @@ -815,10 +816,44 @@ row 4 | | - - Copyright 2001-2010 Linx Technology Co., Ltd. - 北京凝思科技有限公司 版权所有 - + + + + + + + + + + + + + + + + + + + + + + + + + You have already been in the first step. @@ -851,11 +886,21 @@ row 4 | | - Welcome to use -Linx Rocky Secure Operating System v4.2 - 欢迎使用 -凝思磐石安全操作系统 v4.2 + Welcome to useLinx Rocky Secure Operating System v4.2 + 欢迎使用凝思磐石安全操作系统 v4.2 + + + installation Configuration is completed, press the OK button to start the installation + 安装配置完成,按确定键开始安装 + + + + The system detects the presence of the last installation to retain the configuration file, whether to use + 系统检测到存在上次安装保留的配置文件,是否使用它 + + + Active @@ -1071,5 +1116,6 @@ Linx Rocky Secure Operating System v4.2 +