Preferences/ShortcutDialog.py

changeset 1380
27c9c4ae64fd
parent 1131
7781e396c903
child 1509
c0b5e693b0eb
diff -r f18a99689f2a -r 27c9c4ae64fd Preferences/ShortcutDialog.py
--- a/Preferences/ShortcutDialog.py	Sat Oct 22 13:20:50 2011 +0200
+++ b/Preferences/ShortcutDialog.py	Sat Oct 22 19:46:02 2011 +0200
@@ -51,6 +51,8 @@
         self.alternateButton.installEventFilter(self)
         self.primaryClearButton.installEventFilter(self)
         self.alternateClearButton.installEventFilter(self)
+        self.keyEdit.installEventFilter(self)
+        self.alternateKeyEdit.installEventFilter(self)
         
         self.buttonBox.button(QDialogButtonBox.Ok).installEventFilter(self)
         self.buttonBox.button(QDialogButtonBox.Cancel).installEventFilter(self)
@@ -67,8 +69,8 @@
         """
         self.keyIndex = 0
         self.keys = [0, 0, 0, 0]
-        self.keyLabel.setText(key.toString())
-        self.alternateKeyLabel.setText(alternateKey.toString())
+        self.keyEdit.setText(key.toString())
+        self.alternateKeyEdit.setText(alternateKey.toString())
         self.primaryButton.setChecked(True)
         self.noCheck = noCheck
         self.objectType = objectType
@@ -79,8 +81,8 @@
         """
         self.hide()
         self.shortcutChanged.emit(
-                  QKeySequence(self.keyLabel.text()),
-                  QKeySequence(self.alternateKeyLabel.text()),
+                  QKeySequence(self.keyEdit.text()),
+                  QKeySequence(self.alternateKeyEdit.text()),
                   self.noCheck, self.objectType)
 
     def __clear(self):
@@ -89,7 +91,7 @@
         """
         self.keyIndex = 0
         self.keys = [0, 0, 0, 0]
-        self.__setKeyLabelText("")
+        self.__setKeyEditText("")
         
     def __typeChanged(self):
         """
@@ -98,16 +100,16 @@
         self.keyIndex = 0
         self.keys = [0, 0, 0, 0]
         
-    def __setKeyLabelText(self, txt):
+    def __setKeyEditText(self, txt):
         """
-        Private method to set the text of a key label.
+        Private method to set the text of a key edit.
         
         @param txt text to be set (string)
         """
         if self.primaryButton.isChecked():
-            self.keyLabel.setText(txt)
+            self.keyEdit.setText(txt)
         else:
-            self.alternateKeyLabel.setText(txt)
+            self.alternateKeyEdit.setText(txt)
         
     def eventFilter(self, watched, event):
         """
@@ -161,12 +163,12 @@
         self.keyIndex += 1
         
         if self.keyIndex == 1:
-            self.__setKeyLabelText(QKeySequence(self.keys[0]).toString())
+            self.__setKeyEditText(QKeySequence(self.keys[0]).toString())
         elif self.keyIndex == 2:
-            self.__setKeyLabelText(QKeySequence(self.keys[0], self.keys[1]).toString())
+            self.__setKeyEditText(QKeySequence(self.keys[0], self.keys[1]).toString())
         elif self.keyIndex == 3:
-            self.__setKeyLabelText(QKeySequence(self.keys[0], self.keys[1],
+            self.__setKeyEditText(QKeySequence(self.keys[0], self.keys[1],
                 self.keys[2]).toString())
         elif self.keyIndex == 4:
-            self.__setKeyLabelText(QKeySequence(self.keys[0], self.keys[1],
+            self.__setKeyEditText(QKeySequence(self.keys[0], self.keys[1],
                 self.keys[2], self.keys[3]).toString())

eric ide

mercurial