Compare commits
No commits in common. "9ccff3db2011d945e521edbc8ea615fed2855cbd" and "5e770b39754002450465abb68fc47454c18e017b" have entirely different histories.
9ccff3db20
...
5e770b3975
@ -16,7 +16,6 @@ class Config(object):
|
|||||||
COLOUR_BITRATE_OK = "#dcedc8"
|
COLOUR_BITRATE_OK = "#dcedc8"
|
||||||
COLOUR_CART_ERROR = "#dc3545"
|
COLOUR_CART_ERROR = "#dc3545"
|
||||||
COLOUR_CART_PLAYING = "#248f24"
|
COLOUR_CART_PLAYING = "#248f24"
|
||||||
COLOUR_CART_PROGRESSBAR = "#000000"
|
|
||||||
COLOUR_CART_READY = "#ffc107"
|
COLOUR_CART_READY = "#ffc107"
|
||||||
COLOUR_CART_UNCONFIGURED = "#f2f2f2"
|
COLOUR_CART_UNCONFIGURED = "#f2f2f2"
|
||||||
COLOUR_CURRENT_HEADER = "#d4edda"
|
COLOUR_CURRENT_HEADER = "#d4edda"
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from time import sleep
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from PyQt5.QtCore import QDate, QEvent, Qt, QSize, QTime, QTimer
|
from PyQt5.QtCore import QDate, QEvent, Qt, QSize, QTime, QTimer
|
||||||
@ -59,9 +58,6 @@ class CartButton(QPushButton):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.cart_id = cart.id
|
self.cart_id = cart.id
|
||||||
if cart.path and cart.enabled and not cart.duration:
|
|
||||||
tags = helpers.get_tags(cart.path)
|
|
||||||
cart.duration = tags['duration']
|
|
||||||
self.duration = cart.duration
|
self.duration = cart.duration
|
||||||
self.path = cart.path
|
self.path = cart.path
|
||||||
self.player = None
|
self.player = None
|
||||||
@ -76,13 +72,9 @@ class CartButton(QPushButton):
|
|||||||
|
|
||||||
self.pgb = QProgressBar(self, textVisible=False)
|
self.pgb = QProgressBar(self, textVisible=False)
|
||||||
self.pgb.setVisible(False)
|
self.pgb.setVisible(False)
|
||||||
palette = self.pgb.palette()
|
|
||||||
palette.setColor(QPalette.Highlight,
|
|
||||||
QColor(Config.COLOUR_CART_PROGRESSBAR))
|
|
||||||
self.pgb.setPalette(palette)
|
|
||||||
self.pgb.setGeometry(0, 0, self.width(), 10)
|
self.pgb.setGeometry(0, 0, self.width(), 10)
|
||||||
self.pgb.setMinimum(0)
|
self.pgb.setMinimum(0)
|
||||||
self.pgb.setMaximum(1)
|
self.pgb.setMaximum(100)
|
||||||
self.pgb.setValue(0)
|
self.pgb.setValue(0)
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
@ -192,9 +184,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
btn.player.play()
|
btn.player.play()
|
||||||
btn.is_playing = True
|
btn.is_playing = True
|
||||||
colour = Config.COLOUR_CART_PLAYING
|
colour = Config.COLOUR_CART_PLAYING
|
||||||
thread = threading.Thread(target=self.cart_progressbar,
|
|
||||||
args=(btn,))
|
|
||||||
thread.start()
|
|
||||||
else:
|
else:
|
||||||
colour = Config.COLOUR_CART_ERROR
|
colour = Config.COLOUR_CART_ERROR
|
||||||
btn.setStyleSheet("background-color: " + colour + ";\n")
|
btn.setStyleSheet("background-color: " + colour + ";\n")
|
||||||
@ -251,16 +240,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# Configure button
|
# Configure button
|
||||||
self.cart_configure(cart, btn)
|
self.cart_configure(cart, btn)
|
||||||
|
|
||||||
def cart_progressbar(self, btn: CartButton) -> None:
|
|
||||||
"""Manage progress bar"""
|
|
||||||
|
|
||||||
ms = 0
|
|
||||||
btn.pgb.setMaximum(btn.duration)
|
|
||||||
while ms <= btn.duration:
|
|
||||||
btn.pgb.setValue(ms)
|
|
||||||
ms += 100
|
|
||||||
sleep(0.1)
|
|
||||||
|
|
||||||
def cart_tick(self) -> None:
|
def cart_tick(self) -> None:
|
||||||
"""Cart clock actions"""
|
"""Cart clock actions"""
|
||||||
|
|
||||||
@ -269,7 +248,11 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if not btn:
|
if not btn:
|
||||||
continue
|
continue
|
||||||
if btn.is_playing:
|
if btn.is_playing:
|
||||||
if not btn.player.is_playing():
|
if btn.player.is_playing():
|
||||||
|
# Update progress bar
|
||||||
|
position = btn.player.get_position()
|
||||||
|
btn.pgb.setValue(int(position * 100))
|
||||||
|
else:
|
||||||
# Cart has finished playing
|
# Cart has finished playing
|
||||||
btn.is_playing = False
|
btn.is_playing = False
|
||||||
# Setting to position 0 doesn't seem to work
|
# Setting to position 0 doesn't seem to work
|
||||||
|
|||||||
@ -823,6 +823,7 @@ class PlaylistTab(QTableWidget):
|
|||||||
def scroll_current_to_top(self) -> None:
|
def scroll_current_to_top(self) -> None:
|
||||||
"""Scroll currently-playing row to top"""
|
"""Scroll currently-playing row to top"""
|
||||||
|
|
||||||
|
log.debug("KAE: playlists.scroll_current_to_top()")
|
||||||
current_row = self._get_current_track_row()
|
current_row = self._get_current_track_row()
|
||||||
log.debug(f"KAE: playlists.scroll_current_to_top(), {current_row=}")
|
log.debug(f"KAE: playlists.scroll_current_to_top(), {current_row=}")
|
||||||
self._scroll_to_top(current_row)
|
self._scroll_to_top(current_row)
|
||||||
@ -830,6 +831,7 @@ class PlaylistTab(QTableWidget):
|
|||||||
def scroll_next_to_top(self) -> None:
|
def scroll_next_to_top(self) -> None:
|
||||||
"""Scroll nextly-playing row to top"""
|
"""Scroll nextly-playing row to top"""
|
||||||
|
|
||||||
|
log.debug("KAE: playlists.scroll_next_to_top()")
|
||||||
next_row = self._get_next_track_row()
|
next_row = self._get_next_track_row()
|
||||||
log.debug(f"KAE: playlists.scroll_next_to_top(), {next_row=}")
|
log.debug(f"KAE: playlists.scroll_next_to_top(), {next_row=}")
|
||||||
self._scroll_to_top(next_row)
|
self._scroll_to_top(next_row)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user