diff options
Diffstat (limited to 'solo_tool_qt.py')
-rw-r--r-- | solo_tool_qt.py | 18 |
1 files changed, 15 insertions, 3 deletions
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") |