diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-02-02 12:04:58 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-02-02 12:04:58 +0100 |
commit | 6debe39546e62d5796f22db2388341ae9132042d (patch) | |
tree | e9cbe8b37a5a774633201ed7a36388035fe898eb | |
parent | d6403961e778db1f0f6a5e45147770714449fa8c (diff) |
Added a couple small features to Qt GUI
-rw-r--r-- | known-issues.md | 4 | ||||
-rw-r--r-- | solo_tool_qt.py | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/known-issues.md b/known-issues.md index a7ab952..b1bac9e 100644 --- a/known-issues.md +++ b/known-issues.md @@ -23,6 +23,10 @@ * Switching between songs and AB limits does not work properly * AB controller only keeps track of limit index, not current song => when song changes, index is invalid but not properly reset * Changing song while playing does not update play/pause button LED on MIDI controller +* Accept file path as argument to Qt GUI to automatically load session +* Key mapping in Qt to jump to A + * Space bar in principle + * Not so easy to do actually, used Super L instead # Use Cases diff --git a/solo_tool_qt.py b/solo_tool_qt.py index b3eac81..a2a1164 100644 --- a/solo_tool_qt.py +++ b/solo_tool_qt.py @@ -1,3 +1,5 @@ +import sys + from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * @@ -46,6 +48,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) + self.setupUi(self) self.timer = QTimer(self) @@ -95,6 +98,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.initMidiButton.pressed.connect(self.initMidi) self.timer.start() + + if len(sys.argv) > 1: + self.loadSession(sys.argv[1]) + self.show() def timerCallback(self): @@ -133,9 +140,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): if path: self.soloTool.saveSession(path) - def loadSession(self): - path, _ = QFileDialog.getOpenFileName(self, "Open file", "", "session file (*.json)") - if path: + def loadSession(self, path): + if path is None: + path, _ = QFileDialog.getOpenFileName(self, "Open file", "", "session file (*.json)") + if path is not None: self.soloTool.loadSession(path) self.playlistModel.layoutChanged.emit() self.abListModel.layoutChanged.emit() @@ -219,6 +227,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): print("Error: could not connect to MIDI controller") print(e) + def keyPressEvent(self, event): + if event.key() == Qt.Key_Super_L: + self.soloTool.jumpToA() + if __name__ == '__main__': app = QApplication([]) app.setApplicationName("Solo Tool") |