Network/IRC/IrcMessageEdit.py

branch
Py2 comp.
changeset 2525
8b507a9a2d40
parent 2302
f29e9405c851
child 3057
10516539f238
equal deleted inserted replaced
2523:139f182b72f6 2525:8b507a9a2d40
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a specialized line edit for entering IRC messages. 7 Module implementing a specialized line edit for entering IRC messages.
8 """ 8 """
9
10 from __future__ import unicode_literals # __IGNORE_WARNING__
9 11
10 from PyQt4.QtCore import Qt 12 from PyQt4.QtCore import Qt
11 13
12 from E5Gui.E5LineEdit import E5LineEdit, E5ClearableLineEdit 14 from E5Gui.E5LineEdit import E5LineEdit, E5ClearableLineEdit
13 15
25 @param parent reference to the parent widget (QWidget) 27 @param parent reference to the parent widget (QWidget)
26 @keyparam inactiveText text to be shown on inactivity (string) 28 @keyparam inactiveText text to be shown on inactivity (string)
27 @keyparam side side the clear button should be shown at (E5LineEdit.RightSide, 29 @keyparam side side the clear button should be shown at (E5LineEdit.RightSide,
28 E5LineEdit.LeftSide) 30 E5LineEdit.LeftSide)
29 """ 31 """
30 super().__init__(parent, inactiveText, side) 32 super(IrcMessageEdit, self).__init__(parent, inactiveText, side)
31 33
32 self.__historyList = [""] # initialize with one empty line 34 self.__historyList = [""] # initialize with one empty line
33 self.__historyLine = 0 35 self.__historyLine = 0
34 36
35 def setText(self, text): 37 def setText(self, text):
38 40
39 Note: This reimplementation ensures, that the cursor is at the end of the text. 41 Note: This reimplementation ensures, that the cursor is at the end of the text.
40 42
41 @param text text to be set (string) 43 @param text text to be set (string)
42 """ 44 """
43 super().setText(text) 45 super(IrcMessageEdit, self).setText(text)
44 self.setCursorPosition(len(text)) 46 self.setCursorPosition(len(text))
45 47
46 def keyPressEvent(self, evt): 48 def keyPressEvent(self, evt):
47 """ 49 """
48 Protected method implementing special key handling. 50 Protected method implementing special key handling.
61 self.__addHistory(self.text()) 63 self.__addHistory(self.text())
62 elif evt.text() == chr(21): 64 elif evt.text() == chr(21):
63 # ^U: clear the text 65 # ^U: clear the text
64 self.setText("") 66 self.setText("")
65 67
66 super().keyPressEvent(evt) 68 super(IrcMessageEdit, self).keyPressEvent(evt)
67 69
68 def wheelEvent(self, evt): 70 def wheelEvent(self, evt):
69 """ 71 """
70 Protected slot to support wheel events. 72 Protected slot to support wheel events.
71 73
74 if evt.delta() > 0: 76 if evt.delta() > 0:
75 self.__getHistory(True) 77 self.__getHistory(True)
76 elif evt.delta() < 0: 78 elif evt.delta() < 0:
77 self.__getHistory(False) 79 self.__getHistory(False)
78 80
79 super().wheelEvent(evt) 81 super(IrcMessageEdit, self).wheelEvent(evt)
80 82
81 def __addHistory(self, txt): 83 def __addHistory(self, txt):
82 """ 84 """
83 Private method to add an entry to the history. 85 Private method to add an entry to the history.
84 86

eric ide

mercurial