4 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
9 # Author: Lorenzo Berni <duplo@develer.com>
12 from PyQt4.QtCore import *
13 from PyQt4.QtGui import *
16 import qvariant_converter
18 class BWizardPage(QWizardPage):
20 Base class for all the wizard pages. It has the utility method used in all
21 the pages. A wizard page class need to extend this class.
24 def __init__(self, wizardGui, parent = None):
25 QWizardPage.__init__(self, parent)
26 self.pageContent = uic.loadUi(wizardGui, None)
27 layout = QVBoxLayout()
28 layout.addWidget(self.pageContent)
29 self.setLayout(layout)
31 def _exceptionOccurred(self, message):
33 Simple message box showing method.
35 QMessageBox.critical(self, self.tr("Error occurred"), message, QMessageBox.Ok, QMessageBox.NoButton)
37 def _settingsStore(self, key, value):
39 Stores the given value in the QSettings associated with the given key.
41 QApplication.instance().settings.setValue(QString(key), value)
43 def _settingsRetrieve(self, key):
45 Retrieves the value associated to key in the QSettings. Note that this
46 Value is a QVariant and neet to be converted in a standard type.
48 return QApplication.instance().settings.value(QString(key), QVariant())
50 def _projectInfoStore(self, key, value):
52 Stores the given value in the BProject class associating it with the given
55 QApplication.instance().project.setInfo(key, value)
57 def _projectInfoRetrieve(self, key):
59 Retrieves the information associated with the given key.
61 return QApplication.instance().project.info(key)
65 Returns the BProject instance.
67 return QApplication.instance().project
71 Returns the version list from the QSettings.
73 return qvariant_converter.getStringList(self._settingsRetrieve("versions"))
75 def setVersions(self, versions):
77 Stores the given versions in the QSettings.
79 self._settingsStore("versions", qvariant_converter.convertStringList(versions))
81 def searchDirList(self):
83 Returns the search dir list from the QSettings.
85 return qvariant_converter.getStringList(self._settingsRetrieve("search_dir_list"))
87 def setSearchDirList(self, search_dir_list):
89 Stores the search dir list in the QSettings.
91 self._settingsStore("search_dir_list", qvariant_converter.convertStringList(search_dir_list))
95 Returns the value of path search from the QSettings.
97 return qvariant_converter.getBool(self._settingsRetrieve("path_search"))
99 def setPathSearch(self, path_search):
101 Stores the path search value in the QSettings.
103 self._settingsStore("path_search", qvariant_converter.convertBool(path_search))
105 def toolchains(self):
107 Returns the toolchains stored in the QSettings.
109 return qvariant_converter.getBoolDict(self._settingsRetrieve("toolchains"))
111 def setToolchains(self, toolchains):
113 Stores the toolchains in the QSettings.
115 self._settingsStore("toolchains", qvariant_converter.convertBoolDict(toolchains))
117 def reloadData(self):
119 Method called before the page is loaded. The pages that need to use this
120 method have to implement it.