26 @param parent reference to the parent widget (QWidget) |
26 @param parent reference to the parent widget (QWidget) |
27 @param inactiveText text to be shown on inactivity (string) |
27 @param inactiveText text to be shown on inactivity (string) |
28 @param side side the clear button should be shown at |
28 @param side side the clear button should be shown at |
29 (E5LineEdit.RightSide, E5LineEdit.LeftSide) |
29 (E5LineEdit.RightSide, E5LineEdit.LeftSide) |
30 """ |
30 """ |
31 super(IrcMessageEdit, self).__init__(parent, inactiveText, side) |
31 super().__init__(parent, inactiveText, side) |
32 |
32 |
33 self.__historyList = [""] # initialize with one empty line |
33 self.__historyList = [""] # initialize with one empty line |
34 self.__historyLine = 0 |
34 self.__historyLine = 0 |
35 |
35 |
36 def setText(self, text): |
36 def setText(self, text): |
40 Note: This reimplementation ensures, that the cursor is at the end of |
40 Note: This reimplementation ensures, that the cursor is at the end of |
41 the text. |
41 the text. |
42 |
42 |
43 @param text text to be set (string) |
43 @param text text to be set (string) |
44 """ |
44 """ |
45 super(IrcMessageEdit, self).setText(text) |
45 super().setText(text) |
46 self.setCursorPosition(len(text)) |
46 self.setCursorPosition(len(text)) |
47 |
47 |
48 def keyPressEvent(self, evt): |
48 def keyPressEvent(self, evt): |
49 """ |
49 """ |
50 Protected method implementing special key handling. |
50 Protected method implementing special key handling. |
63 self.__addHistory(self.text()) |
63 self.__addHistory(self.text()) |
64 elif evt.text() == chr(21): |
64 elif evt.text() == chr(21): |
65 # ^U: clear the text |
65 # ^U: clear the text |
66 self.setText("") |
66 self.setText("") |
67 |
67 |
68 super(IrcMessageEdit, self).keyPressEvent(evt) |
68 super().keyPressEvent(evt) |
69 |
69 |
70 def wheelEvent(self, evt): |
70 def wheelEvent(self, evt): |
71 """ |
71 """ |
72 Protected slot to support wheel events. |
72 Protected slot to support wheel events. |
73 |
73 |
77 if delta > 0: |
77 if delta > 0: |
78 self.__getHistory(True) |
78 self.__getHistory(True) |
79 elif delta < 0: |
79 elif delta < 0: |
80 self.__getHistory(False) |
80 self.__getHistory(False) |
81 |
81 |
82 super(IrcMessageEdit, self).wheelEvent(evt) |
82 super().wheelEvent(evt) |
83 |
83 |
84 def __addHistory(self, txt): |
84 def __addHistory(self, txt): |
85 """ |
85 """ |
86 Private method to add an entry to the history. |
86 Private method to add an entry to the history. |
87 |
87 |