diff --git a/interface/check_oldconf.py b/interface/check_oldconf.py new file mode 100644 index 0000000..b4c38fc --- /dev/null +++ b/interface/check_oldconf.py @@ -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]) + diff --git a/interface/ri_cmd.py b/interface/ri_cmd.py index 7c0e2b1..a717802 100644 --- a/interface/ri_cmd.py +++ b/interface/ri_cmd.py @@ -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 * 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/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 +