trunk/yali/yali/gui - Fixes pds failing if storage api throw question

Mete Alpaslan uludag-commits at pardus.org.tr
27 Ara 2010 Pzt 08:44:32 EET


Author: mete
Date: Mon Dec 27 08:44:32 2010
New Revision: 34381

Modified:
   trunk/yali/yali/gui/ScrAdmin.py
   trunk/yali/yali/gui/ScrDateTime.py
Log:
Fixes pds failing if storage api throw question

PDE needs return value to stop thread however storage api handle disk
states by self and show user to select state what to do it to keep on.

---
 ScrAdmin.py    |   15 +++++++++++----
 ScrDateTime.py |   13 ++++++++++---
 2 files changed, 21 insertions(+), 7 deletions(-)

Modified: trunk/yali/yali/gui/ScrAdmin.py
=================================================================
--- trunk/yali/yali/gui/ScrAdmin.py	(original)
+++ trunk/yali/yali/gui/ScrAdmin.py	Mon Dec 27 08:44:32 2010
@@ -14,7 +14,7 @@
 
 _ = gettext.translation('yali', fallback=True).ugettext
 
-from PyQt4.Qt import QWidget, SIGNAL, QLineEdit
+from PyQt4.Qt import QWidget, SIGNAL, QLineEdit, QTimer
 from pds.thread import PThread
 from pds.gui import PMessageBox, MIDCENTER, CURRENT, OUT
 
@@ -38,7 +38,7 @@
         self.pass_valid = False
 
         self.pthread = None
-        self.pds_messagebox = PMessageBox(ctx.mainScreen)
+        self.pds_messagebox = PMessageBox(self)
         self.pds_messagebox.enableOverlay()
 
         self.connect(self.ui.pass1, SIGNAL("textChanged(const QString &)"),
@@ -74,7 +74,10 @@
         self.ui.pass1.setFocus()
 
         if ctx.flags.install_type == ctx.STEP_DEFAULT:
-            self.pthread = PThread(self, self.startInit, self.initFinished)
+            self.pthread = PThread(self, self.startInit, self.dummy)
+
+    def dummy(self):
+        pass
 
     def execute(self):
         ctx.installData.rootPassword = unicode(self.ui.pass1.text())
@@ -90,17 +93,21 @@
                 else:
                     ctx.mainScreen.step_increment = 1
             else:
-                self.pds_messagebox.busy.busy()
                 self.pds_messagebox.setMessage(_("Storage Devices initialising..."))
                 self.pds_messagebox.animate(start=MIDCENTER, stop=MIDCENTER)
                 ctx.mainScreen.step_increment = 0
                 self.pthread.start()
+                QTimer.singleShot(2, self.startStorageInitialize)
                 return False
 
         return True
 
     def startInit(self):
+        self.pds_messagebox.animate(start=MIDCENTER, stop=MIDCENTER)
+
+    def startStorageInitialize(self):
         ctx.storageInitialized = yali.storage.initialize(ctx.storage, ctx.interface)
+        self.initFinished()
 
     def initFinished(self):
         self.pds_messagebox.animate(start=CURRENT, stop=CURRENT, direction=OUT)

Modified: trunk/yali/yali/gui/ScrDateTime.py
=================================================================
--- trunk/yali/yali/gui/ScrDateTime.py	(original)
+++ trunk/yali/yali/gui/ScrDateTime.py	Mon Dec 27 08:44:32 2010
@@ -67,7 +67,7 @@
         self.ui.calendarWidget.setDate(QDate.currentDate())
 
         self.pthread = None
-        self.pds_messagebox = PMessageBox(ctx.mainScreen)
+        self.pds_messagebox = PMessageBox(self)
         self.pds_messagebox.enableOverlay()
 
         self.timer.start(1000)
@@ -94,7 +94,10 @@
         self.timer.start(1000)
 
         if ctx.flags.install_type == ctx.STEP_BASE:
-            self.pthread = PThread(self, self.startInit, self.initFinished)
+            self.pthread = PThread(self, self.startInit, self.dummy)
+
+    def dummy(self):
+        pass
 
     def setTime(self):
         ctx.interface.informationWindow.update(_("Adjusting time settings"))
@@ -134,17 +137,21 @@
                     ctx.mainScreen.step_increment = 1
                 return True
             else:
-                self.pds_messagebox.busy.busy()
                 self.pds_messagebox.setMessage(_("Storage Devices initialising..."))
                 self.pds_messagebox.animate(start=MIDCENTER, stop=MIDCENTER)
                 ctx.mainScreen.step_increment = 0
                 self.pthread.start()
+                QTimer.singleShot(2, self.startStorageInitialize)
                 return False
 
         return True
 
     def startInit(self):
+        self.pds_messagebox.animate(start=MIDCENTER, stop=MIDCENTER)
+
+    def startStorageInitialize(self):
         ctx.storageInitialized = yali.storage.initialize(ctx.storage, ctx.interface)
+        self.initFinished()
 
     def initFinished(self):
         self.pds_messagebox.animate(start=CURRENT, stop=CURRENT, direction=OUT)


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi