From 07ead0ed3cd7f3e8f82ec7d2d1dd93335e89eba8 Mon Sep 17 00:00:00 2001 From: Li Zhi Date: Tue, 24 Aug 2010 08:34:28 +0759 Subject: [PATCH] 1. remove wrap from bind in interface.xml 2. in MountPoint, add refresh ability --- python/ri_data.py | 30 +++++++++++++++++++++++------- python/ri_tk_cmd.py | 2 +- python/ri_widget.py | 6 ++---- xml/install.xml | 5 ++++- xml/interface.xml | 6 +++--- xml/interface_ng.xml | 8 -------- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/python/ri_data.py b/python/ri_data.py index 3b3d7f4..7420ee3 100644 --- a/python/ri_data.py +++ b/python/ri_data.py @@ -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): diff --git a/python/ri_tk_cmd.py b/python/ri_tk_cmd.py index bc1d8b1..0f6616f 100644 --- a/python/ri_tk_cmd.py +++ b/python/ri_tk_cmd.py @@ -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])) diff --git a/python/ri_widget.py b/python/ri_widget.py index c3988f1..e0eda90 100644 --- a/python/ri_widget.py +++ b/python/ri_widget.py @@ -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)) diff --git a/xml/install.xml b/xml/install.xml index 56448c3..6e7e657 100644 --- a/xml/install.xml +++ b/xml/install.xml @@ -37,7 +37,10 @@ - + + + + diff --git a/xml/interface.xml b/xml/interface.xml index cbb4381..e3c8ea0 100644 --- a/xml/interface.xml +++ b/xml/interface.xml @@ -386,7 +386,7 @@ row 2 | _______________ __________________ | - + @@ -463,7 +463,7 @@ row 4 | | - + @@ -608,7 +608,7 @@ row 4 | | | _____________________________________________ | | | _ _ _ | | | | |_| optional 1 |_| optional 2 |_| optional 3| | - | |_____________________________________________| | + | |_____________________________________________| | |________________________________________________________________________| --> diff --git a/xml/interface_ng.xml b/xml/interface_ng.xml index 435489c..eb8e8f6 100644 --- a/xml/interface_ng.xml +++ b/xml/interface_ng.xml @@ -196,14 +196,6 @@ on special cases --> - - - - single - double - -