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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user