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

View File

@ -1768,6 +1768,7 @@ class PlaylistTab(QTableWidget):
idx = data.idx
if idx == len(columns) - 1:
# 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)
continue
attr_name = f"playlist_{column_name}_col_width"