diff --git a/components/AddToPlaylistWindow.py b/components/AddToPlaylistWindow.py index af82ea6..1eff26a 100644 --- a/components/AddToPlaylistWindow.py +++ b/components/AddToPlaylistWindow.py @@ -15,6 +15,10 @@ import logging class AddToPlaylistWindow(QDialog): + """ + Dialog box to choose what playlist to add the selected files to + """ + def __init__(self, song_db_ids: list): super(AddToPlaylistWindow, self).__init__() self.song_db_ids = song_db_ids diff --git a/components/AlbumArtGraphicsView.py b/components/AlbumArtGraphicsView.py index fffd881..8fa6a07 100644 --- a/components/AlbumArtGraphicsView.py +++ b/components/AlbumArtGraphicsView.py @@ -2,10 +2,20 @@ import os import tempfile from PyQt5.QtWidgets import QGraphicsScene, QGraphicsView, QMenu, QAction from PyQt5.QtCore import QEvent, Qt, pyqtSignal, QUrl, QPoint -from PyQt5.QtGui import QDragEnterEvent, QDropEvent, QClipboard, QPixmap +from PyQt5.QtGui import ( + QDragEnterEvent, + QDragMoveEvent, + QDropEvent, + QClipboard, + QPixmap, +) class AlbumArtGraphicsView(QGraphicsView): + """ + Displays the album art of the currently playing song + """ + albumArtDropped = pyqtSignal(str) albumArtDeleted = pyqtSignal(str) @@ -15,21 +25,22 @@ class AlbumArtGraphicsView(QGraphicsView): self.setContextMenuPolicy(Qt.CustomContextMenu) self.scene = QGraphicsScene self.customContextMenuRequested.connect(self.showContextMenu) - self.qapp = None - def dragEnterEvent(self, event): + def dragEnterEvent(self, event: QDragEnterEvent | None): + if not event: + return if event.mimeData().hasUrls(): event.accept() else: event.ignore() - def dragMoveEvent(self, event): + def dragMoveEvent(self, event: QDragMoveEvent | None): if event.mimeData().hasUrls(): event.accept() else: event.ignore() - def dropEvent(self, event): + def dropEvent(self, event: QDropEvent | None): """Handles drag and drop pic onto view to add album art to songs""" urls = event.mimeData().urls() if urls: diff --git a/components/PreferencesWindow.py b/components/PreferencesWindow.py index 7c9c035..2fca613 100644 --- a/components/PreferencesWindow.py +++ b/components/PreferencesWindow.py @@ -14,7 +14,7 @@ class PreferencesWindow(QDialog): def __init__(self, config): super(PreferencesWindow, self).__init__() self.setWindowTitle("Preferences") - self.setMinimumSize(400, 400) + self.setMinimumSize(400, 800) self.config = config layout = QVBoxLayout() diff --git a/ui.py b/ui.py index e71b36a..427d969 100644 --- a/ui.py +++ b/ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'ui.ui' # -# Created by: PyQt5 UI code generator 5.15.9 +# Created by: PyQt5 UI code generator 5.15.10 # # 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. @@ -120,6 +120,8 @@ class Ui_MainWindow(object): self.hLayoutMusicTable.setStretch(0, 2) self.hLayoutMusicTable.setStretch(1, 10) self.verticalLayout.addLayout(self.hLayoutMusicTable) + self.verticalLayout.setStretch(0, 1) + self.verticalLayout.setStretch(1, 10) self.verticalLayout_3.addLayout(self.verticalLayout) self.hLayoutControls = QtWidgets.QHBoxLayout() self.hLayoutControls.setSpacing(6) @@ -158,7 +160,7 @@ class Ui_MainWindow(object): self.verticalLayout_3.setStretch(2, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 21)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1152, 41)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") diff --git a/ui.ui b/ui.ui index 6de475e..7609c9f 100644 --- a/ui.ui +++ b/ui.ui @@ -19,7 +19,7 @@ - + 6 @@ -281,7 +281,7 @@ 0 0 1152 - 21 + 41 diff --git a/utils/batch_delete_filepaths_from_database.py b/utils/batch_delete_filepaths_from_database.py index 46b576c..48e4d9d 100644 --- a/utils/batch_delete_filepaths_from_database.py +++ b/utils/batch_delete_filepaths_from_database.py @@ -1,4 +1,5 @@ import DBA +import logging from components.ErrorDialog import ErrorDialog @@ -8,6 +9,10 @@ def batch_delete_filepaths_from_database( """ Handles deleting many songs from the database by filepath Accounts for playlists and other song-linked tables + Args: + files: a list of absolute filepaths to songs + chunk_size: how many files to process at once in DB + progress_callback: emit this signal for user feedback Returns True on success False on failure/error @@ -20,6 +25,9 @@ def batch_delete_filepaths_from_database( result = db.query(query, files) song_ids = [item[0] for item in result] except Exception as e: + logging.error( + f"batch_delete_filepaths_from_database.py | An error occurred during retrieval of song_ids: {e}" + ) dialog = ErrorDialog( f"batch_delete_filepaths_from_database.py | An error occurred during retrieval of song_ids: {e}" ) @@ -42,6 +50,9 @@ def batch_delete_filepaths_from_database( if progress_callback: progress_callback.emit(f"Deleting songs: {i}") except Exception as e: + logging.error( + f"batch_delete_filepaths_from_database.py | An error occurred during batch processing: {e}" + ) dialog = ErrorDialog( f"batch_delete_filepaths_from_database.py | An error occurred during batch processing: {e}" )