aboutsummaryrefslogtreecommitdiffstats
path: root/solo_tool_qt.py
diff options
context:
space:
mode:
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([])