modified: ri_tk_cmd.py
update date list--->dict
This commit is contained in:
@@ -20,7 +20,7 @@ def mount_list_init():
|
||||
''' initialize mount list '''
|
||||
l = []
|
||||
ri_data.MountPoint.init_from_internal()
|
||||
for m in ri_data.MountPoint.list:
|
||||
for m in ri_data.MountPoint.dict.values():
|
||||
# get size from Partition info
|
||||
sz = ri_data.Partition.get_size(m.device)
|
||||
if not sz:
|
||||
@@ -41,7 +41,7 @@ def mp_top_init():
|
||||
|
||||
if len(idxs) == 1:
|
||||
idx = int(idxs[0])
|
||||
mp = ri_data.MountPoint.list[idx]
|
||||
mp = ri_data.MountPoint.dict.values()[idx]
|
||||
dev = mp.device
|
||||
dir = mp.directory
|
||||
fs = mp.filesystem
|
||||
@@ -72,7 +72,7 @@ def mp_top_ok():
|
||||
dir = display.var_dict['mp_top_dir'].get()
|
||||
fm = display.var_dict['mp_top_format'].get()
|
||||
idxs2 = ri_widget.Widget.dict['mp_top_fs'].tk_widget.curselection()
|
||||
for m in ri_data.Partition.list:
|
||||
for m in ri_data.Partition.dict.values():
|
||||
if m.device == dev2:
|
||||
base_fs = m.filesystem
|
||||
if len(idxs2) and fm =='yes' :
|
||||
@@ -262,7 +262,7 @@ def raid_raw_init():
|
||||
raid_raw_initialized = True
|
||||
# get all component devices already in raid
|
||||
devs=ri_data.Raid.dev_in_raid()
|
||||
raw_devs = [ p.device for p in ri_data.Partition.list
|
||||
raw_devs = [ p.device for p in ri_data.Partition.dict.values()
|
||||
if p.israid=='yes' and p.device not in devs ]
|
||||
display.var_dict['raid_raw_devs'].set(value=tuple(raw_devs))
|
||||
|
||||
@@ -301,7 +301,7 @@ def raid_spare_to_raw():
|
||||
|
||||
def raid_device_init():
|
||||
''' initialize raid device list '''
|
||||
raid_devs = [ r.device for r in ri_data.Raid.list ]
|
||||
raid_devs = [ r.device for r in ri_data.Raid.dict.values()]
|
||||
display.var_dict['raid_devs'].set(value=tuple(raid_devs))
|
||||
|
||||
def raid_calc_size(level, devs):
|
||||
@@ -312,7 +312,7 @@ devs - raid component devices
|
||||
# all devs shall have same size.
|
||||
unit=ri_data.Partition.unit
|
||||
dev_size_list=[]
|
||||
for p in ri_data.Partition.list:
|
||||
for p in ri_data.Partition.dict.values():
|
||||
if p.device in devs:
|
||||
dev_size_list.append(float(p.size))
|
||||
dev_size_list.sort()
|
||||
@@ -366,7 +366,7 @@ def raid_device_delete():
|
||||
idxs = win_dev.curselection()
|
||||
if len(idxs) == 1:
|
||||
idx = int(idxs[0])
|
||||
r = ri_data.Raid.list[idx]
|
||||
r = ri_data.Raid.dict.values()[idx]
|
||||
if r.from_os == 'yes':
|
||||
ri_widget.MessageBox.dict["raid_delete_warning"].show()
|
||||
return
|
||||
@@ -384,7 +384,7 @@ def raid_device_delete():
|
||||
# do not touch level
|
||||
display.var_dict['raid_active_devs'].set(value=tuple(active))
|
||||
display.var_dict['raid_spare_devs'].set(value=tuple(spare))
|
||||
del ri_data.Raid.list[idx]
|
||||
del ri_data.Raid.dict.values()[idx]
|
||||
raid_device_init()
|
||||
|
||||
def raid_device_list_detail(*args):
|
||||
@@ -393,7 +393,7 @@ def raid_device_list_detail(*args):
|
||||
idxs = win.curselection()
|
||||
if len(idxs) == 1:
|
||||
idx = int(idxs[0])
|
||||
r = ri_data.Raid.list[idx]
|
||||
r = ri_data.Raid.dict.values()[idx]
|
||||
display.var_dict['raid_detail_active'].set(value='active: %s' %(str(r.active_components)))
|
||||
display.var_dict['raid_detail_spare'].set(value='spare: %s' %(str(r.spare_components)))
|
||||
display.var_dict['raid_detail_level'].set(value='level: %s' %(str(r.level)))
|
||||
|
||||
Reference in New Issue
Block a user