From 59b13af09a5e35ea1364eb1031be4ce9410f6f03 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Wed, 22 Dec 2021 17:06:53 +0100 Subject: Added MVP Qt implementation, known issues tracking, removed old files --- control.py | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 control.py (limited to 'control.py') diff --git a/control.py b/control.py deleted file mode 100644 index 30fe868..0000000 --- a/control.py +++ /dev/null @@ -1,52 +0,0 @@ -from PyQt5.QtCore import * - -import midi -import logging - -MIDI_PLAY = midi.lp_key[0][1] - -class Control: - def __init__(self, window): - self.window = window - self.player = window.player - self.playlist = window.playlist - - window.playButton.pressed.connect(self.play) - window.pauseButton.pressed.connect(self.pause) - window.songSlider.setMaximum(100000) - window.songSlider.sliderPressed.connect(self.sliderPressed) - window.songSlider.sliderReleased.connect(self.sliderReleased) - - self.timer = QTimer(window) - self.timer.setInterval(1000) - self.timer.timeout.connect(self.updateSongSlider) - - def pause(self): - self.player.pause() - - self.updateMidi() - - def play(self): - selected = self.playlist.medialist.media() - self.player.play_item(selected) - self.timer.start() - - self.updateMidi() - - def updateSongSlider(self): - position = self.player.get_media_player().get_position() * 100000 - self.window.songSlider.setValue(position) - - def sliderPressed(self): - self.timer.stop() - - def sliderReleased(self): - position = self.window.songSlider.value() / 100000.0 - logging.info(f"Setting position: {position}") - self.player.get_media_player().set_position(position) - self.timer.start() - - def updateMidi(self): - if self.window.midiEnabled: - midi.button_on(MIDI_PLAY, (midi.GREEN if self.player.is_playing() else midi.RED)) - -- cgit v1.2.3