aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool_qt.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2021-12-26 23:45:58 +0100
committerEddy Pedroni <eddy@0xf7.com>2021-12-26 23:45:58 +0100
commitc90623ebcd16070aafc5f8ad4cf76b5aa2b1e49f (patch)
tree0d6667eb02f86990d2430b7c8efa91bc25188336 /solo_tool_qt.py
parentbf232d2f3fa94f374d82464eb66bcc7d72adc3ed (diff)
Solved issues relating to AB slider behaviour
Diffstat (limited to 'solo_tool_qt.py')
-rw-r--r--solo_tool_qt.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/solo_tool_qt.py b/solo_tool_qt.py
index 7c17a33..8678800 100644
--- a/solo_tool_qt.py
+++ b/solo_tool_qt.py
@@ -59,7 +59,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.songSlider.sliderReleased.connect(self.songSliderReleased)
self.aSlider.setMaximum(POSITION_FACTOR)
+ self.aSlider.sliderReleased.connect(self.abSliderReleased)
self.bSlider.setMaximum(POSITION_FACTOR)
+ self.bSlider.sliderReleased.connect(self.abSliderReleased)
self.playButton.pressed.connect(self.soloTool.play)
self.pauseButton.pressed.connect(self.soloTool.pause)
@@ -114,21 +116,29 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.soloTool.setPlaybackPosition(position)
self.timer.start()
+ def clearAbListSelection(self):
+ i = self.abListView.selectionModel().currentIndex()
+ self.abListView.selectionModel().select(i, QItemSelectionModel.Deselect)
+
+ def abSliderReleased(self):
+ a = self.aSlider.value() / float(POSITION_FACTOR)
+ b = self.bSlider.value() / float(POSITION_FACTOR)
+ self.soloTool.setAbLimits(a, b)
+ self.clearAbListSelection()
+
def playlistSelectionChanged(self, i):
index = i.indexes()[0].row()
self.soloTool.setSong(index)
self.abListModel.layoutChanged.emit()
- self.abListSelectionChanged(None)
+ self.clearAbListSelection()
def abListSelectionChanged(self, i):
- if i is not None:
+ if i is not None and not i.isEmpty():
index = i.indexes()[0].row()
ab = self.soloTool.getAbLimits()[index]
- self.soloTool.setAbLimit(index)
- else:
- ab = (0, 0)
- self.aSlider.setValue(int(ab[0] * POSITION_FACTOR))
- self.bSlider.setValue(int(ab[1] * POSITION_FACTOR))
+ self.soloTool.loadAbLimits(index)
+ self.aSlider.setValue(int(ab[0] * POSITION_FACTOR))
+ self.bSlider.setValue(int(ab[1] * POSITION_FACTOR))
if __name__ == '__main__':
app = QApplication([])