from const import *
class BCpuPage(BWizardPage):
+ """
+ Page of the wizard that permits to choose the cpu from the supported ones.
+ """
def __init__(self):
BWizardPage.__init__(self, UI_LOCATION + "/cpu_select.ui")
self._setupUi()
def _populateCpuList(self):
+ """
+ Fills the cpu list.
+ """
self.pageContent.cpuList.clear()
self.pageContent.cpuList.setCurrentItem(None)
infos = bertos_utils.loadCpuInfos(self._project())
self.pageContent.cpuList.addItem(item)
def _connectSignals(self):
+ """
+ Connects the signals with the related slots.
+ """
self.connect(self.pageContent.cpuList, SIGNAL("itemSelectionChanged()"), self.rowChanged)
def _selectItem(self, cpu):
+ """
+ Selects the given cpu from the list.
+ """
elements = self.pageContent.cpuList.findItems(cpu, Qt.MatchCaseSensitive)
if len(elements) == 1:
self.pageContent.cpuList.setCurrentItem(elements[0])
def _setupUi(self):
+ """
+ Sets up the user interface.
+ """
self.pageContent.cpuList.setSortingEnabled(True)
self.pageContent.descriptionLabel.setVisible(False)
self.pageContent.descriptionLabel.setText("")
def reloadData(self):
+ """
+ Overload of the BWizardPage reloadData method.
+ """
QApplication.instance().setOverrideCursor(Qt.WaitCursor)
bertos_utils.loadSourceTree(self._project())
self._populateCpuList()
self.emit(SIGNAL("completeChanged()"))
def isComplete(self):
+ """
+ Overload of the QWizardPage isComplete method.
+ """
if self.pageContent.cpuList.currentRow() != -1:
infos = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))
for key, value in infos.items():
return False
def rowChanged(self):
+ """
+ Slot called when the user select an entry from the cpu list.
+ """
description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"]
description = qvariant_converter.getStringList(description)
self.pageContent.descriptionLabel.setText("<br>".join(description))
from const import *
class BFinalPage(BWizardPage):
+ """
+ Last page of the wizard. It creates the project and show a success message.
+ """
def __init__(self):
BWizardPage.__init__(self, UI_LOCATION + "/final_page.ui")
self.setTitle(self.tr("Project created successfully"))
def reloadData(self):
+ """
+ Overload of the BWizardPage reloadData method.
+ """
QApplication.instance().setOverrideCursor(Qt.WaitCursor)
bertos_utils.createBertosProject(self.wizard().project())
QApplication.instance().restoreOverrideCursor()
\ No newline at end of file
from const import *
class BFolderPage(BWizardPage):
+ """
+ Initial page of the wizard. Permit to select the project name and the directory
+ where the project will be created.
+ """
def __init__(self):
BWizardPage.__init__(self, UI_LOCATION + "/dir_select.ui")
self._connectSignals()
def _setupUi(self):
+ """
+ Sets up the user interface.
+ """
self.pageContent.warningLabel.setVisible(False)
def _initializeAttributes(self):
+ """
+ Initializes the page attributes to the default values.
+ """
self._project_name = ""
self._destination_folder = os.path.expanduser("~")
self.pageContent.directoryEdit.setText(self._destination_folder)
def _connectSignals(self):
+ """
+ Connects the signals to the related slots.
+ """
self.connect(self.pageContent.nameEdit, SIGNAL("textChanged(const QString)"), self._nameChanged)
self.connect(self.pageContent.directoryEdit, SIGNAL("textChanged(const QString)"), self._directoryChanged)
self.connect(self.pageContent.directoryButton, SIGNAL("clicked()"), self._selectDirectory)
def _nameChanged(self, name):
+ """
+ Slot called when the project name is changed manually by the user.
+ """
self._project_name = str(name).replace(" ", "_")
self._setProjectPath()
def _directoryChanged(self, directory):
+ """
+ Slot called when the project folder is changed manually by the user.
+ """
self._destination_folder = str(QDir.toNativeSeparators(directory))
self._setProjectPath()
def _setProjectPath(self):
+ """
+ Analyzes the page attributes and generates the path string.
+ """
if self._destination_folder != "" and self._project_name <> "":
if not self._destination_folder.endswith(os.sep):
self._destination_folder += "/"
self.emit(SIGNAL("completeChanged()"))
def _selectDirectory(self):
+ """
+ Slot called when the project folder is changed using the file dialog.
+ """
directory = unicode(QFileDialog.getExistingDirectory(self, self.tr("Open Directory"), "", QFileDialog.ShowDirsOnly))
if len(directory) > 0:
self.pageContent.directoryEdit.setText(directory)
def isComplete(self):
+ """
+ Overload of the QWizardPage isComplete method.
+ """
if self.pageContent.projectPath.text() != "None":
self._projectInfoStore("PROJECT_PATH", unicode(self.pageContent.projectPath.text()))
return True
from const import *
class BModulePage(BWizardPage):
+ """
+ Page of the wizard that permits to select and configurate the BeRTOS modules.
+ """
def __init__(self):
BWizardPage.__init__(self, UI_LOCATION + "/module_select.ui")
self._connectSignals()
def reloadData(self):
+ """
+ Overload of the BWizardPage reloadData method.
+ """
QApplication.instance().setOverrideCursor(Qt.WaitCursor)
self._setupUi()
self._loadModuleData()
QApplication.instance().restoreOverrideCursor()
def _setupButtonGroup(self):
+ """
+ Sets up the button group.
+ """
self._button_group = QButtonGroup()
self._button_group.setExclusive(False)
self.connect(self._button_group, SIGNAL("buttonClicked(int)"), self._moduleSelectionChanged)
def _loadModuleData(self):
+ """
+ Loads the module data.
+ """
## Load the module data only if it isn't already loaded
if self._projectInfoRetrieve("MODULES") == None \
and self._projectInfoRetrieve("LISTS") == None \
self._exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
def _fillModuleTree(self):
+ """
+ Fills the module tree with the module entries separated in categories.
+ """
modules = self._projectInfoRetrieve("MODULES")
if modules is None:
return
def _fillPropertyTable(self):
+ """
+ Slot called when the user selects a module from the module tree.
+ Fills the property table using the configuration parameters defined in
+ the source tree.
+ """
module = self._currentModule()
if module is not None:
self._control_group.clear()
self.pageContent.moduleLabel.setText(module_label)
def _insertCheckBox(self, index, value):
- ## boolean property
+ """
+ Inserts in the table at index a checkbox for a boolean property setted
+ to value.
+ """
check_box = QCheckBox()
self.pageContent.propertyTable.setCellWidget(index, 1, check_box)
if value == "1":
self._control_group.addControl(index, check_box)
def _insertComboBox(self, index, value, value_list):
- ## enum property
+ """
+ Inserts in the table at index a combobox for an enum property setted
+ to value.
+ """
try:
enum = self._projectInfoRetrieve("LISTS")[value_list]
combo_box = QComboBox()
self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(value))
def _insertSpinBox(self, index, value, informations):
+ """
+ Inserts in the table at index a spinbox for an int, a long or an unsigned
+ long property setted to value.
+ """
## int, long or undefined type property
spin_box = None
if bertos_utils.isLong(informations) or bertos_utils.isUnsignedLong(informations):
def _currentModule(self):
+ """
+ Retuns the current module name.
+ """
current_module = self.pageContent.moduleTree.currentItem()
# return only the child items
if current_module is not None and current_module.parent() is not None:
return None
def _currentModuleConfigurations(self):
+ """
+ Returns the current module configuration.
+ """
return self._configurations(self._currentModule())
def _currentProperty(self):
+ """
+ Rerturns the current property from the property table.
+ """
return qvariant_converter.getString(self.pageContent.propertyTable.item(self.pageContent.propertyTable.currentRow(), 0).data(Qt.UserRole))
def _currentPropertyItem(self):
+ """
+ Returns the QTableWidgetItem of the current property.
+ """
return self.pageContent.propertyTable.item(self.pageContent.propertyTable.currentRow(), 0)
def _configurations(self, module):
+ """
+ Returns the configuration for the selected module.
+ """
configuration = self._projectInfoRetrieve("MODULES")[module]["configuration"]
if len(configuration) > 0:
return self._projectInfoRetrieve("CONFIGURATIONS")[configuration]
return {}
def _resetPropertyDescription(self):
+ """
+ Resets the label for each property table entry.
+ """
for index in range(self.pageContent.propertyTable.rowCount()):
property_name = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
# Awful solution! Needed because if the user change the module, the selection changed...
self.pageContent.propertyTable.item(index, 0).setText(self._currentModuleConfigurations()[property_name]['brief'])
def _showPropertyDescription(self):
+ """
+ Slot called when the property selection changes. Shows the description
+ of the selected property.
+ """
self._resetPropertyDescription()
configurations = self._currentModuleConfigurations()
if self._currentProperty() in configurations.keys():
self._currentPropertyItem().setText(description + "\n" + name)
def _setupUi(self):
+ """
+ Set up the user interface.
+ """
self.pageContent.moduleTree.clear()
self.pageContent.moduleTree.setHeaderHidden(True)
self.pageContent.propertyTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
self.pageContent.moduleLabel.setVisible(False)
def _connectSignals(self):
+ """
+ Connect the signals with the related slots.
+ """
self.connect(self.pageContent.moduleTree, SIGNAL("itemPressed(QTreeWidgetItem*, int)"), self._fillPropertyTable)
self.connect(self.pageContent.moduleTree, SIGNAL("itemChanged(QTreeWidgetItem*, int)"), self._dependencyCheck)
self.connect(self.pageContent.propertyTable, SIGNAL("itemSelectionChanged()"), self._showPropertyDescription)
self.connect(self._control_group, SIGNAL("stateChanged"), self._saveValue)
def _saveValue(self, index):
+ """
+ Slot called when the user modifies one of the configuration parameters.
+ It stores the new value."""
property = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
configuration = self._projectInfoRetrieve("MODULES")[self._currentModule()]["configuration"]
configurations = self._projectInfoRetrieve("CONFIGURATIONS")
self._projectInfoStore("CONFIGURATIONS", configurations)
def _moduleSelectionChanged(self, index):
+ """
+ Slot called when the user selects or unselects a module from the module
+ tree.
+ """
module = unicode(self.pageContent.moduleTable.item(index, 1).text())
if self._button_group.button(index).isChecked():
self._moduleSelected(module)
self._moduleUnselected(module)
def _dependencyCheck(self, item):
+ """
+ Checks the dependencies of the module associated with the given item.
+ """
checked = False
module = unicode(item.text(0))
if item.checkState(0) == Qt.Checked:
self.removeFileDependencies(module)
def _moduleSelected(self, selectedModule):
+ """
+ Resolves the selection dependencies.
+ """
modules = self._projectInfoRetrieve("MODULES")
modules[selectedModule]["enabled"] = True
self._projectInfoStore("MODULES", modules)
item.child(child).setCheckState(0, Qt.Checked)
def _moduleUnselected(self, unselectedModule):
+ """
+ Resolves the unselection dependencies.
+ """
modules = self._projectInfoRetrieve("MODULES")
modules[unselectedModule]["enabled"] = False
self._projectInfoStore("MODULES", modules)
item.child(child).setCheckState(0, Qt.Unchecked)
def selectDependencyCheck(self, module):
+ """
+ Returns the list of unsatisfied dependencies after a selection.
+ """
unsatisfied = set()
modules = self._projectInfoRetrieve("MODULES")
files = self._projectInfoRetrieve("FILES")
return unsatisfied
def unselectDependencyCheck(self, dependency):
+ """
+ Returns the list of unsatisfied dependencies after an unselection.
+ """
unsatisfied = set()
modules = self._projectInfoRetrieve("MODULES")
for module, informations in modules.items():
return unsatisfied
def removeFileDependencies(self, module):
+ """
+ Removes the files dependencies of the given module.
+ """
modules = self._projectInfoRetrieve("MODULES")
files = self._projectInfoRetrieve("FILES")
dependencies = modules[module]["depends"]
self._projectInfoStore("FILES", files)
class QControlGroup(QObject):
+ """
+ Simple class that permit to connect different signals of different widgets
+ with a slot that emit a signal. Permits to group widget and to understand which of
+ them has sent the signal.
+ """
+
def __init__(self):
QObject.__init__(self)
self._controls = {}
def addControl(self, id, control):
+ """
+ Add a control.
+ """
self._controls[id] = control
if type(control) == QCheckBox:
self.connect(control, SIGNAL("stateChanged(int)"), lambda: self._stateChanged(id))
self.connect(control, SIGNAL("valueChanged(double)"), lambda: self._stateChanged(id))
def clear(self):
+ """
+ Remove all the controls.
+ """
self._controls = {}
def _stateChanged(self, id):
+ """
+ Slot called when the value of one of the stored widget changes. It emits
+ another signal.
+ """
self.emit(SIGNAL("stateChanged"), id)
\ No newline at end of file
from const import *
class BOutputPage(BWizardPage):
+ """
+ Page of the wizard that show a little summary of the previous decisions.
+ """
def __init__(self):
BWizardPage.__init__(self, UI_LOCATION + "/output_select.ui")
self._projectInfoStore("OUTPUT", [])
def _connectSignals(self):
+ """
+ Connects the signals with the related slots.
+ """
self.connect(self.pageContent.eclipseCheckBox, SIGNAL("stateChanged(int)"), lambda checked: self._modeChecked(checked, "eclipse"))
self.connect(self.pageContent.xcodeCheckBox, SIGNAL("stateChanged(int)"), lambda checked: self._modeChecked(checked, "xcode"))
self.connect(self.pageContent.codeliteCheckBox, SIGNAL("stateChanged(int)"), lambda checked: self._modeChecked(checked, "codelite"))
def _modeChecked(self, checked, value):
+ """
+ Slot called when one of the mode checkbox is checked. It stores it.
+ """
output_list = self._projectInfoRetrieve("OUTPUT")
if checked == Qt.Checked:
output_list.append(value)
#
class BProject(object):
+ """
+ Simple class for store and retrieve project informations.
+ """
def __init__(self):
self.infos = {}
def setInfo(self, key, value):
+ """
+ Store the given value with the name key.
+ """
self.infos[key] = value
def info(self, key):
+ """
+ Retrieve the value associated with the name key.
+ """
if key in self.infos.keys():
return self.infos[key]
return None
from const import *
class BToolchainPage(BWizardPage):
+ """
+ Page of the wizard that permits to choose the toolchain to use for the
+ project.
+ """
def __init__(self):
BWizardPage.__init__(self, UI_LOCATION + "/toolchain_select.ui")
self.setTitle(self.tr("Select toolchain"))
self._validation_process = None
- self._updateUi()
+ self._setupUi()
#self._populateToolchainList()
self._connectSignals()
- def _updateUi(self):
+ def _setupUi(self):
+ """
+ Sets up the user interface.
+ """
self.pageContent.infoLabel.setVisible(False)
def _populateToolchainList(self):
+ """
+ Fills the toolchain list with the toolchains stored in the QSettings.
+ """
toolchains = self.toolchains()
sel_toolchain = self._projectInfoRetrieve("TOOLCHAIN")
for key, value in toolchains.items():
self.validateToolchain(self.pageContent.toolchainList.row(item))
def _clearList(self):
+ """
+ Removes all the toolchain from the list.
+ """
self.pageContent.toolchainList.clear()
def _selectionChanged(self):
+ """
+ Slot called when the user click on an entry of the toolchain list.
+ """
if self.pageContent.toolchainList.currentRow() != -1:
infos = collections.defaultdict(lambda: unicode("not defined"))
infos.update(qvariant_converter.getStringDict(self.pageContent.toolchainList.currentItem().data(Qt.UserRole)))
self.emit(SIGNAL("completeChanged()"))
def _search(self):
+ """
+ Searches for toolchains in the stored directories, and stores them in the
+ QSettings.
+ """
dir_list = self.searchDirList()
if self.pathSearch():
dir_list += [element for element in bertos_utils.getSystemPath()]
self.setToolchains(stored_toolchains)
def _connectSignals(self):
+ """
+ Connects the signals with the related slots.
+ """
self.connect(self.pageContent.toolchainList, SIGNAL("itemSelectionChanged()"), self._selectionChanged)
self.connect(self.pageContent.addButton, SIGNAL("clicked()"), self.addToolchain)
self.connect(self.pageContent.removeButton, SIGNAL("clicked()"), self.removeToolchain)
self.connect(self.pageContent.checkButton, SIGNAL("clicked()"), self.validateAllToolchains)
def _validItem(self, index, infos):
+ """
+ Sets the item at index as a valid item and associates the given info to it.
+ """
item = self.pageContent.toolchainList.item(index)
new_data = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(index).data(Qt.UserRole))
new_data.update(infos)
item.setText("GCC " + infos["version"] + " - " + infos["target"])
def _invalidItem(self, index):
+ """
+ Sets the item at index as an invalid item.
+ """
item = self.pageContent.toolchainList.item(index)
item.setIcon(QIcon(":/images/error.png"))
def addToolchain(self):
+ """
+ Slot called when the user adds manually a toolchain.
+ """
sel_toolchain = QFileDialog.getOpenFileName(self, self.tr("Choose the toolchain"), "")
if not sel_toolchain.isEmpty():
item = QListWidgetItem(sel_toolchain)
self.setToolchains(toolchains)
def removeToolchain(self):
+ """
+ Slot called when the user removes manually a toolchain.
+ """
if self.pageContent.toolchainList.currentRow() != -1:
item = self.pageContent.toolchainList.takeItem(self.pageContent.toolchainList.currentRow())
toolchain = qvariant_converter.getStringDict(item.data(Qt.UserRole))["path"]
self.setToolchains(toolchains)
def searchToolchain(self):
+ """
+ Slot called when the user clicks on the 'search' button. It opens the
+ toolchain search dialog.
+ """
search = BToolchainSearch.BToolchainSearch()
self.connect(search, SIGNAL("accepted()"), self._search)
search.exec_()
def validateAllToolchains(self):
+ """
+ Slot called when the user clicks on the validate button. It starts the
+ toolchain validation procedure for all the toolchains.
+ """
QApplication.instance().setOverrideCursor(Qt.WaitCursor)
for i in range(self.pageContent.toolchainList.count()):
self.validateToolchain(i)
QApplication.instance().restoreOverrideCursor()
def validateToolchain(self, i):
+ """
+ Toolchain validation procedure.
+ """
filename = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(i).data(Qt.UserRole))["path"]
valid = False
info = {}
self.setToolchains(toolchains)
def isComplete(self):
+ """
+ Overload of the QWizard isComplete method.
+ """
if self.pageContent.toolchainList.currentRow() != -1:
self._projectInfoStore("TOOLCHAIN",
qvariant_converter.getStringDict(self.pageContent.toolchainList.currentItem().data(Qt.UserRole)))
return False
def reloadData(self):
+ """
+ Overload of the BWizard reloadData method.
+ """
self._clearList()
- self._updateUi()
+ self._setupUi()
self._populateToolchainList()
\ No newline at end of file
from const import *
class BToolchainSearch(QDialog):
+ """
+ Dialog that permits to choice the settings for the toolchain search procedure.
+ """
def __init__(self):
QDialog.__init__(self)
self.setWindowTitle(self.tr("Toolchain search page"))
def _setupUi(self):
+ """
+ Sets up the user interface.
+ """
self.content = uic.loadUi(UI_LOCATION + "/toolchain_search.ui", None)
layout = QVBoxLayout()
layout.addWidget(self.content)
self._setSearchButton()
def _connectSignals(self):
+ """
+ Connects the signals with the related slots.
+ """
self.connect(self.content.pathBox, SIGNAL("stateChanged(int)"), self._stateChanged)
self.connect(self.content.addButton, SIGNAL("clicked()"), self._addDir)
self.connect(self.content.removeButton, SIGNAL("clicked()"), self._removeDir)
self.connect(self.content.searchButton, SIGNAL("clicked()"), self.accept)
def _setSearchButton(self):
+ """
+ Toggles the 'searchButton' evaluating the settings.
+ """
self.content.searchButton.setDefault(True)
self.content.searchButton.setEnabled(self.content.pathBox.isChecked() or self.content.customDirList.count() != 0)
def _populateDirList(self):
+ """
+ Fills the dir list with the directories stored in the QSettings.
+ """
search_dir_list = qvariant_converter.getStringList(QApplication.instance().settings.value("search_dir_list"))
for element in search_dir_list:
item = QListWidgetItem(element)
self.content.customDirList.addItem(item)
def _setPathSearch(self):
+ """
+ Sets the path search checkbox to the stored value.
+ """
pathSearch = qvariant_converter.getBool(QApplication.instance().settings.value(QString("path_search")))
self.content.pathBox.setChecked(pathSearch)
def _stateChanged(self, state):
+ """
+ Slot called when the path search checkbox state changes. Stores the value in the QSettings.
+ """
QApplication.instance().settings.setValue(QString("path_search"), QVariant(state != 0))
self._setSearchButton()
def _addDir(self):
+ """
+ Slot called when the user adds a dir.
+ """
directory = QFileDialog.getExistingDirectory(self, self.tr("Open Directory"), "", QFileDialog.ShowDirsOnly)
if not directory.isEmpty():
directory = unicode(directory)
self._setSearchButton()
def _removeDir(self):
+ """
+ Slot called when the user removes a dir.
+ """
if self.content.customDirList.currentRow() != -1:
item = self.content.customDirList.takeItem(self.content.customDirList.currentRow())
search_dir_list = qvariant_converter.getStringList(QApplication.instance().settings.value(QString("search_dir_list")))
from const import *
class BVersionPage(BWizardPage):
+ """
+ Page of the wizard that permits to choose which BeRTOS version the user wants
+ to use. This page show some pieces of information about the version.
+ """
def __init__(self):
BWizardPage.__init__(self, UI_LOCATION + "/bertos_versions.ui")
self.setTitle(self.tr("Select the BeRTOS version needed"))
def _connectSignals(self):
+ """
+ Connects the signals to the related slots.
+ """
self.connect(self.pageContent.versionList, SIGNAL("itemSelectionChanged()"), self.rowChanged)
self.connect(self.pageContent.addButton, SIGNAL("clicked()"), self.addVersion)
self.connect(self.pageContent.removeButton, SIGNAL("clicked()"), self.removeVersion)
self.connect(self.pageContent.updateButton, SIGNAL("clicked()"), self.updateClicked)
def _setupUi(self):
+ """
+ Sets up the user interface.
+ """
self.pageContent.versionList.setCurrentRow(-1)
def _storeVersion(self, directory):
+ """
+ Stores the directory selected by the user in the QSettings.
+ """
versions = self.versions()
versions = set(versions + [directory])
self.setVersions(list(versions))
def _deleteVersion(self, directory):
+ """
+ Removes the given directory from the QSettings.
+ """
versions = self.versions()
versions.remove(directory)
self.setVersions(versions)
def _insertListElement(self, directory):
+ """
+ Inserts the given directory in the version list.
+ """
if bertos_utils.isBertosDir(directory):
item = QListWidgetItem(QIcon(":/images/ok.png"), bertos_utils.bertosVersion(directory) + " (\"" + os.path.normpath(directory) + "\")")
item.setData(Qt.UserRole, qvariant_converter.convertString(directory))
self.pageContent.versionList.addItem(item)
def _fillVersionList(self):
+ """
+ Fills the version list with all the BeRTOS versions founded in the QSettings.
+ """
versions = self.versions()
for directory in versions:
self._insertListElement(directory)
def isComplete(self):
+ """
+ Overload of the QWizardPage isComplete method.
+ """
if self.pageContent.versionList.currentRow() != -1:
# Remove trailing slash
sources_path = qvariant_converter.getString(self.pageContent.versionList.currentItem().data(Qt.UserRole))
return False
def addVersion(self):
+ """
+ Slot called when the user add a BeRTOS version.
+ """
directory = QFileDialog.getExistingDirectory(self, self.tr("Choose a directory"), "", QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
if not directory.isEmpty():
self._storeVersion(unicode(directory))
self.emit(SIGNAL("completeChanged()"))
def removeVersion(self):
+ """
+ Slot called when the user remove a BeRTOS version.
+ """
item = self.pageContent.versionList.takeItem(self.pageContent.versionList.currentRow())
self._deleteVersion(qvariant_converter.getString(item.data(Qt.UserRole)))
self.emit(SIGNAL("completeChanged()"))
def updateClicked(self):
- print "fake update checking"
+ """
+ Checks for update (TO BE IMPLEMENTED).
+ """
+ pass
def rowChanged(self):
- self.emit(SIGNAL("completeChanged()"))
-
+ """
+ Slot called when the user select an entry from the version list.
+ """
+ self.emit(SIGNAL("completeChanged()"))
\ No newline at end of file
import BFinalPage
class BWizard(QWizard):
+ """
+ Main class of the wizard. It adds the pages automatically.
+ """
def __init__(self):
QWizard.__init__(self)
self._connectSignals()
def _addPages(self):
+ """
+ Method used by the constructor in order to add the pages in the wizard.
+ """
self.addPage(BFolderPage.BFolderPage())
self.addPage(BVersionPage.BVersionPage())
self.addPage(BCpuPage.BCpuPage())
self.addPage(BFinalPage.BFinalPage())
def _connectSignals(self):
+ """
+ Connects the signals with the related slots.
+ """
self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged)
def _pageChanged(self, pageId):
+ """
+ Slot called when the user change the current page. It calls the reloadData
+ method of the next page.
+ """
page = self.page(pageId)
if page is not None:
page.reloadData()
def project(self):
+ """
+ Returns the BProject associated with the wizard.
+ """
return copy.deepcopy(QApplication.instance().project)
import qvariant_converter
class BWizardPage(QWizardPage):
+ """
+ Base class for all the wizard pages. It has the utility method used in all
+ the pages. A wizard page class need to extend this class.
+ """
def __init__(self, wizardGui, parent = None):
QWizardPage.__init__(self, parent)
self.setLayout(layout)
def _exceptionOccurred(self, message):
+ """
+ Simple message box showing method.
+ """
QMessageBox.critical(self, self.tr("Error occurred"), message, QMessageBox.Ok, QMessageBox.NoButton)
def _settingsStore(self, key, value):
+ """
+ Stores the given value in the QSettings associated with the given key.
+ """
QApplication.instance().settings.setValue(QString(key), value)
def _settingsRetrieve(self, key):
+ """
+ Retrieves the value associated to key in the QSettings. Note that this
+ Value is a QVariant and neet to be converted in a standard type.
+ """
return QApplication.instance().settings.value(QString(key), QVariant())
def _projectInfoStore(self, key, value):
+ """
+ Stores the given value in the BProject class associating it with the given
+ key.
+ """
QApplication.instance().project.setInfo(key, value)
def _projectInfoRetrieve(self, key):
+ """
+ Retrieves the information associated with the given key.
+ """
return QApplication.instance().project.info(key)
def _project(self):
+ """
+ Returns the BProject instance.
+ """
return QApplication.instance().project
def versions(self):
+ """
+ Returns the version list from the QSettings.
+ """
return qvariant_converter.getStringList(self._settingsRetrieve("versions"))
def setVersions(self, versions):
+ """
+ Stores the given versions in the QSettings.
+ """
self._settingsStore("versions", qvariant_converter.convertStringList(versions))
def searchDirList(self):
+ """
+ Returns the search dir list from the QSettings.
+ """
return qvariant_converter.getStringList(self._settingsRetrieve("search_dir_list"))
def setSearchDirList(self, search_dir_list):
+ """
+ Stores the search dir list in the QSettings.
+ """
self._settingsStore("search_dir_list", qvariant_converter.convertStringList(search_dir_list))
def pathSearch(self):
+ """
+ Returns the value of path search from the QSettings.
+ """
return qvariant_converter.getBool(self._settingsRetrieve("path_search"))
def setPathSearch(self, path_search):
+ """
+ Stores the path search value in the QSettings.
+ """
self._settingsStore("path_search", qvariant_converter.convertBool(path_search))
def toolchains(self):
+ """
+ Returns the toolchains stored in the QSettings.
+ """
return qvariant_converter.getBoolDict(self._settingsRetrieve("toolchains"))
def setToolchains(self, toolchains):
+ """
+ Stores the toolchains in the QSettings.
+ """
self._settingsStore("toolchains", qvariant_converter.convertBoolDict(toolchains))
def reloadData(self):
+ """
+ Method called before the page is loaded. The pages that need to use this
+ method have to implement it.
+ """
pass
-
- def saveData(self):
- pass
\ No newline at end of file