From 440450f9f44c7bfc5bf1813adab87716e0a422fd Mon Sep 17 00:00:00 2001 From: duplo Date: Tue, 21 Apr 2009 12:36:30 +0000 Subject: [PATCH] If no BeRTOS version is selected the Wizard automatically select the latest git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2596 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BVersionPage.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wizard/BVersionPage.py b/wizard/BVersionPage.py index fde94dbb..ed44d48b 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -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): """ -- 2.25.1