ui icons and new problem

This commit is contained in:
tsi-billypom 2025-04-15 15:20:20 -04:00
parent ae74aa8421
commit 316ad13d18
5 changed files with 30 additions and 16 deletions

View File

@ -79,3 +79,4 @@ player->play();
- database playlist autoexporting - database playlist autoexporting
- .wav, .ogg, .flac convertor - .wav, .ogg, .flac convertor
- automatic "radio" based on artist or genre - automatic "radio" based on artist or genre
- title artist album labels force fit the screen - so the window gets mega expanded with long text. bad

View File

@ -10,6 +10,7 @@ from PyQt5.QtWidgets import (
QListWidget, QListWidget,
QWidget, QWidget,
QDial, QDial,
QStyle,
) )
from logging import debug from logging import debug
from PyQt5.QtGui import QFont from PyQt5.QtGui import QFont
@ -100,7 +101,13 @@ class PreferencesWindow(QDialog):
self.input_fields[key] = input_field self.input_fields[key] = input_field
# Save button # Save button
pixmapi = QStyle.StandardPixmap.SP_DialogSaveButton
style = self.style()
if not style:
style = QStyle()
icon = style.standardIcon(pixmapi)
save_button = QPushButton("Save") save_button = QPushButton("Save")
save_button.setIcon(icon)
save_button.clicked.connect(self.save_preferences) save_button.clicked.connect(self.save_preferences)
self.content_layout.addWidget(save_button) self.content_layout.addWidget(save_button)
@ -125,7 +132,7 @@ class PreferencesWindow(QDialog):
child.widget().deleteLater() child.widget().deleteLater()
def save_preferences(self): def save_preferences(self):
"""Save preferences, reload the config, then reload the database""" """Save preferences, reload the config, then reload the database if necessary"""
# Upcate the config fields # Upcate the config fields
try: try:
@ -140,6 +147,7 @@ class PreferencesWindow(QDialog):
self.config.write(configfile) self.config.write(configfile)
self.reloadConfigSignal.emit() self.reloadConfigSignal.emit()
# only reload db if we changed the db
if self.current_category_str == "db": if self.current_category_str == "db":
self.reloadDatabaseSignal.emit() self.reloadDatabaseSignal.emit()
except Exception as e: except Exception as e:

17
main.py
View File

@ -24,6 +24,7 @@ from PyQt5.QtWidgets import (
QGraphicsPixmapItem, QGraphicsPixmapItem,
QMessageBox, QMessageBox,
QStatusBar, QStatusBar,
QStyle,
) )
from PyQt5.QtCore import ( from PyQt5.QtCore import (
QSize, QSize,
@ -178,6 +179,22 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
) )
self.timer = QTimer(self) # for playback slider and such self.timer = QTimer(self) # for playback slider and such
# Button styles
if not self.style():
style = QStyle()
else:
style = self.style()
assert style is not None # i hate linting errors
pixmapi = QStyle.StandardPixmap.SP_MediaSkipForward
icon = style.standardIcon(pixmapi)
self.nextButton.setIcon(icon)
pixmapi = QStyle.StandardPixmap.SP_MediaSkipBackward
icon = style.standardIcon(pixmapi)
self.previousButton.setIcon(icon)
pixmapi = QStyle.StandardPixmap.SP_MediaPlay
icon = style.standardIcon(pixmapi)
self.playButton.setIcon(icon)
# sharing functions with other classes and that # sharing functions with other classes and that
self.tableView.load_qapp(self) self.tableView.load_qapp(self)
self.albumGraphicsView.load_qapp(self) self.albumGraphicsView.load_qapp(self)

7
ui.py
View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui.ui' # Form implementation generated from reading ui file 'ui.ui'
# #
# Created by: PyQt5 UI code generator 5.15.10 # Created by: PyQt5 UI code generator 5.15.11
# #
# WARNING: Any manual changes made to this file will be lost when pyuic5 is # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing. # run again. Do not edit this file unless you know what you are doing.
@ -201,7 +201,7 @@ class Ui_MainWindow(object):
self.verticalLayout_3.setStretch(0, 20) self.verticalLayout_3.setStretch(0, 20)
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 24)) self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 21))
self.menubar.setObjectName("menubar") self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile = QtWidgets.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile") self.menuFile.setObjectName("menuFile")
@ -254,9 +254,6 @@ class Ui_MainWindow(object):
self.slashLabel.setText(_translate("MainWindow", "/")) self.slashLabel.setText(_translate("MainWindow", "/"))
self.endTimeLabel.setText(_translate("MainWindow", "00:00")) self.endTimeLabel.setText(_translate("MainWindow", "00:00"))
self.speedLabel.setText(_translate("MainWindow", "1.00")) self.speedLabel.setText(_translate("MainWindow", "1.00"))
self.previousButton.setText(_translate("MainWindow", "⏮️"))
self.playButton.setText(_translate("MainWindow", "▶️"))
self.nextButton.setText(_translate("MainWindow", "⏭️"))
self.volumeLabel.setText(_translate("MainWindow", "50")) self.volumeLabel.setText(_translate("MainWindow", "50"))
self.pushButton.setText(_translate("MainWindow", "nothing")) self.pushButton.setText(_translate("MainWindow", "nothing"))
self.menuFile.setTitle(_translate("MainWindow", "File")) self.menuFile.setTitle(_translate("MainWindow", "File"))

11
ui.ui
View File

@ -228,9 +228,6 @@
<pointsize>28</pointsize> <pointsize>28</pointsize>
</font> </font>
</property> </property>
<property name="text">
<string>⏮️</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -240,9 +237,6 @@
<pointsize>28</pointsize> <pointsize>28</pointsize>
</font> </font>
</property> </property>
<property name="text">
<string>▶️</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -252,9 +246,6 @@
<pointsize>28</pointsize> <pointsize>28</pointsize>
</font> </font>
</property> </property>
<property name="text">
<string>⏭️</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -365,7 +356,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1152</width> <width>1152</width>
<height>24</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">