ProjectDjangoTagsMenu/DjangoTagInputDialog.py

branch
eric7
changeset 63
85418cf03fdb
parent 60
85d3931419d3
child 67
807714618a59
--- a/ProjectDjangoTagsMenu/DjangoTagInputDialog.py	Thu Dec 30 12:03:18 2021 +0100
+++ b/ProjectDjangoTagsMenu/DjangoTagInputDialog.py	Wed Sep 21 16:38:40 2022 +0200
@@ -8,19 +8,18 @@
 """
 
 from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import (
-    QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QLineEdit
-)
+from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QLineEdit
 
 
 class DjangoTagInputDialog(QDialog):
     """
     Class implementing a dialog to enter data for the creation of a tag.
     """
+
     def __init__(self, labels, defaults=None, parent=None):
         """
         Constructor
-        
+
         @param labels list of labels for the entry fields
         @type list of str
         @param defaults list of default values for the entry fields
@@ -30,13 +29,12 @@
         @exception RuntimeError raised to signal too many labels were given
         """
         super().__init__(parent)
-        
+
         if len(labels) == 0 or len(labels) > 5:
-            raise RuntimeError(
-                "Illegal number of labels given (max. 5 allowed)")
-        
+            raise RuntimeError("Illegal number of labels given (max. 5 allowed)")
+
         self.__inputs = []
-        
+
         self.__topLayout = QVBoxLayout(self)
         for index, label in enumerate(labels):
             self.__topLayout.addWidget(QLabel(label, self))
@@ -47,37 +45,36 @@
             self.__inputs.append(entry)
             self.__topLayout.addWidget(entry)
         self.__buttonBox = QDialogButtonBox(
-            QDialogButtonBox.StandardButton.Ok |
-            QDialogButtonBox.StandardButton.Cancel,
+            QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel,
             Qt.Orientation.Horizontal,
-            self
+            self,
         )
         self.__topLayout.addWidget(self.__buttonBox)
-        
+
         self.resize(400, self.minimumSizeHint().height())
         self.setSizeGripEnabled(True)
-        
+
         self.__buttonBox.accepted.connect(self.accept)
         self.__buttonBox.rejected.connect(self.reject)
-        
+
         self.__inputs[0].selectAll()
         self.__inputs[0].setFocus()
-    
+
     def getData(self):
         """
         Public method to retrieve the entered data.
-        
+
         @return tuple containing the text of all entries
         @rtype tuple of str
         """
         data = [input.text().strip() for input in self.__inputs]
         return tuple(data)
-    
+
     @staticmethod
     def getText(parent, title, labels, defaults=None):
         """
         Public static method to create the dialog and return the entered data.
-        
+
         @param parent reference to the parent widget
         @type QWidget
         @param title title of the dialog
@@ -92,7 +89,7 @@
         """
         if defaults is None:
             defaults = []
-        
+
         dlg = DjangoTagInputDialog(labels, defaults, parent)
         dlg.setWindowTitle(title)
         if dlg.exec() == QDialog.DialogCode.Accepted:

eric ide

mercurial