modified: ri_tk_cmd.py

updata:
        add check a directory mount point in the MountPoint or not
This commit is contained in:
fling
2010-10-21 16:30:42 +08:00
parent 7a2885dc84
commit 2b2925f920

View File

@@ -61,18 +61,10 @@ def mp_top_init():
if fs == fs_values[i]:
ri_widget.Widget.dict['mp_top_fs'].tk_widget.selection_set(i)
def mp_top_check(dev,dir):
'''check mount point'''
if dir:
for d in ri_data.MountPoint.dict.values():
if d.device == dev :continue
if d.directory == dir : return True
return False
def mp_top_ok():
''' mount dir top window OK '''
l = []
the_same = False
isdir_in_mp = False
for itm in eval(display.var_dict['mount.list'].get()):
dev = itm.split()[0]
dev2 = display.var_dict['mp_top_dev'].get()
@@ -90,9 +82,11 @@ def mp_top_ok():
fs = ri_data.Partition.dict[dev].filesystem
else:
fs = ' '
if mp_top_check(dev,dr):
the_same = True
if dr and dr in [ m.directory for m in ri_data.MountPoint.dict.values() if m.device != dev ]:
isdir_in_mp = True
dr = ri_data.MountPoint.dict[dev].directory
s2 = dev.ljust(10) + dr.ljust(10) + fs.ljust(10) + fm.ljust(4) + sz.ljust(6) + ri_data.Partition.unit
l.append(s2)
# make change in internal data structure
@@ -102,7 +96,7 @@ def mp_top_ok():
display.var_dict['mount.list'].set(value=tuple(l))
ri_widget.TopWindow.dict['mount_list_modify'].hide()
if the_same:
if isdir_in_mp:
ri_widget.MessageBox.dict['check_mount_point'].show()
def mp_top_cancel():