diff --git a/python/mine/ri_cmd.py b/python/mine/ri_cmd.py
index 45a0e88..6302a65 100644
--- a/python/mine/ri_cmd.py
+++ b/python/mine/ri_cmd.py
@@ -1,28 +1,34 @@
#!/usr/bin/python
''' handle gui button related commands.'''
-import ri_tk
+import ri_tk as display
import ri_seq
import ri_widget
def quit():
''' correspond to quit button '''
- ri_tk.quit()
+ display.quit()
def previous():
''' correspond to previous button '''
- if 'current_window' in dir(ri_tk):
- ri_tk.kill_widget(ri_tk.current_window)
-
wid_name = ri_seq.previous()
+ print wid_name
if wid_name is not None:
- ri_tk.display_widget(ri_widget.Widget.dict[wid_name])
+ if 'current_window' in dir(display):
+ display.kill_widget(display.current_window)
+
+ ri_widget.Widget.dict[wid_name].display()
+ else:
+ ri_widget.MessageBox.dict["previous"].display()
def next():
''' correspond to next button '''
- if 'current_window' in dir(ri_tk):
- ri_tk.kill_widget(ri_tk.current_window)
-
wid_name = ri_seq.next()
+ print wid_name
if wid_name is not None:
- ri_tk.display_widget(ri_widget.Widget.dict[wid_name])
+ if 'current_window' in dir(display):
+ display.kill_widget(display.current_window)
+
+ ri_widget.Widget.dict[wid_name].display()
+ else:
+ ri_widget.MessageBox.dict["next"].display()
diff --git a/python/mine/ri_seq.py b/python/mine/ri_seq.py
index 239b62d..cfe0ca5 100644
--- a/python/mine/ri_seq.py
+++ b/python/mine/ri_seq.py
@@ -11,6 +11,10 @@ class Sequence:
if s.nodeType == s.ELEMENT_NODE and s.nodeName == "widget" ]
self.current_step = 0
+ def set_step(self, st):
+ ''' set current step based on input step name'''
+ self.current_step = self.steps.index(st)
+
def construct(xml_root):
''' construct Sequence's static members'''
global current_sequence
diff --git a/python/mine/ri_tk.py b/python/mine/ri_tk.py
index 480bd2a..5ee78ca 100644
--- a/python/mine/ri_tk.py
+++ b/python/mine/ri_tk.py
@@ -2,9 +2,9 @@
''' handle display related work upon Tkinter '''
import Tkinter
-
+import tkMessageBox
def initialize(base_w):
- ''' base widget xml node '''
+ ''' base_w - base widget instance '''
global root_window
root_window = Tkinter.Tk()
@@ -53,8 +53,14 @@ def kill_widget(win):
''' win - Tk window instance '''
win.destroy()
-def display_entry(w):
+#def display_entry(w):
-def display_listbox(w):
+#def display_listbox(w):
-def display_radiobutton(w):
+#def display_radiobutton(w):
+
+def display_message_box(w):
+ ''' display MessageBox
+ w - widget instance'''
+ disp = getattr(tkMessageBox, "show%s" %(w.tp))
+ disp(w.title, w.message)
diff --git a/python/mine/ri_widget.py b/python/mine/ri_widget.py
index 0725b12..6e0cad7 100644
--- a/python/mine/ri_widget.py
+++ b/python/mine/ri_widget.py
@@ -2,6 +2,7 @@
import Tkinter
import sys
+import ri_tk as display
class GridManagement:
''' implement grid management '''
@@ -70,7 +71,7 @@ class Widget:
return d
def display(self):
- display_widget(self)
+ display.display_widget(self)
class Label(Widget):
''' Label '''
@@ -113,8 +114,33 @@ class Radiobutton(Widget):
def display(self):
display_radiobutton(self)
+class MessageBox():
+ ''' implement dialog in interface.xml '''
+ dict={}
+
+ def __init__(self, xml_node):
+ self.name = xml_node.attributes["name"].value
+ self.tp = xml_node.attributes["type"].value
+ self.title = xml_node.attributes["title"].value
+ self.message = xml_node.attributes["message"].value
+
+ def display(self):
+ ''' display dialog'''
+ display.display_message_box(self)
+
def construct(xml_root):
''' construct Widget's static members'''
for w in xml_root.childNodes:
if w.nodeType == w.ELEMENT_NODE and w.nodeName == "widget" and "name" in w.attributes.keys():
Widget.dict[w.attributes["name"].value] = Widget(w)
+ elif w.nodeType == w.ELEMENT_NODE and w.nodeName == "message_box" and "name" in w.attributes.keys():
+ MessageBox.dict[w.attributes["name"].value] = MessageBox(w)
+
+def init_display(bw):
+ ''' base widget name'''
+ base_w = Widget.dict[bw]
+ display.initialize(base_w)
+
+def mainloop():
+ '''run message main loop '''
+ display.root_window.mainloop()
diff --git a/python/mine/test.py b/python/mine/test.py
index 0a3edc3..4115f5e 100644
--- a/python/mine/test.py
+++ b/python/mine/test.py
@@ -5,19 +5,42 @@ import ri_tk
import ri_seq
from xml.dom import minidom
-xmldoc = minidom.parse("../../xml/interface_t.xml")
+import sys
+import getopt
+
+def print_usages():
+ print 'Usages: %s [-b|--begin] xml_file_name' %sys.argv[0]
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "b:", ["begin=",])
+except getopt.GetoptError:
+ print_usages()
+ sys.exit(1)
+
+begin_step=None
+for opt, arg in opts:
+ if opt in ('-b', '--begin'):
+ begin_step = arg
+
+if len(args):
+ xmldoc = minidom.parse(args[0])
+else:
+ xmldoc = minidom.parse("../../xml/interface_t.xml")
ri_widget.construct(xmldoc.firstChild)
ri_seq.construct(xmldoc.firstChild)
base_widget_name = xmldoc.firstChild.attributes["base_widget"].value
-base_widget = ri_widget.Widget.dict[base_widget_name]
-
-ri_tk.initialize(base_widget)
+ri_widget.init_display(base_widget_name)
main_sequence_name = xmldoc.firstChild.attributes["sequence"].value
main_sequence = ri_seq.dict[main_sequence_name]
-ri_tk.display_widget(ri_widget.Widget.dict[main_sequence.steps[0]])
+if begin_step is None:
+ begin_step = main_sequence.steps[0]
+else:
+ main_sequence.set_step(begin_step)
+
+ri_widget.Widget.dict[begin_step].display()
-ri_tk.root_window.mainloop()
+ri_widget.mainloop()
diff --git a/xml/interface_ng.xml b/xml/interface_ng.xml
index ba4ca50..4199069 100644
--- a/xml/interface_ng.xml
+++ b/xml/interface_ng.xml
@@ -6,11 +6,14 @@
-
-
-
-
+
+
+
+
+
+
+
@@ -35,6 +38,9 @@
+
+
+
@@ -70,6 +76,9 @@ on special cases -->
+
+
+
@@ -120,6 +129,25 @@ on special cases -->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xml/interface_t.xml b/xml/interface_t.xml
index aa4bcac..9a1aaca 100644
--- a/xml/interface_t.xml
+++ b/xml/interface_t.xml
@@ -53,16 +53,6 @@ row 4 | quit previous next |
-
- Rocky 4.2
- 磐石 4.2
-
-
-
- Copyright
- 版权
-
-
-
+
+
-
@@ -156,13 +146,8 @@ row 4 | |
-
-
-
-
-
-
+
@@ -177,7 +162,7 @@ row 4 | |
-
+
@@ -266,6 +251,19 @@ row 4 | |
+
+
+
+
+ Rocky 4.2
+ 磐石 4.2
+
+
+
+ Copyright
+ 版权
+
+
host name
主机名