diff --git a/DBA.py b/DBA.py index 69d6930..9a74c63 100644 --- a/DBA.py +++ b/DBA.py @@ -1,5 +1,4 @@ import sqlite3 -import logging from configparser import ConfigParser from pathlib import Path from appdirs import user_config_dir @@ -7,7 +6,7 @@ from appdirs import user_config_dir class DBAccess: def __init__(self, db_name=None): - logging.info("Instantiating DBAccess") + # logging.info("Instantiating DBAccess") config = ConfigParser() cfg_file = ( Path(user_config_dir(appname="musicpom", appauthor="billypom")) diff --git a/components/HeaderTags.py b/components/HeaderTags.py index 0819da2..1f9fca2 100644 --- a/components/HeaderTags.py +++ b/components/HeaderTags.py @@ -2,7 +2,6 @@ from configparser import ConfigParser from pathlib import Path from appdirs import user_config_dir from dataclasses import dataclass, asdict -from typing import Optional @dataclass @@ -47,8 +46,8 @@ class HeaderTags: ) self.config = ConfigParser() self.config.read(cfg_file) - print("header tag config") - print(self.config) + # print("header tag config") + # print(self.config) self.user_fields: list = str(self.config["table"]["columns"]).split(",") self.editable_fields: list = [ "title", diff --git a/components/MusicTable.py b/components/MusicTable.py index 43bbb68..d63fe8d 100644 --- a/components/MusicTable.py +++ b/components/MusicTable.py @@ -721,10 +721,11 @@ class MusicTable(QTableView): else "" ) params = "" + debug(f'playlist_id: {playlist_id}') # Load a playlist - if playlist_id: + if len(playlist_id) > 0: self.selected_playlist_id = playlist_id[0] - if self.selected_playlist_id: + debug('load music table a playlist') try: with DBA.DBAccess() as db: query = f"SELECT id, { @@ -747,6 +748,7 @@ class MusicTable(QTableView): return # Load the entire library else: + debug('load music table a Whole Table') try: with DBA.DBAccess() as db: query = f"SELECT id, {fields} FROM song" @@ -793,14 +795,14 @@ class MusicTable(QTableView): # reloading the model destroys and makes new indexes # so we look for the new index of the current song on load - current_song_filepath = self.get_current_song_filepath() - debug(f"load_music_table() | current filepath: {current_song_filepath}") - for row in range(self.model2.rowCount()): - real_index = self.model2.index( - row, self.headers.user_fields.index("filepath") - ) - if real_index.data() == current_song_filepath: - self.current_song_qmodel_index = real_index + # current_song_filepath = self.get_current_song_filepath() + # debug(f"load_music_table() | current filepath: {current_song_filepath}") + # for row in range(self.model2.rowCount()): + # real_index = self.model2.index( + # row, self.headers.user_fields.index("filepath") + # ) + # if real_index.data() == current_song_filepath: + # self.current_song_qmodel_index = real_index self.model2.layoutChanged.emit() # emits a signal that the view should be updated db_name: str = self.config.get("settings", "db").split("/").pop() diff --git a/main.py b/main.py index dd3b2b0..402bb3d 100644 --- a/main.py +++ b/main.py @@ -85,7 +85,7 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow): # UI self.setupUi(self) self.setWindowTitle("musicpom") - self.setup_fonts() + self.setup_labels() # self.vLayoutAlbumArt.SetFixedSize() self.status_bar: QStatusBar = QStatusBar() @@ -360,8 +360,8 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow): # | | # |____________________| - def setup_fonts(self): - """Initializes font sizes and behaviors for various UI components""" + def setup_labels(self): + """Initializes attributes and behaviors for various UI labels""" font: QFont = QFont() font.setPointSize(12) font.setBold(True) @@ -370,6 +370,8 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow): self.artistLabel.setTextInteractionFlags( QtCore.Qt.TextInteractionFlag.TextSelectableByMouse ) + self.artistLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.artistLabel.setWordWrap(True) font.setPointSize(12) font.setBold(False) @@ -377,13 +379,18 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow): self.titleLabel.setTextInteractionFlags( QtCore.Qt.TextInteractionFlag.TextSelectableByMouse ) + self.titleLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.titleLabel.setWordWrap(True) font.setPointSize(12) font.setItalic(True) + self.albumLabel: QLabel self.albumLabel.setFont(font) self.albumLabel.setTextInteractionFlags( QtCore.Qt.TextInteractionFlag.TextSelectableByMouse ) + self.albumLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.albumLabel.setWordWrap(True) def load_config(self) -> None: """does what it says"""