Group methods in classes in topics
[bertos.git] / wizard / BFolderPage.py
index a6fdc7a15284b561d7dae3eaf6b57b878be10238..2628aa668d74fbb7f7f6727ec4d0bec08d972b61 100644 (file)
@@ -26,47 +26,75 @@ 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.
         """
@@ -85,22 +113,4 @@ class BFolderPage(BWizardPage):
             self.pageContent.projectPath.setText("None")
             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
+        self.emit(SIGNAL("completeChanged()"))
\ No newline at end of file