aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2024-11-09 23:29:08 +0100
committerEddy Pedroni <epedroni@pm.me>2024-11-09 23:29:08 +0100
commit7c00f418caf8f1e9fcb235563127a9c8cea22bb4 (patch)
tree286b790e1b1cd28d078212721f3721df7efddbcd
parentf676c50ba91ca6d4d0da9f77aeadc8b3fb16dc26 (diff)
Minor GUI improvement
-rw-r--r--doc/known-issues.md7
-rw-r--r--gui-project/src/solo_tool_gui.py4
-rw-r--r--solo-tool-project/src/solo_tool/midi_wrapper_mido.py12
3 files changed, 14 insertions, 9 deletions
diff --git a/doc/known-issues.md b/doc/known-issues.md
index 7604811..e87a3fc 100644
--- a/doc/known-issues.md
+++ b/doc/known-issues.md
@@ -16,10 +16,6 @@
* skip ahead and behind by steps of a few seconds
* set A and B points at current play head position (during playback)
-* GUI feature requests:
- * wipe LED state when application closes
-
-
# Closed Issues
* Moving AB sliders does not set AB limit. Instead need to save AB limit and then select it to apply
@@ -41,6 +37,9 @@
* close application without crashing
* wipe LED state when application closes
+* GUI feature requests:
+ * wipe LED state when application closes
+
# Use Cases
## Song/solo practice
diff --git a/gui-project/src/solo_tool_gui.py b/gui-project/src/solo_tool_gui.py
index 0488f84..cd73c9a 100644
--- a/gui-project/src/solo_tool_gui.py
+++ b/gui-project/src/solo_tool_gui.py
@@ -231,6 +231,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if event.key() == Qt.Key_Super_L:
self.soloTool.jumpToA()
+ def closeEvent(self, event):
+ self.midiController.disconnect()
+ event.accept()
+
def main():
app = QApplication([])
app.setApplicationName("Solo Tool")
diff --git a/solo-tool-project/src/solo_tool/midi_wrapper_mido.py b/solo-tool-project/src/solo_tool/midi_wrapper_mido.py
index 4cfc9c3..34f1031 100644
--- a/solo-tool-project/src/solo_tool/midi_wrapper_mido.py
+++ b/solo-tool-project/src/solo_tool/midi_wrapper_mido.py
@@ -12,12 +12,14 @@ class MidiWrapper:
self._outPort = mido.open_output(deviceName)
def disconnect(self):
- self._inPort.close()
- self._inPort = None
+ if self._inPort is not None:
+ self._inPort.close()
+ self._inPort = None
- self._outPort.reset()
- self._outPort.close()
- self._outPort = None
+ if self._outPort is not None:
+ self._outPort.reset()
+ self._outPort.close()
+ self._outPort = None
def sendMessage(self, note, velocity, channel):
if self._outPort is not None: