add more frames
a little progress in code. i decided to add inheritance in widgets.
This commit is contained in:
@@ -52,3 +52,9 @@ def display_widget_sub(w, p_win):
|
||||
def kill_widget(win):
|
||||
''' win - Tk window instance '''
|
||||
win.destroy()
|
||||
|
||||
def display_entry(w):
|
||||
|
||||
def display_listbox(w):
|
||||
|
||||
def display_radiobutton(w):
|
||||
|
||||
@@ -52,7 +52,6 @@ class Widget:
|
||||
for w in w_list:
|
||||
self.widgets.append(Widget(w))
|
||||
|
||||
|
||||
def widget_attribute(self, xml_node):
|
||||
attr_list = [ a for a in xml_node.childNodes
|
||||
if a.nodeType == a.ELEMENT_NODE and a.nodeName == "widget_attribute"]
|
||||
@@ -70,6 +69,49 @@ class Widget:
|
||||
d[a.name] = a.value
|
||||
return d
|
||||
|
||||
def display(self):
|
||||
display_widget(self)
|
||||
|
||||
class Label(Widget):
|
||||
''' Label '''
|
||||
def __init__(self, xml_node):
|
||||
Widget.__init__(self, xml_node)
|
||||
|
||||
class Button(Widget):
|
||||
''' Button '''
|
||||
def __init__(self, xml_node):
|
||||
Widget.__init__(self, xml_node)
|
||||
|
||||
class Frame(Widget):
|
||||
''' Frame '''
|
||||
def __init__(self, xml_node):
|
||||
Widget.__init__(self, xml_node)
|
||||
|
||||
class Entry(Widget):
|
||||
''' Entry '''
|
||||
def __init__(self, xml_node):
|
||||
Widget.__init__(self, xml_node)
|
||||
|
||||
def display(self):
|
||||
display_entry(self)
|
||||
|
||||
class Listbox(Widget):
|
||||
''' Listbox '''
|
||||
def __init__(self, xml_node):
|
||||
Widget.__init__(self, xml_node)
|
||||
#### need add scroll bar
|
||||
|
||||
def display(self):
|
||||
display_listbox(self)
|
||||
|
||||
class Radiobutton(Widget):
|
||||
''' Radiobutton '''
|
||||
def __init__(self, xml_node):
|
||||
Widget.__init__(self, xml_node)
|
||||
### need add radios
|
||||
|
||||
def display(self):
|
||||
display_radiobutton(self)
|
||||
|
||||
def construct(xml_root):
|
||||
''' construct Widget's static members'''
|
||||
|
||||
@@ -20,7 +20,7 @@ row 4 | quit previous next |
|
||||
</grid_management>
|
||||
<grid_location row='0' column='0' sticky='NSWE'/>
|
||||
|
||||
<widget type="Label">
|
||||
<widget type='Label'>
|
||||
<widget_attribute image='/home/zhi/git/install/graphicalinstall/images/linxlogo.gif'/>
|
||||
<grid_location row='0' column='0' sticky='W' padx='5' pady='5'/>
|
||||
</widget>
|
||||
@@ -93,6 +93,7 @@ row 3 | |
|
||||
row 4 | |
|
||||
|____________________________________________________________|
|
||||
-->
|
||||
|
||||
<widget type='Frame' name='serial_no'>
|
||||
<grid_management rows='1' columns='3'>
|
||||
<configure row='0' weight='1'/>
|
||||
@@ -120,8 +121,166 @@ row 4 | |
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<!--
|
||||
column 0 column 1 column 2
|
||||
____________________________________________________________
|
||||
row 0 | |
|
||||
row 1 | |
|
||||
row 2 | partition |
|
||||
| _________ _________ |
|
||||
| | | device: |_________| |
|
||||
| | | __________________________ |
|
||||
| | text | | | |
|
||||
| | | | | |
|
||||
| | | | | |
|
||||
| |_________| | | |
|
||||
| |__________________________| |
|
||||
| |
|
||||
| new edit delete reset |
|
||||
| |
|
||||
row 3 | |
|
||||
row 4 | |
|
||||
|____________________________________________________________|
|
||||
-->
|
||||
<widget type='Frame' name='partition'>
|
||||
<grid_management rows='4' columns='2'>
|
||||
<configure row='1' weight='1'/>
|
||||
<configure row='2' weight='1'/>
|
||||
<configure column='0' weight='1'/>
|
||||
<configure column='1' weight='1'/>
|
||||
</grid_management>
|
||||
<grid_location row='2' column='0' columnspan='3' sticky='NSWE'/>
|
||||
|
||||
<widget type='Text'>
|
||||
<widget_attribute width='40' height='15' state='disabled'/>
|
||||
<grid_location row='0' column='0' rowspan='4'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Label'>
|
||||
<widget_attribute text='partition'/>
|
||||
<grid_location row='0' column='0' columnspan='2'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Frame'>
|
||||
<grid_location row='1' column='1' sticky='WS' pady='10'/>
|
||||
<widget type='Label'>
|
||||
<widget_attribute text='device:'/>
|
||||
<grid_location row='0' column='0' />
|
||||
</widget>
|
||||
<widget type='Entry'>
|
||||
<widget_attribute width='10'/>
|
||||
<grid_location row='0' column='1' padx='10'/>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget type='Frame'>
|
||||
<grid_management rows='2' columns='4'>
|
||||
<configure column='3' weight='1'/>
|
||||
</grid_management>
|
||||
<grid_location row='2' column='1' sticky='NW'/>
|
||||
|
||||
<widget type='Listbox'>
|
||||
<widget_attribute width='60' height='15'/>
|
||||
<grid_location row='0' column='0' columnspan='4' sticky='W' pady='10'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Button'>
|
||||
<widget_attribute text='new'/>
|
||||
<grid_location row='1' column='0' sticky='W'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Button'>
|
||||
<widget_attribute text='edit'/>
|
||||
<grid_location row='1' column='1' padx='10'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Button'>
|
||||
<widget_attribute text='delete'/>
|
||||
<grid_location row='1' column='2' padx='10'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Button'>
|
||||
<widget_attribute text='reset'/>
|
||||
<grid_location row='1' column='3' sticky='E'/>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget type='Frame' name='mount'>
|
||||
<grid_management rows='1' columns='3'>
|
||||
<configure row='0' weight='1'/>
|
||||
<configure column='0' weight='1'/>
|
||||
<configure column='1' weight='1'/>
|
||||
<configure column='2' weight='1'/>
|
||||
</grid_management>
|
||||
<grid_location row='2' column='0' columnspan='3' sticky='NSWE'/>
|
||||
|
||||
<widget type='Text'>
|
||||
<widget_attribute width='40' height='15' state='disabled'/>
|
||||
<grid_location row='0' column='0'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Listbox'>
|
||||
<widget_attribute width='40' height='15'/>
|
||||
<grid_location row='0' column='1' columnspan='2'/>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget type='Frame' name='network'>
|
||||
<grid_management rows='1' columns='3'>
|
||||
<configure row='0' weight='1'/>
|
||||
<configure column='0' weight='1'/>
|
||||
<configure column='1' weight='1'/>
|
||||
<configure column='2' weight='1'/>
|
||||
</grid_management>
|
||||
<grid_location row='2' column='0' columnspan='3' sticky='NSWE'/>
|
||||
|
||||
<widget type='Text'>
|
||||
<widget_attribute width='40' height='15' state='disabled'/>
|
||||
<grid_location row='0' column='0'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Frame'>
|
||||
<grid_management rows='3' columns='2'>
|
||||
<configure row='0' weight='1'/>
|
||||
<configure row='1' weight='1'/>
|
||||
<configure row='2' weight='1'/>
|
||||
</grid_management>
|
||||
<grid_location row='0' column='1' columnspan='2'/>
|
||||
|
||||
<widget type='Label'>
|
||||
<widget_attribute text='host name'/>
|
||||
<grid_location row='0' column='0' sticky='W'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Entry'>
|
||||
<widget_attribute width='12'/>
|
||||
<grid_location row='0' column='1' sticky='W'/>
|
||||
</widget>
|
||||
|
||||
<widget type='Label'>
|
||||
<widget_attribute text='#NCM'/>
|
||||
<grid_location row='1' column='0'/>
|
||||
</widget>
|
||||
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<message key='host name'>
|
||||
<English>host name</English>
|
||||
<Chinese>主机名</Chinese>
|
||||
</message>
|
||||
|
||||
<message key='#NCM'>
|
||||
<English>Network Configuration Management:</English>
|
||||
<Chinese>网络配置方式</Chinese>
|
||||
</message>
|
||||
|
||||
<sequence name='main'>
|
||||
<widget name='welcome'/>
|
||||
<widget name='serial_no'/>
|
||||
<widget name='partition'/>
|
||||
<widget name='mount'/>
|
||||
<widget name='network'/>
|
||||
</sequence>
|
||||
</interface>
|
||||
|
||||
Reference in New Issue
Block a user