small fixes
This commit is contained in:
parent
705407f3a3
commit
b61a18ee03
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
6
ui.py
6
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")
|
||||
|
||||
4
ui.ui
4
ui.ui
@ -19,7 +19,7 @@
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="10,1,1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,10">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@ -281,7 +281,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1152</width>
|
||||
<height>21</height>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
||||
@ -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}"
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user