Compare commits

..

No commits in common. "5e770b39754002450465abb68fc47454c18e017b" and "15258f6cc882ec3530d729b66a728769f8a74063" have entirely different histories.

2 changed files with 4 additions and 27 deletions

View File

@ -10,7 +10,7 @@ from datetime import datetime, timedelta
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
from PyQt5.QtGui import QColor, QFont, QPalette, QResizeEvent from PyQt5.QtGui import QColor, QPalette, QFont
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QApplication, QApplication,
QDialog, QDialog,
@ -22,7 +22,6 @@ from PyQt5.QtWidgets import (
QMainWindow, QMainWindow,
QMessageBox, QMessageBox,
QPushButton, QPushButton,
QProgressBar,
) )
from dbconfig import engine, Session from dbconfig import engine, Session
@ -58,7 +57,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
self.duration = cart.duration
self.path = cart.path self.path = cart.path
self.player = None self.player = None
self.is_playing = False self.is_playing = False
@ -70,13 +68,6 @@ class CartButton(QPushButton):
self.setFont(font) self.setFont(font)
self.setObjectName("cart_" + str(cart.cart_number)) self.setObjectName("cart_" + str(cart.cart_number))
self.pgb = QProgressBar(self, textVisible=False)
self.pgb.setVisible(False)
self.pgb.setGeometry(0, 0, self.width(), 10)
self.pgb.setMinimum(0)
self.pgb.setMaximum(100)
self.pgb.setValue(0)
def __repr__(self) -> str: def __repr__(self) -> str:
return ( return (
f"<CartButton(cart_id={self.cart_id} " f"<CartButton(cart_id={self.cart_id} "
@ -93,11 +84,6 @@ class CartButton(QPushButton):
return super().event(event) return super().event(event)
def resizeEvent(self, event: QResizeEvent) -> None:
"""Resize progess bar when button size changes"""
self.pgb.setGeometry(0, 0, self.width(), 10)
class TrackData: class TrackData:
def __init__(self, track): def __init__(self, track):
@ -158,7 +144,6 @@ class Window(QMainWindow, Ui_MainWindow):
"""Configure button with cart data""" """Configure button with cart data"""
btn.setEnabled(False) btn.setEnabled(False)
btn.pgb.setVisible(False)
if cart.path: if cart.path:
if helpers.file_is_readable(cart.path): if helpers.file_is_readable(cart.path):
colour = Config.COLOUR_CART_READY colour = Config.COLOUR_CART_READY
@ -167,7 +152,6 @@ class Window(QMainWindow, Ui_MainWindow):
btn.player.audio_set_volume(Config.VOLUME_VLC_DEFAULT) btn.player.audio_set_volume(Config.VOLUME_VLC_DEFAULT)
if cart.enabled: if cart.enabled:
btn.setEnabled(True) btn.setEnabled(True)
btn.pgb.setVisible(True)
else: else:
colour = Config.COLOUR_CART_ERROR colour = Config.COLOUR_CART_ERROR
else: else:
@ -187,7 +171,6 @@ class Window(QMainWindow, Ui_MainWindow):
else: else:
colour = Config.COLOUR_CART_ERROR colour = Config.COLOUR_CART_ERROR
btn.setStyleSheet("background-color: " + colour + ";\n") btn.setStyleSheet("background-color: " + colour + ";\n")
btn.pgb.minimum = 0
def cart_edit(self, btn: CartButton, event: QEvent): def cart_edit(self, btn: CartButton, event: QEvent):
"""Handle context menu for cart button""" """Handle context menu for cart button"""
@ -248,11 +231,7 @@ class Window(QMainWindow, Ui_MainWindow):
if not btn: if not btn:
continue continue
if btn.is_playing: if btn.is_playing:
if btn.player.is_playing(): if not 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
@ -260,7 +239,6 @@ class Window(QMainWindow, Ui_MainWindow):
btn.player.audio_set_volume(Config.VOLUME_VLC_DEFAULT) btn.player.audio_set_volume(Config.VOLUME_VLC_DEFAULT)
colour = Config.COLOUR_CART_READY colour = Config.COLOUR_CART_READY
btn.setStyleSheet("background-color: " + colour + ";\n") btn.setStyleSheet("background-color: " + colour + ";\n")
btn.pgb.setValue(0)
def clear_selection(self) -> None: def clear_selection(self) -> None:
""" Clear selected row""" """ Clear selected row"""
@ -1133,8 +1111,7 @@ class Window(QMainWindow, Ui_MainWindow):
""" """
Carry out clock tick actions. Carry out clock tick actions.
The Time of Day clock and any cart progress bars are updated The Time of Day clock is updated every tick (500ms).
every tick (500ms).
All other timers are updated every second. As the timer displays All other timers are updated every second. As the timer displays
have a one-second resolution, updating every 500ms can result in have a one-second resolution, updating every 500ms can result in
@ -1143,7 +1120,6 @@ class Window(QMainWindow, Ui_MainWindow):
Actions required: Actions required:
- Update TOD clock - Update TOD clock
- Call cart_tick
- If track is playing: - If track is playing:
update track clocks time and colours update track clocks time and colours
- Else: - Else:

View File

@ -1768,6 +1768,7 @@ class PlaylistTab(QTableWidget):
idx = data.idx idx = data.idx
if idx == len(columns) - 1: if idx == len(columns) - 1:
# Set width of last column to zero as it's set to stretch # Set width of last column to zero as it's set to stretch
print(f"Set {column_name} to zero width, {self.playlist_id=}")
self.setColumnWidth(idx, 0) self.setColumnWidth(idx, 0)
continue continue
attr_name = f"playlist_{column_name}_col_width" attr_name = f"playlist_{column_name}_col_width"