From ea5ac438da28c472e458b0df3b0c2e23cb2448a4 Mon Sep 17 00:00:00 2001 From: Tony Stipanic Date: Tue, 9 Mar 2021 20:31:22 +0100 Subject: [PATCH 1/2] Accelerator keys for menu bar and tabs, shortcuts for toolbar items --- qt/app.py | 14 ++++++++++---- qt/settingsdialog.py | 12 ++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/qt/app.py b/qt/app.py index d129f0d3c..9abdc2566 100644 --- a/qt/app.py +++ b/qt/app.py @@ -85,6 +85,7 @@ def __init__(self, config, appInstance, qapp): # take_snapshot button self.btnTakeSnapshot = self.mainToolbar.addAction(icon.TAKE_SNAPSHOT, _('Take snapshot')) + self.btnTakeSnapshot.setShortcuts(QKeySequence(Qt.CTRL + Qt.Key_S)) self.btnTakeSnapshot.triggered.connect(self.btnTakeSnapshotClicked) takeSnapshotMenu = qttools.Menu() @@ -92,6 +93,7 @@ def __init__(self, config, appInstance, qapp): action.triggered.connect(self.btnTakeSnapshotClicked) self.btnTakeSnapshotChecksum = takeSnapshotMenu.addAction(icon.TAKE_SNAPSHOT, _('Take snapshot with checksums')) self.btnTakeSnapshotChecksum.setToolTip(_('Use checksum to detect changes')) + self.btnTakeSnapshotChecksum.setShortcuts(QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_S)) self.btnTakeSnapshotChecksum.triggered.connect(self.btnTakeSnapshotChecksumClicked) self.btnTakeSnapshot.setMenu(takeSnapshotMenu) @@ -121,9 +123,11 @@ def __init__(self, config, appInstance, qapp): self.btnUpdateSnapshots.triggered.connect(self.btnUpdateSnapshotsClicked) self.btnNameSnapshot = self.mainToolbar.addAction(icon.SNAPSHOT_NAME, _('Snapshot Name')) + self.btnNameSnapshot.setShortcuts([Qt.Key_F2]) self.btnNameSnapshot.triggered.connect(self.btnNameSnapshotClicked) self.btnRemoveSnapshot = self.mainToolbar.addAction(icon.REMOVE_SNAPSHOT, _('Remove Snapshot')) + self.btnRemoveSnapshot.setShortcuts([Qt.Key_Delete]) self.btnRemoveSnapshot.triggered.connect(self.btnRemoveSnapshotClicked) self.btnSnapshotLogView = self.mainToolbar.addAction(icon.VIEW_SNAPSHOT_LOG, _('View Snapshot Log')) @@ -135,6 +139,7 @@ def __init__(self, config, appInstance, qapp): self.mainToolbar.addSeparator() self.btnSettings = self.mainToolbar.addAction(icon.SETTINGS, _('Settings')) + self.btnSettings.setShortcuts(QKeySequence(Qt.CTRL + Qt.SHIFT + Qt.Key_Comma)) self.btnSettings.triggered.connect(self.btnSettingsClicked) self.mainToolbar.addSeparator() @@ -156,6 +161,7 @@ def __init__(self, config, appInstance, qapp): menuHelp = QMenu(self) self.btnHelp = menuHelp.addAction(icon.HELP, _('Help')) + self.btnHelp.setShortcuts([Qt.Key_F1]) self.btnHelp.triggered.connect(self.btnHelpClicked) self.btnHelpConfig = menuHelp.addAction(icon.HELP, _('Config File Help')) self.btnHelpConfig.triggered.connect(self.btnHelpConfigClicked) @@ -257,7 +263,7 @@ def __init__(self, config, appInstance, qapp): filesLayout.addWidget(self.filesViewToolbar) #menubar - self.menuSnapshot = self.menuBar().addMenu(_('Snapshot')) + self.menuSnapshot = self.menuBar().addMenu(_('&Snapshot')) self.menuSnapshot.addAction(self.btnTakeSnapshot) self.menuSnapshot.addAction(self.btnUpdateSnapshots) self.menuSnapshot.addAction(self.btnNameSnapshot) @@ -268,7 +274,7 @@ def __init__(self, config, appInstance, qapp): self.menuSnapshot.addAction(self.btnShutdown) self.menuSnapshot.addAction(self.btnQuit) - self.menuView = self.menuBar().addMenu(_('View')) + self.menuView = self.menuBar().addMenu(_('&View')) self.menuView.addAction(self.btnFolderUp) self.menuView.addAction(self.btnShowHiddenFiles) self.menuView.addSeparator() @@ -277,14 +283,14 @@ def __init__(self, config, appInstance, qapp): self.menuView.addSeparator() self.menuView.addAction(self.btnSnapshots) - self.menuRestore = self.menuBar().addMenu(_('Restore')) + self.menuRestore = self.menuBar().addMenu(_('&Restore')) self.menuRestore.addAction(self.btnRestore) self.menuRestore.addAction(self.btnRestoreTo) self.menuRestore.addSeparator() self.menuRestore.addAction(self.btnRestoreParent) self.menuRestore.addAction(self.btnRestoreParentTo) - self.menuHelp = self.menuBar().addMenu(_('Help')) + self.menuHelp = self.menuBar().addMenu(_('&Help')) self.menuHelp.addAction(self.btnHelp) self.menuHelp.addAction(self.btnHelpConfig) self.menuHelp.addSeparator() diff --git a/qt/settingsdialog.py b/qt/settingsdialog.py index 5c85da465..84446d1fd 100644 --- a/qt/settingsdialog.py +++ b/qt/settingsdialog.py @@ -103,7 +103,7 @@ def __init__(self, parent): #TAB: General scrollArea = QScrollArea(self) scrollArea.setFrameStyle(QFrame.NoFrame) - self.tabs.addTab(scrollArea, _('General')) + self.tabs.addTab(scrollArea, _('&General')) layoutWidget = QWidget(self) layout = QVBoxLayout(layoutWidget) @@ -392,7 +392,7 @@ def __init__(self, parent): #TAB: Include tabWidget = QWidget(self) - self.tabs.addTab(tabWidget, _('Include')) + self.tabs.addTab(tabWidget, _('&Include')) layout = QVBoxLayout(tabWidget) self.listInclude = QTreeWidget(self) @@ -428,7 +428,7 @@ def __init__(self, parent): #TAB: Exclude tabWidget = QWidget(self) - self.tabs.addTab(tabWidget, _('Exclude')) + self.tabs.addTab(tabWidget, _('&Exclude')) layout = QVBoxLayout(tabWidget) self.lblSshEncfsExcludeWarning = QLabel(_('Warning: Wildcards (\'foo*\', \'[fF]oo\', \'fo?\') will be ignored with mode \'SSH encrypted\'.\nOnly separate asterisk are allowed (\'foo/*\', \'foo/**/bar\')'), self) @@ -503,7 +503,7 @@ def __init__(self, parent): #TAB: Auto-remove scrollArea = QScrollArea(self) scrollArea.setFrameStyle(QFrame.NoFrame) - self.tabs.addTab(scrollArea, _('Auto-remove')) + self.tabs.addTab(scrollArea, _('&Auto-remove')) layoutWidget = QWidget(self) layout = QGridLayout(layoutWidget) @@ -607,7 +607,7 @@ def __init__(self, parent): #TAB: Options scrollArea = QScrollArea(self) scrollArea.setFrameStyle(QFrame.NoFrame) - self.tabs.addTab(scrollArea, _('Options')) + self.tabs.addTab(scrollArea, _('&Options')) layoutWidget = QWidget(self) layout = QVBoxLayout(layoutWidget) @@ -668,7 +668,7 @@ def __init__(self, parent): #TAB: Expert Options scrollArea = QScrollArea(self) scrollArea.setFrameStyle(QFrame.NoFrame) - self.tabs.addTab(scrollArea, _('Expert Options')) + self.tabs.addTab(scrollArea, _('E&xpert Options')) layoutWidget = QWidget(self) layout = QVBoxLayout(layoutWidget) From 330978d19c0e745da956c4c00f00ff3c103fed3a Mon Sep 17 00:00:00 2001 From: Tony Stipanic Date: Tue, 9 Mar 2021 20:47:36 +0100 Subject: [PATCH 2/2] Remove exit from toolbar, use more standard Ctrl+Q --- qt/app.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qt/app.py b/qt/app.py index 9abdc2566..52cc0e792 100644 --- a/qt/app.py +++ b/qt/app.py @@ -151,8 +151,9 @@ def __init__(self, config, appInstance, qapp): self.btnShutdown.setEnabled(self.shutdown.canShutdown()) self.btnShutdown.toggled.connect(self.btnShutdownToggled) - self.btnQuit = self.mainToolbar.addAction(icon.EXIT, _('Exit')) - self.btnQuit.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_W)) + self.menuSnapshot = self.menuBar().addMenu(_('&Snapshot')) + self.btnQuit = self.menuSnapshot.addAction(icon.EXIT, _('Exit')) + self.btnQuit.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q)) self.btnQuit.triggered.connect(self.close) empty = QWidget(self) @@ -262,8 +263,6 @@ def __init__(self, config, appInstance, qapp): filesLayout.addWidget(self.filesViewToolbar) - #menubar - self.menuSnapshot = self.menuBar().addMenu(_('&Snapshot')) self.menuSnapshot.addAction(self.btnTakeSnapshot) self.menuSnapshot.addAction(self.btnUpdateSnapshots) self.menuSnapshot.addAction(self.btnNameSnapshot)