trunk/yali/yali/gui - Disable collection flag if parsing collection.xml ...

Mete Alpaslan uludag-commits at pardus.org.tr
3 Mar 2011 Per 09:23:26 EET


Author: mete
Date: Thu Mar  3 09:23:26 2011
New Revision: 36348

Modified:
   trunk/yali/yali/gui/ScrCollection.py
Log:
Disable collection flag if parsing collection.xml failed

If parsing collection.xml failed, skip collection screen and turn off
collection flag.

---
 ScrCollection.py |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Modified: trunk/yali/yali/gui/ScrCollection.py
=================================================================
--- trunk/yali/yali/gui/ScrCollection.py	(original)
+++ trunk/yali/yali/gui/ScrCollection.py	Thu Mar  3 09:23:26 2011
@@ -32,16 +32,19 @@
     def __init__(self):
         QWidget.__init__(self)
         self.setupUi(self)
-        self.collections = None
-        self.current_item = None
-        self.last_item = None
-        self.collectionList.itemClicked.connect(self.openItem)
-        self.collectionList.currentItemChanged.connect(self.itemChanged)
-        self.fillCollections()
+        self.collections = yali.pisiiface.getCollection()
+        if len(self.collections) == 0:
+            ctx.flags.collection = False
+            ctx.logger.debug("There is no collection so disable collection support.")
+        else:
+            self.fillCollections()
+            self.current_item = None
+            self.last_item = None
+            self.collectionList.itemClicked.connect(self.openItem)
+            self.collectionList.currentItemChanged.connect(self.itemChanged)
 
     def fillCollections(self):
         self.collectionList.clear()
-        self.collections = yali.pisiiface.getCollection()
         selected = None
         for index, collection in enumerate(self.collections):
             self.addItem(collection)
@@ -55,10 +58,7 @@
         self.collectionList.setCurrentRow(selected)
 
     def shown(self):
-        if len(self.collections) == 0:
-            ctx.mainScreen.enableBack()
-            return
-        elif len(self.collections) == 1:
+        if len(self.collections) == 1:
             ctx.logger.debug("There is only one collection so skip screen.")
             ctx.mainScreen.slotNext()
             return


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi