src/eric7/Plugins/VcsPlugins/vcsGit/GitPatchFilesDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitPatchFilesDialog.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitPatchFilesDialog.py	Wed Jul 13 14:55:47 2022 +0200
@@ -22,10 +22,11 @@
     """
     Class implementing a dialog to select a list of patch files.
     """
+
     def __init__(self, rootDir, patchCheckData, parent=None):
         """
         Constructor
-        
+
         @param rootDir root of the directory tree (string)
         @param patchCheckData tuple of data as returned by the
             getData() method
@@ -33,27 +34,26 @@
         """
         super().__init__(parent)
         self.setupUi(self)
-        
+
         self.__rootDir = rootDir
         if patchCheckData is not None:
             self.patchFilesList.addItems(patchCheckData[0])
             self.stripSpinBox.setValue(patchCheckData[1])
             self.eofCheckBox.setChecked(patchCheckData[2])
             self.lineCountsCheckBox.setChecked(patchCheckData[3])
-        
+
         self.addButton.setIcon(UI.PixmapCache.getIcon("plus"))
         self.deleteButton.setIcon(UI.PixmapCache.getIcon("minus"))
         self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow"))
         self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow"))
-        
-        self.__okButton = self.buttonBox.button(
-            QDialogButtonBox.StandardButton.Ok)
+
+        self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
         self.__okButton.setEnabled(len(self.__getPatchFilesList()) > 0)
-    
+
         self.deleteButton.setEnabled(False)
         self.upButton.setEnabled(False)
         self.downButton.setEnabled(False)
-    
+
     @pyqtSlot()
     def on_patchFilesList_itemSelectionChanged(self):
         """
@@ -61,19 +61,16 @@
         """
         selectedItems = self.patchFilesList.selectedItems()
         count = len(selectedItems)
-        isFirst = (
-            count == 1 and
-            self.patchFilesList.row(selectedItems[0]) == 0
-        )
+        isFirst = count == 1 and self.patchFilesList.row(selectedItems[0]) == 0
         isLast = (
-            count == 1 and
-            self.patchFilesList.row(selectedItems[0]) ==
-            self.patchFilesList.count() - 1
+            count == 1
+            and self.patchFilesList.row(selectedItems[0])
+            == self.patchFilesList.count() - 1
         )
         self.deleteButton.setEnabled(count > 0)
         self.upButton.setEnabled(count == 1 and not isFirst)
         self.downButton.setEnabled(count == 1 and not isLast)
-    
+
     @pyqtSlot()
     def on_addButton_clicked(self):
         """
@@ -83,17 +80,18 @@
             self,
             self.tr("Patch Files"),
             self.__rootDir,
-            self.tr("Patch Files (*.diff *.patch);;All Files (*)"))
+            self.tr("Patch Files (*.diff *.patch);;All Files (*)"),
+        )
         if patchFiles:
             currentPatchFiles = self.__getPatchFilesList()
             for patchFile in patchFiles:
                 patchFile = Utilities.toNativeSeparators(patchFile)
                 if patchFile not in currentPatchFiles:
                     self.patchFilesList.addItem(patchFile)
-        
+
         self.__okButton.setEnabled(len(self.__getPatchFilesList()) > 0)
         self.on_patchFilesList_itemSelectionChanged()
-    
+
     @pyqtSlot()
     def on_deleteButton_clicked(self):
         """
@@ -103,10 +101,10 @@
             row = self.patchFilesList.row(itm)
             self.patchFilesList.takeItem(row)
             del itm
-        
+
         self.__okButton.setEnabled(len(self.__getPatchFilesList()) > 0)
         self.on_patchFilesList_itemSelectionChanged()
-    
+
     @pyqtSlot()
     def on_upButton_clicked(self):
         """
@@ -116,7 +114,7 @@
         itm = self.patchFilesList.takeItem(row)
         self.patchFilesList.insertItem(row - 1, itm)
         itm.setSelected(True)
-    
+
     @pyqtSlot()
     def on_downButton_clicked(self):
         """
@@ -126,29 +124,32 @@
         itm = self.patchFilesList.takeItem(row)
         self.patchFilesList.insertItem(row + 1, itm)
         itm.setSelected(True)
-    
+
     def __getPatchFilesList(self):
         """
         Private method to get the list of patch files.
-        
+
         @return list of patch files (list of string)
         """
         patchFiles = []
         for row in range(self.patchFilesList.count()):
             itm = self.patchFilesList.item(row)
             patchFiles.append(itm.text())
-        
+
         return patchFiles
-    
+
     def getData(self):
         """
         Public slot to get the entered data.
-        
+
         @return tuple of list of patch files, strip count, flag indicating
             that the patch has inaccurate end-of-file marker and a flag
             indicating to not trust the line count information
             (list of string, integer, boolean, boolean)
         """
-        return (self.__getPatchFilesList(), self.stripSpinBox.value(),
-                self.eofCheckBox.isChecked(),
-                self.lineCountsCheckBox.isChecked())
+        return (
+            self.__getPatchFilesList(),
+            self.stripSpinBox.value(),
+            self.eofCheckBox.isChecked(),
+            self.lineCountsCheckBox.isChecked(),
+        )

eric ide

mercurial