If no BeRTOS version is selected the Wizard automatically select the latest
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 21 Apr 2009 12:36:30 +0000 (12:36 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 21 Apr 2009 12:36:30 +0000 (12:36 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2596 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BVersionPage.py

index fde94dbb84dae030ef9a20034a02788de946cd19..ed44d48bd242c6bff9c6b3bbeafed12e77a0fb15 100644 (file)
@@ -163,6 +163,21 @@ class BVersionPage(BWizardPage):
             item = self.insertListElement(directory)
             if selected and selected == directory:
                 self.setCurrentItem(item)
+        if not selected:
+            self.setCurrentItem(self.latestVersionItem())
+    
+    def latestVersionItem(self):
+        """
+        Returns the latest BeRTOS version founded.
+        """
+        latest_version_item = QTableWidgetItem("")
+        for index in range(self.pageContent.versionList.count()):
+            item = self.pageContent.versionList.item(index)
+            version = item.text().split(" (")[0]
+            latest = latest_version_item.text().split(" (")[0]
+            if version != "UNKNOWN" and version > latest:
+                latest_version_item = item
+        return latest_version_item
     
     def setCurrentItem(self, item):
         """