X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBBoardPage.py;h=fd6fc9292e7a51afe8fe83fe9ec97fe813eb021a;hb=6431df5575f8d3d6c4ee5f9dd9c9c4e272f684cc;hp=69a732e515dbb639ca2c4c5f199a796be4884bc0;hpb=cbb06143e9ae3553f74baf6ee00ed4e755e0cc37;p=bertos.git diff --git a/wizard/BBoardPage.py b/wizard/BBoardPage.py index 69a732e5..fd6fc929 100644 --- a/wizard/BBoardPage.py +++ b/wizard/BBoardPage.py @@ -41,12 +41,10 @@ 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 -from bertos_utils import presetList +from bertos_utils import presetList, _cmp class BBoardPage(BWizardPage): """ @@ -69,10 +67,18 @@ 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) 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 ## @@ -89,15 +95,15 @@ class BBoardPage(BWizardPage): """ self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self.updateUi) self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self, SIGNAL("completeChanged()")) + self.connect(self.pageContent.customButton, SIGNAL("clicked()"), self.customButtonClicked) def reloadData(self): """ Overload of the BWizardPage reloadData method. """ + self.project.loadProjectPresets() preset_list = self.projectInfo("PRESET_TREE") preset_list = preset_list["children"] - def _cmp(x, y): - return cmp(x["info"].get('ord', 0), y["info"].get('ord', 0)) preset_list = sorted(preset_list.values(), _cmp) self.setItems(preset_list) @@ -110,13 +116,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() ####