src/eric7/Network/IRC/IrcMessageEdit.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Network/IRC/IrcMessageEdit.py
--- a/src/eric7/Network/IRC/IrcMessageEdit.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Network/IRC/IrcMessageEdit.py	Wed Jul 13 14:55:47 2022 +0200
@@ -15,36 +15,37 @@
     """
     Class implementing a specialized line edit for entering IRC messages.
     """
+
     MaxHistory = 100
-    
+
     def __init__(self, parent=None):
         """
         Constructor
-        
+
         @param parent reference to the parent widget
         @type QWidget
         """
         super().__init__(parent)
-        
-        self.__historyList = [""]   # initialize with one empty line
+
+        self.__historyList = [""]  # initialize with one empty line
         self.__historyLine = 0
-    
+
     def setText(self, text):
         """
         Public method to set the text.
-        
+
         Note: This reimplementation ensures, that the cursor is at the end of
         the text.
-        
+
         @param text text to be set (string)
         """
         super().setText(text)
         self.setCursorPosition(len(text))
-    
+
     def keyPressEvent(self, evt):
         """
         Protected method implementing special key handling.
-        
+
         @param evt reference to the event (QKeyEvent)
         """
         key = evt.key()
@@ -60,13 +61,13 @@
         elif evt.text() == chr(21):
             # ^U: clear the text
             self.setText("")
-        
+
         super().keyPressEvent(evt)
-    
+
     def wheelEvent(self, evt):
         """
         Protected slot to support wheel events.
-        
+
         @param evt reference to the wheel event (QWheelEvent)
         """
         delta = evt.angleDelta().y()
@@ -74,38 +75,37 @@
             self.__getHistory(True)
         elif delta < 0:
             self.__getHistory(False)
-        
+
         super().wheelEvent(evt)
-    
+
     def __addHistory(self, txt):
         """
         Private method to add an entry to the history.
-        
+
         @param txt text to be added to the history (string)
         """
         # Only add the entry, if it is not the same as last time
-        if (
-            len(self.__historyList) == 1 or
-            (len(self.__historyList) > 1 and self.__historyList[1] != txt)
+        if len(self.__historyList) == 1 or (
+            len(self.__historyList) > 1 and self.__historyList[1] != txt
         ):
             # Replace empty first entry and add new empty first entry
             self.__historyList[0] = txt
             self.__historyList.insert(0, "")
             # Keep history below the defined limit
-            del self.__historyList[IrcMessageEdit.MaxHistory:]
-        
+            del self.__historyList[IrcMessageEdit.MaxHistory :]
+
         self.__historyLine = 0
-    
+
     def __getHistory(self, up):
         """
         Private method to move in the history.
-        
+
         @param up flag indicating the direction (boolean)
         """
         # preserve the current text, if it is not empty
         if self.text():
             self.__historyList[self.__historyLine] = self.text()
-        
+
         if up:
             self.__historyLine += 1
             # If the position was moved past the end of the history,
@@ -124,6 +124,6 @@
                 # If the position is not at the top of the history,
                 # decrement it
                 self.__historyLine -= 1
-        
+
         # replace the text of the line edit with the selected history entry
         self.setText(self.__historyList[self.__historyLine])

eric ide

mercurial