1. remove wrap from bind in interface.xml

2. in MountPoint, add refresh ability
This commit is contained in:
Li Zhi
2010-08-24 08:34:28 +07:59
parent c2ec243021
commit 07ead0ed3c
6 changed files with 33 additions and 24 deletions

View File

@@ -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):

View File

@@ -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]))

View File

@@ -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))