X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBBoardPage.py;h=03f96048202ba2a00a7a0458930c48aaa64c0dff;hb=976d522209efc4c11a019ae6b34657b6b3f59ba0;hp=301d46b7c36383abe30aa6a5aa50c11375d88686;hpb=46cd7a45ea505ac9bb18d410e349b9553c95457a;p=bertos.git diff --git a/wizard/BBoardPage.py b/wizard/BBoardPage.py index 301d46b7..03f96048 100644 --- a/wizard/BBoardPage.py +++ b/wizard/BBoardPage.py @@ -28,7 +28,6 @@ # # Copyright 2010 Develer S.r.l. (http://www.develer.com/) # -# $Id$ # # Author: Lorenzo Berni # @@ -41,8 +40,6 @@ from PyQt4.QtGui import * from BWizardPage import BWizardPage from BCpuPage import BCpuPage -from BOutputPage import BOutputPage -from BRoutePage import BRoutePage import const import qvariant_converter @@ -56,7 +53,7 @@ class BBoardPage(BWizardPage): def __init__(self): BWizardPage.__init__(self, const.UI_LOCATION + "/board_select.ui") - self.setTitle(self.tr("Select the board from the predefined ones")) + self.setTitle(self.tr("Select your development board")) ## Overloaded QWizardPage methods ## @@ -69,10 +66,19 @@ class BBoardPage(BWizardPage): preset_path = qvariant_converter.getStringDict(preset_path["info"]) preset_path = preset_path["path"] self.setProjectInfo("PROJECT_BOARD", preset_path) + self.setProjectInfo("PROJECT_FROM_PRESET", True) + self.setProjectInfo("PRESET_LOADED", False) return True else: return False + def nextId(self): + wizard = self.wizard() + if not self.projectInfo("PROJECT_FROM_PRESET"): + return wizard.pageIndex(BCpuPage) + else: + return QWizardPage.nextId(self) + #### ## Overloaded BWizardPage methods ## @@ -87,17 +93,23 @@ class BBoardPage(BWizardPage): """ Overload of the BWizardPage connectSignals method. """ - self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self.updateUi) - self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self, SIGNAL("completeChanged()")) + self.connect(self.pageContent.boardList, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self.updateUi) + self.connect(self.pageContent.boardList, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self, SIGNAL("completeChanged()")) + self.connect(self.pageContent.customButton, SIGNAL("clicked()"), self.customButtonClicked) - def reloadData(self): + def reloadData(self, previous_id=None): """ Overload of the BWizardPage reloadData method. """ + self.project.loadProjectPresets() preset_list = self.projectInfo("PRESET_TREE") preset_list = preset_list["children"] preset_list = sorted(preset_list.values(), _cmp) self.setItems(preset_list) + project_from_preset = self.projectInfo("PROJECT_FROM_PRESET") + project_board = self.projectInfo("PROJECT_BOARD") + if not (project_from_preset and project_board): + self.pageContent.boardList.setCurrentRow(0) #### @@ -108,13 +120,13 @@ class BBoardPage(BWizardPage): info_dict = qvariant_converter.getDict(self.selected.data(Qt.UserRole)) info_dict = qvariant_converter.getStringDict(info_dict["info"]) description = info_dict.get("description", "") - image = os.path.join(info_dict["path"], ".image.png") - if os.path.exists(image): - self.pageContent.imageLabel.setPixmap(QPixmap(image)) - self.pageContent.imageLabel.setVisible(True) - else: - self.pageContent.imageLabel.setVisible(False) - self.pageContent.descriptionLabel.setText(description) + path = unicode(QUrl.fromLocalFile(info_dict["path"]).toString()) + description = description.replace("$path", path) + self.pageContent.descriptionArea.setHtml(description) + + def customButtonClicked(self): + self.setProjectInfo("PROJECT_FROM_PRESET", False) + self.wizard().next() #### @@ -134,4 +146,4 @@ class BBoardPage(BWizardPage): @property def selected(self): - return self.pageContent.boardList.currentItem() \ No newline at end of file + return self.pageContent.boardList.currentItem()