[PATCH 2/5] Fix ready and completed properties for text storage

Jesse Keating jkeating at redhat.com
Mon Sep 24 22:47:26 UTC 2012


This brings things more in-line with the GUI spoke.  Also it imports the
thread stuff only once rather than multiple times.
---
 pyanaconda/ui/tui/spokes/storage.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index d1b85c3..db63750 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -28,6 +28,7 @@ from pyanaconda.ui.tui.simpleline import TextWidget, CheckboxWidget
 from pyanaconda.storage.size import Size
 from pyanaconda.flags import flags
 from pyanaconda.kickstart import doKickstartStorage
+from pyanaconda.threads import threadMgr, AnacondaThread
 
 from pykickstart.constants import *
 
@@ -93,6 +94,8 @@ class StorageSpoke(NormalTUISpoke):
         NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
         self.selected_disks = self.data.ignoredisk.onlyuse[:]
 
+        self._ready = False
+
         # This list gets set up once in initialize and should not be modified
         # except perhaps to add advanced devices. It will remain the full list
         # of disks that can be included in the install.
@@ -101,7 +104,13 @@ class StorageSpoke(NormalTUISpoke):
 
     @property
     def completed(self):
-        return bool(self.selected_disks and not self.errors)
+        return bool(self.storage.rootDevice and not self.errors)
+
+    @property
+    def ready(self):
+        # By default, the storage spoke is not ready.  We have to wait until
+        # storageInitialize is done.
+        return self._ready and not threadMgr.get("AnaStorageWatcher")
 
     @property
     def status(self):
@@ -162,8 +171,6 @@ class StorageSpoke(NormalTUISpoke):
         NormalTUISpoke.refresh(self, args)
 
         # Join the initialization thread to block on it
-        from pyanaconda.threads import threadMgr
-
         initThread = threadMgr.get("AnaStorageWatcher")
         if initThread:
             # This print is foul.  Need a better message display
@@ -262,8 +269,6 @@ class StorageSpoke(NormalTUISpoke):
             log.warn(w)
 
     def initialize(self):
-        from pyanaconda.threads import threadMgr, AnacondaThread
-
         NormalTUISpoke.initialize(self)
 
         threadMgr.add(AnacondaThread(name="AnaStorageWatcher",
@@ -276,8 +281,6 @@ class StorageSpoke(NormalTUISpoke):
         # Secondary initialize so wait for the storage thread
         # to complete before populating our disk list
 
-        from pyanaconda.threads import threadMgr
-
         storageThread = threadMgr.get("AnaStorageThread")
         if storageThread:
             storageThread.join()
-- 
1.7.11.4



More information about the anaconda-patches mailing list