X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBFolderPage.py;h=f6fcc59dc9b92a96017ce2a8702e3bea44e74d50;hb=ee8a668a156614bdc803c93874eda0d6580ccc2a;hp=a6fdc7a15284b561d7dae3eaf6b57b878be10238;hpb=ca1a17d62748010cd95a0012f67a9e80c6565d73;p=bertos.git diff --git a/wizard/BFolderPage.py b/wizard/BFolderPage.py index a6fdc7a1..f6fcc59d 100644 --- a/wizard/BFolderPage.py +++ b/wizard/BFolderPage.py @@ -26,53 +26,81 @@ class BFolderPage(BWizardPage): def __init__(self): BWizardPage.__init__(self, UI_LOCATION + "/dir_select.ui") self.setTitle(self.tr("Select the project name")) - self._initializeAttributes() - self._setupUi() - self._connectSignals() + self.initializeAttributes() + + ## Overloaded QWizardPage methods ## - def _setupUi(self): + def isComplete(self): """ - Sets up the user interface. + Overload of the QWizardPage isComplete method. """ - self.pageContent.warningLabel.setVisible(False) + if self.pageContent.projectPath.text() != "None": + self.setProjectInfo("PROJECT_PATH", unicode(self.pageContent.projectPath.text())) + return True + else: + return False - def _initializeAttributes(self): + #### + + ## Overloaded BWizardPage methods ## + + def setupUi(self): """ - Initializes the page attributes to the default values. + Overload of the BWizardPage setupUi method. """ - self._project_name = "" - self._destination_folder = os.path.expanduser("~") - self.pageContent.directoryEdit.setText(self._destination_folder) + self.pageContent.warningLabel.setVisible(False) - def _connectSignals(self): + def connectSignals(self): """ - Connects the signals to the related slots. + Overload of the BWizardPage connectSignals method. """ - 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) + 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) + + #### + + ## Slots ## - def _nameChanged(self, name): + def nameChanged(self, name): """ Slot called when the project name is changed manually by the user. """ self._project_name = str(name).replace(" ", "_") - self._setProjectPath() + self.setProjectPath() - def _directoryChanged(self, directory): + 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() + self.setProjectPath() + + 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 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 _setProjectPath(self): + 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._destination_folder += os.sep self.pageContent.projectPath.setText(QDir.toNativeSeparators(self._destination_folder + self._project_name)) if os.path.exists(self._destination_folder + self._project_name): self.pageContent.warningLabel.setVisible(True) @@ -86,21 +114,3 @@ class BFolderPage(BWizardPage): self.pageContent.warningLabel.setVisible(False) self.pageContent.warningLabel.setText("") 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 - else: - return False \ No newline at end of file