process on mount dir top window

This commit is contained in:
lizhi-rocky
2010-07-27 10:39:59 +08:00
parent 602463a772
commit ea32a7f555
6 changed files with 62 additions and 6 deletions

View File

@@ -64,3 +64,16 @@ def mount_list_modify(*args):
''' modify an item in mount list '''
tw = ri_widget.TopWindow.dict['mount_list_modify']
tw.show()
def mp_top_fs_init():
''' mount dir top window initialize '''
ml_win = ri_widget.Widget.dict['mount.list'].tk_widget
idxs = ml_win.curselection()
if len(idxs) == 1:
idx = int(idxs[0])
s = display.var_dict['mount.list'].get()
if not s: return
tpl = eval(s)
dev, dir, fs = tpl[idx].split()
print dev, dir, fs

View File

@@ -54,7 +54,7 @@ def modify_attributes(attr_dict):
attr_dict[a] = getattr(MyImage, image_var)
elif a == 'command':
attr_dict[a] = getattr(sys.modules["ri_cmd"], attr_dict[a])
elif a == "textvariable" or a == "listvariable":
elif a == "textvariable" or a == "listvariable" or a == 'variable':
attr_dict[a] = var_dict[attr_dict[a]]
def create_widget_sub(w, p_win):

View File

@@ -18,8 +18,8 @@
</raid>
</raids>
<mount-points>
<mount-point device='/dev/hdb1' directory='/' file-system='ext3'/>
<mount-point device='/dev/hdb5' directory='/usr' file-system='ext2'/>
<mount-point device='/dev/hdb1' directory='/' file-system='ext3' format='yes'/>
<mount-point device='/dev/hdb5' directory='/usr' file-system='ext2' format='no'/>
</mount-points>
<network domain='in.linx' secondary_dns='' ip='192.168.1.25' hostname='localhost' mask='255.255.255.0' primary_dns='192.168.1.254' configuration='static' gateway='192.168.1.254'/>
<groups>

View File

@@ -66,6 +66,9 @@
<attribute name="device"/>
<attribute name="directory"/>
<attribute name="file-system"/>
<attribute name="format">
<ref name="mybool"/>
</attribute>
</element>
</oneOrMore>
</element>

View File

@@ -97,6 +97,15 @@ on special cases -->
</choice>
</attribute>
</optional>
<optional>
<attribute name='variable'/>
</optional>
<optional>
<attribute name='value'/>
</optional>
<optional>
<attribute name='selectmode'/>
</optional>
</interleave>
</element>
</define>

View File

@@ -314,15 +314,46 @@ row 4 | |
<configure row='0' weight='1'/>
<configure column='0' weight='1'/>
</grid_management>
<widget type='Frame'>
<grid_location row='0' column='0'/>
<widget type='Label' name='mount_list_modify.dev'>
<grid_location row='0' column='0' columnspan='2' sticky='W'/>
<variable name='mp_top_format' type='StringVar'/>
<widget type='Label'>
<widget_attribute text='Device'/>
<grid_location row='0' column='0' padx='10' sticky='W'/>
</widget>
<widget type='Label'>
<widget_attribute text='mount point: '/>
<widget_attribute textvariable='mp_top_dev'/>
<grid_location row='0' column='1' sticky='W'/>
<variable name='mp_top_dev' type='StringVar'/>
</widget>
<widget type='Label'>
<widget_attribute text='Directory'/>
<grid_location row='1' column='0' padx='10' sticky='W'/>
</widget>
<widget type='Entry'>
<widget_attribute width='10' textvariable='mp_top_dir'/>
<grid_location row='1' column='1' sticky='W'/>
<variable name='mp_top_dir' type='StringVar'/>
</widget>
<widget type='Radiobutton'>
<widget_attribute text='Format' variable='mp_top_format' value='format'/>
<grid_location row='2' column='0'/>
</widget>
<widget type='Radiobutton'>
<widget_attribute text='Not-Format' variable='mp_top_format' value='not-format'/>
<grid_location row='2' column='1'/>
</widget>
<widget type='Label'>
<widget_attribute text='Filesystem'/>
<grid_location row='3' column='0' sticky='W'/>
</widget>
<widget type='Listbox'>
<widget_attribute listvariable='mp_top_fs'/>
<grid_location row='3' column='1' sticky='W'/>
<variable name='mp_top_fs' type='StringVar' value='ext2 ext3 reiserfs xfs jfs'/>
<action init='mp_top_fs_init' quit='mp_top_fs_quit'/>
</widget>
</widget>
</top_window>