src/eric7/QScintilla/ShellHistoryDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
--- a/src/eric7/QScintilla/ShellHistoryDialog.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/QScintilla/ShellHistoryDialog.py	Wed Jul 13 14:55:47 2022 +0200
@@ -19,10 +19,11 @@
     """
     Class implementing the shell history dialog.
     """
+
     def __init__(self, history, vm, shell):
         """
         Constructor
-        
+
         @param history reference to the current shell history
         @type list of str
         @param vm reference to the viewmanager object
@@ -32,42 +33,42 @@
         """
         super().__init__(shell)
         self.setupUi(self)
-        
+
         self.__vm = vm
         self.__shell = shell
-        
+
         self.historyList.addItems(history)
         index = shell.getHistoryIndex()
         if index < 0 or index >= len(history):
             self.historyList.setCurrentRow(
-                self.historyList.count() - 1,
-                QItemSelectionModel.SelectionFlag.Select)
+                self.historyList.count() - 1, QItemSelectionModel.SelectionFlag.Select
+            )
         else:
             self.historyList.setCurrentRow(
-                index, QItemSelectionModel.SelectionFlag.Select)
+                index, QItemSelectionModel.SelectionFlag.Select
+            )
         self.historyList.scrollToItem(self.historyList.currentItem())
-    
+
     @pyqtSlot()
     def on_historyList_itemSelectionChanged(self):
         """
         Private slot to handle a change of the selection.
         """
         selected = len(self.historyList.selectedItems()) > 0
-        self.copyButton.setEnabled(selected and
-                                   self.__vm.activeWindow() is not None)
+        self.copyButton.setEnabled(selected and self.__vm.activeWindow() is not None)
         self.deleteButton.setEnabled(selected)
         self.executeButton.setEnabled(selected)
-    
+
     @pyqtSlot(QListWidgetItem)
     def on_historyList_itemDoubleClicked(self, item):
         """
         Private slot to handle a double click of an item.
-        
+
         @param item reference to the item that was double clicked
             (QListWidgetItem)
         """
         self.on_executeButton_clicked()
-    
+
     @pyqtSlot()
     def on_deleteButton_clicked(self):
         """
@@ -78,7 +79,7 @@
             del ditm
         self.historyList.scrollToItem(self.historyList.currentItem())
         self.historyList.setFocus()
-    
+
     @pyqtSlot()
     def on_copyButton_clicked(self):
         """
@@ -96,7 +97,7 @@
             txt = eol.join(lines) + eol
             aw.insert(txt)
         self.historyList.setFocus()
-    
+
     @pyqtSlot()
     def on_executeButton_clicked(self):
         """
@@ -109,13 +110,11 @@
             if itm.isSelected():
                 lines.append(itm.text())
         cmds = os.linesep.join(lines) + os.linesep
-        self.__shell.executeLines(
-            cmds,
-            historyIndex=self.historyList.currentRow())
-        
+        self.__shell.executeLines(cmds, historyIndex=self.historyList.currentRow())
+
         # reload the list because shell modified it
         self.on_reloadButton_clicked()
-    
+
     @pyqtSlot()
     def on_reloadButton_clicked(self):
         """
@@ -123,24 +122,25 @@
         """
         history = self.__shell.getHistory(None)
         index = self.__shell.getHistoryIndex()
-        
+
         self.historyList.clear()
         self.historyList.addItems(history)
         if index < 0 or index >= len(history):
             self.historyList.setCurrentRow(
-                self.historyList.count() - 1,
-                QItemSelectionModel.SelectionFlag.Select)
+                self.historyList.count() - 1, QItemSelectionModel.SelectionFlag.Select
+            )
         else:
             self.historyList.setCurrentRow(
-                index, QItemSelectionModel.SelectionFlag.Select)
+                index, QItemSelectionModel.SelectionFlag.Select
+            )
         self.historyList.scrollToItem(self.historyList.currentItem())
-        
+
         self.historyList.setFocus(Qt.FocusReason.OtherFocusReason)
-        
+
     def getHistory(self):
         """
         Public method to retrieve the history from the dialog.
-        
+
         @return tuple containing the list of history entries and the
             current row
         @rtype tuple of (list of str, int)

eric ide

mercurial