src/eric7/Preferences/ShortcutDialog.py

branch
eric7
changeset 10428
a071d4065202
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10427:3733e2b23cf7 10428:a071d4065202
26 26
27 def __init__(self, parent=None, name=None, modal=False): 27 def __init__(self, parent=None, name=None, modal=False):
28 """ 28 """
29 Constructor 29 Constructor
30 30
31 @param parent The parent widget of this dialog. (QWidget) 31 @param parent The parent widget of this dialog.
32 @param name The name of this dialog. (string) 32 @type QWidget
33 @param modal Flag indicating a modal dialog. (boolean) 33 @param name The name of this dialog.
34 @type str
35 @param modal Flag indicating a modal dialog.
36 @type bool
34 """ 37 """
35 super().__init__(parent) 38 super().__init__(parent)
36 if name: 39 if name:
37 self.setObjectName(name) 40 self.setObjectName(name)
38 self.setModal(modal) 41 self.setModal(modal)
81 84
82 def setKeys(self, key, alternateKey, noCheck, objectType): 85 def setKeys(self, key, alternateKey, noCheck, objectType):
83 """ 86 """
84 Public method to set the key to be configured. 87 Public method to set the key to be configured.
85 88
86 @param key key sequence to be changed (QKeySequence) 89 @param key key sequence to be changed
87 @param alternateKey alternate key sequence to be changed (QKeySequence) 90 @type QKeySequence
91 @param alternateKey alternate key sequence to be changed
92 @type QKeySequence
88 @param noCheck flag indicating that no uniqueness check should 93 @param noCheck flag indicating that no uniqueness check should
89 be performed (boolean) 94 be performed
90 @param objectType type of the object (string). 95 @type bool
96 @param objectType type of the object
97 @type str
91 """ 98 """
92 self.__clearKeys() 99 self.__clearKeys()
93 100
94 self.keyEdit.setText(key.toString()) 101 self.keyEdit.setText(key.toString())
95 self.alternateKeyEdit.setText(alternateKey.toString()) 102 self.alternateKeyEdit.setText(alternateKey.toString())
124 131
125 def __setKeyEditText(self, txt): 132 def __setKeyEditText(self, txt):
126 """ 133 """
127 Private method to set the text of a key edit. 134 Private method to set the text of a key edit.
128 135
129 @param txt text to be set (string) 136 @param txt text to be set
137 @type str
130 """ 138 """
131 if self.primaryButton.isChecked(): 139 if self.primaryButton.isChecked():
132 self.keyEdit.setText(txt) 140 self.keyEdit.setText(txt)
133 else: 141 else:
134 self.alternateKeyEdit.setText(txt) 142 self.alternateKeyEdit.setText(txt)
136 def eventFilter(self, watched, event): 144 def eventFilter(self, watched, event):
137 """ 145 """
138 Public method called to filter the event queue. 146 Public method called to filter the event queue.
139 147
140 @param watched the QObject being watched 148 @param watched the QObject being watched
149 @type QObject
141 @param event the event that occurred 150 @param event the event that occurred
151 @type QEvent
142 @return always False 152 @return always False
153 @rtype bool
143 """ 154 """
144 if event.type() == QEvent.Type.KeyPress: 155 if event.type() == QEvent.Type.KeyPress:
145 self.keyPressEvent(event) 156 self.keyPressEvent(event)
146 return True 157 return True
147 158
149 160
150 def keyPressEvent(self, evt): 161 def keyPressEvent(self, evt):
151 """ 162 """
152 Protected method to handle a key press event. 163 Protected method to handle a key press event.
153 164
154 @param evt the key event (QKeyEvent) 165 @param evt the key event
166 @type QKeyEvent
155 """ 167 """
156 if evt.key() in [ 168 if evt.key() in [
157 Qt.Key.Key_Control, 169 Qt.Key.Key_Control,
158 Qt.Key.Key_Meta, 170 Qt.Key.Key_Meta,
159 Qt.Key.Key_Shift, 171 Qt.Key.Key_Shift,

eric ide

mercurial