rename directory 'python' to 'interface', for I think it is a better name for its included python scripts function.
63 lines
1.5 KiB
Python
63 lines
1.5 KiB
Python
#!/usr/bin/python
|
|
|
|
import ri_widget
|
|
import ri_tk
|
|
import ri_data
|
|
|
|
import sys
|
|
import getopt
|
|
from xml.dom import minidom
|
|
import os.path
|
|
|
|
def print_usages():
|
|
print 'Usages: %s [-b|--begin step_name] [-l|--language language] [interface_xml_file] [install_xml_file]' %sys.argv[0]
|
|
|
|
try:
|
|
opts, args = getopt.getopt(sys.argv[1:], "b:l:", ["begin=","language="])
|
|
except getopt.GetoptError:
|
|
print_usages()
|
|
sys.exit(1)
|
|
|
|
begin_step=None
|
|
for opt, arg in opts:
|
|
if opt in ('-b', '--begin'):
|
|
begin_step = arg
|
|
elif opt in ('-l', '--language'):
|
|
ri_tk.language = arg.lower()
|
|
|
|
if len(args) == 0:
|
|
itf_xml = "../xml/interface.xml"
|
|
ins_xml = "../xml/install.xml"
|
|
elif len(args) == 1:
|
|
itf_xml = args[0]
|
|
ins_xml = "../xml/install.xml"
|
|
else:
|
|
itf_xml = args[0]
|
|
ins_xml = args[1]
|
|
|
|
xmldoc = minidom.parse(itf_xml)
|
|
ri_data.install_xml = ins_xml
|
|
|
|
if os.path.isfile(ins_xml):
|
|
ri_data.init_from_xml()
|
|
else:
|
|
ri_data.init()
|
|
|
|
ri_widget.construct(xmldoc.firstChild)
|
|
|
|
base_widget_name = xmldoc.firstChild.attributes["base_widget"].value
|
|
ri_widget.init_display(base_widget_name)
|
|
|
|
main_sequence_name = xmldoc.firstChild.attributes["sequence"].value
|
|
ri_widget.Sequence.set_current_sequence(main_sequence_name)
|
|
main_sequence = ri_widget.Sequence.dict[main_sequence_name]
|
|
|
|
if begin_step is None:
|
|
begin_step = main_sequence.steps[0]
|
|
else:
|
|
main_sequence.set_current_step(begin_step)
|
|
|
|
ri_widget.Widget.dict[begin_step].show()
|
|
|
|
ri_widget.mainloop()
|