The add button add the bertos directory in the list
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 11 Dec 2008 14:35:41 +0000 (14:35 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 11 Dec 2008 14:35:41 +0000 (14:35 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2008 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BVersionPage.py

index 6f8e913c5d84f2c793dc3744855ccd1f6f417cbd..bad8e97d47e62e732c9f524934e8e77361c67c1e 100644 (file)
@@ -9,7 +9,9 @@
 # Author: Lorenzo Berni <duplo@develer.com>
 #
 
+from PyQt4.QtGui import *
 from BWizardPage import *
+from libbertos import *
 
 class BVersionPage(BWizardPage):
     
@@ -20,11 +22,30 @@ class BVersionPage(BWizardPage):
         self.setTitle(self.tr("Select the beRTOS version needed"))
     
     def _connectSignals(self):
+        self.connect(self.pageContent.versionList, SIGNAL("itemClicked(QListWidgetItem *)"), self.itemClicked)
+        self.connect(self.pageContent.addButton, SIGNAL("clicked()"), self.addVersion)
+        self.connect(self.pageContent.addButton, SIGNAL("clicked()"), self.removeVersion)
+        # Fake signal connection for the update button
         self.connect(self.pageContent.updateButton, SIGNAL("clicked()"), self.updateClicked)
     
     def _setupUi(self):
-        self.pageContent.updateProgressBar.setVisible(False)
-        self.pageContent.statusLabel.setVisible(False)
+        pass
+    
+    def addVersion(self):
+        directory = QFileDialog.getExistingDirectory(self, self.tr("Choose a directory"), QString(), QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
+        if isBertosDir(directory):
+            version = bertosVersion(directory)
+            self.pageContent.versionList.addItem(QListWidgetItem(QIcon(":/images/ok.png"), version))
+        else:
+            version = "UNCHECKED"
+            self.pageContent.versionList.addItem(QListWidgetItem(QIcon(":/images/warning.png"), version))
+    
+    def removeVersion(self):
+        pass
     
     def updateClicked(self):
-        print "fake update checking"
\ No newline at end of file
+        print "fake update checking"
+    
+    def itemClicked(self, item):
+        print "clicked", repr(item)
+    
\ No newline at end of file