[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 2/5] Make Callbacks._update_size_label callable from outside the object.



Having it be private was based upon the old assumption that you couldn't add
devices during installation.  Of course, that's incorrect for things like
iSCSI and FCOE.  So now that we need to update the size label when the
Add Advanced button is clicked, it needs to be renamed.
---
 iw/filter_gui.py |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/iw/filter_gui.py b/iw/filter_gui.py
index e2a9172..b540621 100644
--- a/iw/filter_gui.py
+++ b/iw/filter_gui.py
@@ -109,7 +109,7 @@ class Callbacks(object):
         self.xml = xml
 
         self.sizeLabel = self.xml.get_widget("sizeLabel")
-        self.sizeLabel.connect("realize", self._update_size_label)
+        self.sizeLabel.connect("realize", self.update)
 
     def addToUI(self, tuple):
         pass
@@ -125,12 +125,18 @@ class Callbacks(object):
             selectedDevices -= 1
             selectedSize -= device["XXX_SIZE"]
 
-        self._update_size_label()
+        self.update()
 
     def isMember(self, info):
         return info and not isRAID(info) and not isCCISS(info) and \
                not isMultipath(info) and not isOther(info)
 
+    def update(self, *args, **kwargs):
+        global selectedDevices, totalDevices
+        global selectedSize, totalSize
+
+        self.sizeLabel.set_markup(_("<b>%s device(s) (%s MB) selected</b> out of %s device(s) (%s MB) total.") % (selectedDevices, selectedSize, totalDevices, totalSize))
+
     def visible(self, model, iter, view):
         # Most basic visibility function - does the model say this row
         # should be visible?  Subclasses can define their own more specific
@@ -139,12 +145,6 @@ class Callbacks(object):
         return self.isMember(model.get_value(iter, OBJECT_COL)) and \
                model.get_value(iter, 1)
 
-    def _update_size_label(self, *args, **kwargs):
-        global selectedDevices, totalDevices
-        global selectedSize, totalSize
-
-        self.sizeLabel.set_markup(_("<b>%s device(s) (%s MB) selected</b> out of %s device(s) (%s MB) total.") % (selectedDevices, selectedSize, totalDevices, totalSize))
-
 class RAIDCallbacks(Callbacks):
     def isMember(self, info):
         return info and (isRAID(info) or isCCISS(info))
@@ -396,6 +396,9 @@ class FilterWindow(InstallWindow):
 
         self.populate(nonraids, mpaths, raids)
 
+        # Make sure to update the size label at the bottom.
+        self.pages[0].cb.update()
+
         self._cachedDevices.extend(nonraids)
         self._cachedMPaths.extend(mpaths)
         self._cachedRaidDevices.extend(raids)
-- 
1.6.5.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]