Yuya Nishihara avatar Yuya Nishihara committed 9c712a0

hgqt: create QShortcut for each binding of StandardKey (fixes #2045)

Comments (0)

Files changed (7)

tortoisehg/hgqt/commit.py

         self.commit.reload()
         self.updateUndo()
         self.commit.msgte.setFocus()
-        QShortcut(QKeySequence.Refresh, self, self.refresh)
+        qtlib.newshortcutsforstdkey(QKeySequence.Refresh, self, self.refresh)
 
     def done(self, ret):
         self.commit.repo.configChanged.disconnect(self.commit.configChanged)

tortoisehg/hgqt/mq.py

             self.layout().addWidget(self.statusbar)
             self.progress.connect(self.statusbar.progress)
             self.showMessage.connect(self.statusbar.showMessage)
-            QShortcut(QKeySequence.Refresh, self, self.reload)
+            qtlib.newshortcutsforstdkey(QKeySequence.Refresh, self,
+                                        self.reload)
             self.resize(850, 550)
 
         self.loadConfigs()

tortoisehg/hgqt/qscilib.py

     def showsearchbar():
         searchbar.show()
         searchbar.setFocus(Qt.OtherFocusReason)
-    QShortcut(QKeySequence.Find, dialog, showsearchbar)
+    qtlib.newshortcutsforstdkey(QKeySequence.Find, dialog, showsearchbar)
     dialog.layout().addWidget(searchbar)
 
     BB = QDialogButtonBox

tortoisehg/hgqt/qtlib.py

     """Create QKeySequence of modifier key prepended"""
     origseq = QKeySequence(keysequence(o))
     return QKeySequence('%s+%s' % (modifier, origseq.toString()))
+
+def newshortcutsforstdkey(key, *args, **kwargs):
+    """Create [QShortcut,...] for all key bindings of the given StandardKey"""
+    return [QShortcut(keyseq, *args, **kwargs)
+            for keyseq in QKeySequence.keyBindings(key)]

tortoisehg/hgqt/quickop.py

         self.stwidget.refreshWctx()
         QShortcut(QKeySequence('Ctrl+Return'), self, self.accept)
         QShortcut(QKeySequence('Ctrl+Enter'), self, self.accept)
-        QShortcut(QKeySequence.Refresh, self, self.stwidget.refreshWctx)
+        qtlib.newshortcutsforstdkey(QKeySequence.Refresh, self,
+                                    self.stwidget.refreshWctx)
         QShortcut(QKeySequence('Escape'), self, self.reject)
 
     def commandStarted(self):

tortoisehg/hgqt/rejects.py

         def showsearchbar():
             searchbar.show()
             searchbar.setFocus(Qt.OtherFocusReason)
-        QShortcut(QKeySequence.Find, self, showsearchbar)
+        qtlib.newshortcutsforstdkey(QKeySequence.Find, self, showsearchbar)
         self.layout().addWidget(searchbar)
 
         hbox = QHBoxLayout()

tortoisehg/hgqt/status.py

         self.setWindowFlags(Qt.Window)
         self.loadSettings()
 
-        QShortcut(QKeySequence.Refresh, self, self.stwidget.refreshWctx)
+        qtlib.newshortcutsforstdkey(QKeySequence.Refresh, self,
+                                    self.stwidget.refreshWctx)
         QTimer.singleShot(0, self.stwidget.refreshWctx)
 
     def linkActivated(self, link):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.