aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool_qt.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-02-02 12:04:58 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-02-02 12:04:58 +0100
commit6debe39546e62d5796f22db2388341ae9132042d (patch)
treee9cbe8b37a5a774633201ed7a36388035fe898eb /solo_tool_qt.py
parentd6403961e778db1f0f6a5e45147770714449fa8c (diff)
Added a couple small features to Qt GUI
Diffstat (limited to 'solo_tool_qt.py')
-rw-r--r--solo_tool_qt.py18
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")