From b09058c6c7256ae81e1530e303392d4ec2f16d8b Mon Sep 17 00:00:00 2001
From: Nils <>
Date: Sat, 3 Jul 2021 23:19:50 +0200
Subject: [PATCH] Fix button shortcuts
---
qtgui/designer/mainwindow.py | 2 --
qtgui/designer/mainwindow.ui | 6 ------
qtgui/mainwindow.py | 15 +++++++++------
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/qtgui/designer/mainwindow.py b/qtgui/designer/mainwindow.py
index c84caa9..f9f2c07 100644
--- a/qtgui/designer/mainwindow.py
+++ b/qtgui/designer/mainwindow.py
@@ -173,7 +173,6 @@ class Ui_MainWindow(object):
self.actionPlayPause.setObjectName("actionPlayPause")
self.actionLoop = QtWidgets.QAction(MainWindow)
self.actionLoop.setText("Loop")
- self.actionLoop.setShortcut("L")
self.actionLoop.setObjectName("actionLoop")
self.actionToStart = QtWidgets.QAction(MainWindow)
self.actionToStart.setText("To Start")
@@ -195,7 +194,6 @@ class Ui_MainWindow(object):
self.actionAddPattern.setText(_translate("MainWindow", "Add Pattern"))
self.actionAddPattern.setIconText(_translate("MainWindow", "Add Pattern"))
self.actionAddPattern.setToolTip(_translate("MainWindow", "Add a new Pattern Track"))
- self.actionPlayPause.setShortcut(_translate("MainWindow", "Space"))
self.actionClone_Selected_Track.setIconText(_translate("MainWindow", "Clone selected Track"))
self.actionAddPianoRoll.setText(_translate("MainWindow", "Add PianoRoll"))
self.actionAddPianoRoll.setToolTip(_translate("MainWindow", "Add PianoRoll"))
diff --git a/qtgui/designer/mainwindow.ui b/qtgui/designer/mainwindow.ui
index 1c1b4c9..d4b78e5 100644
--- a/qtgui/designer/mainwindow.ui
+++ b/qtgui/designer/mainwindow.ui
@@ -402,17 +402,11 @@
PlayPause
-
- Space
-
Loop
-
- L
-
diff --git a/qtgui/mainwindow.py b/qtgui/mainwindow.py
index 5499f8d..1e75081 100644
--- a/qtgui/mainwindow.py
+++ b/qtgui/mainwindow.py
@@ -133,16 +133,18 @@ class MainWindow(TemplateMainWindow):
self.ui.playPauseButton.setIcon(QtGui.QIcon(':playpause.png'))
self.ui.playPauseButton.clicked.connect(api.playPause)
self.ui.playPauseButton.setToolTip(QtCore.QCoreApplication.translate("PlaybackControls", "[Space] Play / Pause"))
- self.ui.centralwidget.addAction(self.ui.actionPlayPause) #no action without connection to a widget.
- self.ui.actionPlayPause.triggered.connect(self.ui.playPauseButton.click)
+ self.ui.playPauseButton.setShortcut("Space")
+ #self.ui.centralwidget.addAction(self.ui.actionPlayPause) #no action without connection to a widget.
+ #self.ui.actionPlayPause.triggered.connect(self.ui.playPauseButton.click)
self.ui.loopButton.setFixedWidth(width)
self.ui.loopButton.setText("")
self.ui.loopButton.setIcon(QtGui.QIcon(':loop.png'))
self.ui.loopButton.setToolTip(QtCore.QCoreApplication.translate("PlaybackControls", "[L] Loop current Measure"))
self.ui.loopButton.clicked.connect(api.toggleLoop)
- self.ui.centralwidget.addAction(self.ui.actionLoop) #no action without connection to a widget.
- self.ui.actionLoop.triggered.connect(self.ui.loopButton.click)
+ self.ui.loopButton.setShortcut("l")
+ #self.ui.centralwidget.addAction(self.ui.actionLoop) #no action without connection to a widget.
+ #self.ui.actionLoop.triggered.connect(self.ui.loopButton.click)
def callback_loopButtonText(measureNumber):
if not measureNumber is None:
@@ -150,6 +152,7 @@ class MainWindow(TemplateMainWindow):
self.ui.loopButton.setText(nrstr)
else:
self.ui.loopButton.setText("")
+ self.ui.loopButton.setShortcut("l") #Qt buttons lose their shortcut after setText
api.callbacks.loopChanged.append(callback_loopButtonText)
self.ui.loopMeasureFactorSpinBox.setFixedWidth(width)
@@ -163,8 +166,8 @@ class MainWindow(TemplateMainWindow):
self.ui.toStartButton.setToolTip(QtCore.QCoreApplication.translate("PlaybackControls", "[Home] Jump to Start"))
self.ui.toStartButton.setShortcut("Home")
self.ui.toStartButton.clicked.connect(api.rewind)
- self.ui.centralwidget.addAction(self.ui.actionToStart) #no action without connection to a widget.
- self.ui.actionToStart.triggered.connect(self.ui.toStartButton.click)
+ #self.ui.centralwidget.addAction(self.ui.actionToStart) #no action without connection to a widget.
+ #self.ui.actionToStart.triggered.connect(self.ui.toStartButton.click)
self.currentTrackId = None #this is purely a GUI construct. the engine does not know a current track. On startup there is no active track