Sat, 22 Oct 2011 19:46:14 +0200
Mac related fixes to the shortcut dialog
Preferences/ShortcutDialog.py | file | annotate | diff | comparison | revisions | |
Preferences/ShortcutDialog.ui | file | annotate | diff | comparison | revisions |
--- a/Preferences/ShortcutDialog.py Sat Oct 22 13:23:34 2011 +0200 +++ b/Preferences/ShortcutDialog.py Sat Oct 22 19:46:14 2011 +0200 @@ -50,6 +50,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) @@ -66,8 +68,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 @@ -78,8 +80,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): @@ -88,7 +90,7 @@ """ self.keyIndex = 0 self.keys = [0, 0, 0, 0] - self.__setKeyLabelText("") + self.__setKeyEditText("") def __typeChanged(self): """ @@ -97,16 +99,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. @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): """ @@ -160,12 +162,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())
--- a/Preferences/ShortcutDialog.ui Sat Oct 22 13:23:34 2011 +0200 +++ b/Preferences/ShortcutDialog.ui Sat Oct 22 19:46:14 2011 +0200 @@ -1,146 +1,122 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>ShortcutDialog</class> - <widget class="QDialog" name="ShortcutDialog" > - <property name="geometry" > + <widget class="QDialog" name="ShortcutDialog"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>539</width> - <height>125</height> + <height>134</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Edit Shortcut</string> </property> - <property name="whatsThis" > + <property name="whatsThis"> <string>Press your shortcut keys and select OK</string> </property> - <layout class="QVBoxLayout" > + <layout class="QVBoxLayout"> <item> - <widget class="QGroupBox" name="shortcutsGroup" > - <property name="title" > + <widget class="QGroupBox" name="shortcutsGroup"> + <property name="title"> <string/> </property> - <layout class="QGridLayout" > - <item row="1" column="0" > - <widget class="QRadioButton" name="alternateButton" > - <property name="focusPolicy" > + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QRadioButton" name="primaryButton"> + <property name="focusPolicy"> <enum>Qt::NoFocus</enum> </property> - <property name="toolTip" > - <string>Select to change the alternative keyboard shortcut</string> + <property name="toolTip"> + <string>Select to change the primary keyboard shortcut</string> </property> - <property name="text" > - <string>Alternative Shortcut:</string> + <property name="text"> + <string>Primary Shortcut:</string> + </property> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QPushButton" name="primaryClearButton" > - <property name="focusPolicy" > + <item row="0" column="1"> + <widget class="QPushButton" name="primaryClearButton"> + <property name="focusPolicy"> <enum>Qt::NoFocus</enum> </property> - <property name="toolTip" > + <property name="toolTip"> <string>Press to clear the key sequence buffer.</string> </property> - <property name="text" > + <property name="text"> <string>Clear</string> </property> </widget> </item> - <item row="1" column="2" > - <widget class="QLabel" name="alternateKeyLabel" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip" > - <string/> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - <property name="text" > - <string/> - </property> - </widget> - </item> - <item row="0" column="2" > - <widget class="QLabel" name="keyLabel" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip" > - <string/> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Sunken</enum> - </property> - <property name="text" > - <string/> - </property> - </widget> - </item> - <item row="0" column="0" > - <widget class="QRadioButton" name="primaryButton" > - <property name="focusPolicy" > - <enum>Qt::NoFocus</enum> - </property> - <property name="toolTip" > - <string>Select to change the primary keyboard shortcut</string> - </property> - <property name="text" > - <string>Primary Shortcut:</string> - </property> - <property name="checked" > + <item row="0" column="2"> + <widget class="QLineEdit" name="keyEdit"> + <property name="readOnly"> <bool>true</bool> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QPushButton" name="alternateClearButton" > - <property name="enabled" > + <item row="1" column="0"> + <widget class="QRadioButton" name="alternateButton"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="toolTip"> + <string>Select to change the alternative keyboard shortcut</string> + </property> + <property name="text"> + <string>Alternative Shortcut:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="alternateClearButton"> + <property name="enabled"> <bool>false</bool> </property> - <property name="focusPolicy" > + <property name="focusPolicy"> <enum>Qt::NoFocus</enum> </property> - <property name="toolTip" > + <property name="toolTip"> <string>Press to clear the key sequence buffer.</string> </property> - <property name="text" > + <property name="text"> <string>Clear</string> </property> </widget> </item> + <item row="1" column="2"> + <widget class="QLineEdit" name="alternateKeyEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> </layout> </widget> </item> <item> - <widget class="QDialogButtonBox" name="buttonBox" > - <property name="orientation" > + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="standardButtons" > + <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> </item> </layout> </widget> - <layoutdefault spacing="6" margin="6" /> + <layoutdefault spacing="6" margin="6"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> + <tabstops> + <tabstop>keyEdit</tabstop> + <tabstop>alternateKeyEdit</tabstop> + <tabstop>buttonBox</tabstop> + </tabstops> <resources/> <connections> <connection> @@ -149,11 +125,11 @@ <receiver>primaryClearButton</receiver> <slot>setEnabled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>80</x> <y>23</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>178</x> <y>24</y> </hint> @@ -165,11 +141,11 @@ <receiver>alternateClearButton</receiver> <slot>setEnabled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>98</x> <y>56</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>247</x> <y>66</y> </hint> @@ -181,11 +157,11 @@ <receiver>ShortcutDialog</receiver> <slot>reject()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>92</x> <y>96</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>100</x> <y>117</y> </hint>