1. remove wrap from bind in interface.xml
2. in MountPoint, add refresh ability
This commit is contained in:
@@ -281,21 +281,37 @@ class MountPoint:
|
||||
|
||||
@staticmethod
|
||||
def change(dev, dir, fs, fm):
|
||||
for i in range(len(MountPoint.list)):
|
||||
if MountPoint.list[i].device == dev:
|
||||
MountPoint.list[i].directory = dir
|
||||
MountPoint.list[i].filesystem = fs
|
||||
MountPoint.list[i].format = fm
|
||||
for mp in MountPoint.list:
|
||||
if mp.device == dev:
|
||||
mp.directory = dir
|
||||
mp.filesystem = fs
|
||||
mp.format = fm
|
||||
|
||||
def device(self):
|
||||
return self.device
|
||||
|
||||
@staticmethod
|
||||
def init_from_internal():
|
||||
''' init MountPoint from internal class Partition and class Raid '''
|
||||
devs = [ m.device for m in MountPoint.list ]
|
||||
for p in Partition.list:
|
||||
if p.id != 'fd':
|
||||
if p.id != 'fd' and p.device not in devs:
|
||||
MountPoint(p.device, sz=p.size)
|
||||
|
||||
for r in Raid.list:
|
||||
MountPoint(r,device, sz=r.size)
|
||||
if r.device not in devs:
|
||||
MountPoint(r.device, sz=r.size)
|
||||
|
||||
# now process whether a partition or raid was removed
|
||||
s1 = set([ m.device for m in MountPoint.list ])
|
||||
s2 = set([ p.device for p in Partition.list ] + [ r.device for r in Raid.list])
|
||||
for dev in s1-s2:
|
||||
for i in range(len(MountPoint.list)):
|
||||
if dev == MountPoint.list[i].device:
|
||||
del MountPoint.list[i]
|
||||
break
|
||||
# sort
|
||||
MountPoint.list.sort(key=MountPoint.device)
|
||||
|
||||
@staticmethod
|
||||
def init_from_xml(node):
|
||||
|
||||
@@ -17,13 +17,13 @@ def serial_no_quit():
|
||||
|
||||
def mount_list_init():
|
||||
''' initialize mount list '''
|
||||
ri_data.MountPoint.init_from_internal()
|
||||
l = []
|
||||
for m in ri_data.MountPoint.list:
|
||||
# get size from Partition info
|
||||
sz = ri_data.Partition.get_size(m.device)
|
||||
if not sz:
|
||||
sz = ri_data.Raid.get_size(m.device)
|
||||
print m.device, m.directory, m.filesystem, m.format, sz
|
||||
s = m.device.ljust(10) + m.directory.ljust(10) + m.filesystem.ljust(10) + m.format.ljust(4) + sz.ljust(6)
|
||||
l.append(s)
|
||||
display.var_dict['mount.list'].set(value=tuple([str(i) for i in l]))
|
||||
|
||||
@@ -74,10 +74,8 @@ class Widget:
|
||||
elif node.nodeName == "action":
|
||||
self.action = Action(node)
|
||||
elif node.nodeName == 'binding':
|
||||
if node.attributes['wrap'].value == 'single':
|
||||
seq = '<'+node.attributes["sequence"].value+'>'
|
||||
elif node.attributes['wrap'].value == 'double':
|
||||
seq = '<<'+node.attributes["sequence"].value+'>>'
|
||||
seq = node.attributes["sequence"].value
|
||||
print seq
|
||||
self.bindings.append((seq, \
|
||||
node.attributes["function"].value))
|
||||
|
||||
|
||||
@@ -37,7 +37,10 @@
|
||||
<mount-point device='sdb2' directory='' file-system='' format='no'/>
|
||||
<mount-point device='sdb3' directory='/olp' file-system='reiserfs' format='yes'/>
|
||||
<mount-point device='sdb4' directory='/' file-system='ext3' format='yes'/>
|
||||
<mount-point device='md0' directory='' file-system='' format='no'/>
|
||||
<mount-point device='md0' directory='/usr' file-system='' format='no'/>
|
||||
<mount-point device='sda1' directory='' file-system='' format='no'/>
|
||||
<mount-point device='sdb1' directory='' file-system='' format='no'/>
|
||||
<mount-point device='md1' directory='/usr/lib64' file-system='' format='no'/>
|
||||
</mount-points>
|
||||
<network domain='' secondary_dns='' ip='172.115.155.144' hostname='lizhi' mask='' primary_dns='' configuration='static' gateway=''/>
|
||||
<groups>
|
||||
|
||||
@@ -386,7 +386,7 @@ row 2 | _______________ __________________ |
|
||||
<grid_location row='1' column='1' rowspan='2'/>
|
||||
<variable name='raid_devs' type='StringVar'/>
|
||||
<action init='raid_device_init'/>
|
||||
<binding sequence='ListboxSelect' function='raid_device_list_detail' wrap='double'/>
|
||||
<binding sequence='<<ListboxSelect>>' function='raid_device_list_detail'/>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -463,7 +463,7 @@ row 4 | |
|
||||
<grid_location row='0' column='0' sticky='NSWE'/>
|
||||
<variable name='mount.list' type='StringVar'/>
|
||||
<action init='mount_list_init'/>
|
||||
<binding sequence='ListboxSelect' function='mount_list_modify' wrap='double'/>
|
||||
<binding sequence='<<ListboxSelect>>' function='mount_list_modify'/>
|
||||
</widget>
|
||||
<widget type='Scrollbar' name='mount.scroll.v'>
|
||||
<widget_attribute orient='vertical'/>
|
||||
@@ -608,7 +608,7 @@ row 4 | |
|
||||
| _____________________________________________ |
|
||||
| | _ _ _ | |
|
||||
| | |_| optional 1 |_| optional 2 |_| optional 3| |
|
||||
| |_____________________________________________| |
|
||||
| |_____________________________________________| |
|
||||
|________________________________________________________________________|
|
||||
-->
|
||||
|
||||
|
||||
@@ -196,14 +196,6 @@ on special cases -->
|
||||
<element name='binding'>
|
||||
<attribute name='sequence'/>
|
||||
<attribute name='function'/>
|
||||
<!-- less than and greater than are reservied words in xml, but binding need use
|
||||
one or two of them to wrap sequence name -->
|
||||
<attribute name='wrap'>
|
||||
<choice>
|
||||
<value>single</value>
|
||||
<value>double</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user