src/eric7/MultiProject/AddProjectDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
--- a/src/eric7/MultiProject/AddProjectDialog.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/MultiProject/AddProjectDialog.py	Wed Jul 13 14:55:47 2022 +0200
@@ -24,11 +24,13 @@
     """
     Class implementing the add project dialog.
     """
-    def __init__(self, parent=None, startdir="", project=None,
-                 categories=None, category=""):
+
+    def __init__(
+        self, parent=None, startdir="", project=None, categories=None, category=""
+    ):
         """
         Constructor
-        
+
         @param parent parent widget of this dialog
         @type QWidget
         @param startdir start directory for the selection dialog
@@ -42,42 +44,43 @@
         """
         super().__init__(parent)
         self.setupUi(self)
-        
+
         self.filenamePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
         self.filenamePicker.setFilters(
-            self.tr("Project Files (*.epj);;XML Project Files (*.e4p)"))
+            self.tr("Project Files (*.epj);;XML Project Files (*.e4p)")
+        )
         self.filenamePicker.setDefaultDirectory(
-            Preferences.getMultiProject("Workspace"))
-        
+            Preferences.getMultiProject("Workspace")
+        )
+
         if categories:
             self.categoryComboBox.addItem("")
             self.categoryComboBox.addItems(sorted(categories))
         self.categoryComboBox.setEditText(category)
-        
+
         self.startdir = startdir
         self.uid = ""
-        
-        self.__okButton = self.buttonBox.button(
-            QDialogButtonBox.StandardButton.Ok)
+
+        self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
         self.__okButton.setEnabled(False)
-        
+
         if project is not None:
             self.setWindowTitle(self.tr("Project Properties"))
-            
-            self.nameEdit.setText(project['name'])
-            self.filenamePicker.setText(project['file'])
-            self.descriptionEdit.setPlainText(project['description'])
-            self.masterCheckBox.setChecked(project['master'])
-            index = self.categoryComboBox.findText(project['category'])
+
+            self.nameEdit.setText(project["name"])
+            self.filenamePicker.setText(project["file"])
+            self.descriptionEdit.setPlainText(project["description"])
+            self.masterCheckBox.setChecked(project["master"])
+            index = self.categoryComboBox.findText(project["category"])
             if index == -1:
                 index = 0
             self.categoryComboBox.setCurrentIndex(index)
             self.uid = project["uid"]
-    
+
     def getData(self):
         """
         Public slot to retrieve the dialogs data.
-        
+
         @return tuple of five values (string, string, boolean, string, string)
             giving the project name, the name of the project file, a flag
             telling whether the project shall be the main project, a short
@@ -86,40 +89,45 @@
         if not self.uid:
             # new project entry
             from PyQt6.QtCore import QUuid
+
             self.uid = QUuid.createUuid().toString()
-        
+
         filename = self.filenamePicker.text()
         if not os.path.isabs(filename):
             filename = Utilities.toNativeSeparators(
-                os.path.join(self.startdir, filename))
-        return (self.nameEdit.text(),
-                filename,
-                self.masterCheckBox.isChecked(),
-                self.descriptionEdit.toPlainText(),
-                self.categoryComboBox.currentText(),
-                self.uid)
-    
+                os.path.join(self.startdir, filename)
+            )
+        return (
+            self.nameEdit.text(),
+            filename,
+            self.masterCheckBox.isChecked(),
+            self.descriptionEdit.toPlainText(),
+            self.categoryComboBox.currentText(),
+            self.uid,
+        )
+
     @pyqtSlot(str)
     def on_nameEdit_textChanged(self, txt):
         """
         Private slot called when the project name has changed.
-        
+
         @param txt text of the edit (string)
         """
         self.__updateUi()
-    
+
     @pyqtSlot(str)
     def on_filenamePicker_textChanged(self, txt):
         """
         Private slot called when the project filename has changed.
-        
+
         @param txt text of the edit (string)
         """
         self.__updateUi()
-    
+
     def __updateUi(self):
         """
         Private method to update the dialog.
         """
-        self.__okButton.setEnabled(self.nameEdit.text() != "" and
-                                   self.filenamePicker.text() != "")
+        self.__okButton.setEnabled(
+            self.nameEdit.text() != "" and self.filenamePicker.text() != ""
+        )

eric ide

mercurial