if self.selected:
preset_path = qvariant_converter.getString(self.selected.data(Qt.UserRole))
preset = self.preset_data["children"][preset_path]
- self.pageContent.descriptionLabel.setText(preset["info"].get("description", ""))
- image = os.path.join(preset["info"]["path"], const.PREDEFINED_BOARD_IMAGE_FILE)
- if os.path.exists(image):
- self.pageContent.imageLabel.setPixmap(QPixmap(image))
- self.pageContent.imageLabel.setVisible(True)
- else:
- self.pageContent.imageLabel.setVisible(False)
+ description = preset["info"].get("description", "")
+ path = unicode(QUrl.fromLocalFile(preset_path).toString())
+ description = description.replace("$path", path)
+ self.pageContent.descriptionArea.setHtml(description)
@property
def selected(self):
if preset_path:
self.setProjectInfo("PROJECT_PRESET", preset_path)
self.setProjectInfo("BASE_MODE", not self.advanced)
- # TODO: find a better place for preset loading...
- try:
- QApplication.instance().setOverrideCursor(Qt.WaitCursor)
- self.project.loadProjectFromPreset(preset_path)
- finally:
- QApplication.instance().restoreOverrideCursor()
return True
else:
self.setProjectInfo("PROJECT_PRESET", None)
return False
+ def validatePage(self):
+ """
+ This hack permits to load the preset once, when the user go press the
+ Next button.
+ """
+ preset_path = self.selected_path
+ try:
+ QApplication.instance().setOverrideCursor(Qt.WaitCursor)
+ self.project.loadProjectFromPreset(preset_path)
+ finally:
+ QApplication.instance().restoreOverrideCursor()
+ # Return always True, this is a fake validation.
+ return True
+
def nextId(self):
"""
Overload of the QWizardPage nextId method.