Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed Apr 22, 2024
1 parent 1df3c7d commit 942c656
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 3 additions & 2 deletions picard/coverart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from functools import partial
import traceback

from PyQt6.QtCore import QObject
from PyQt6 import QtCore

from picard import log
from picard.config import get_config
Expand Down Expand Up @@ -220,7 +220,8 @@ def _queue_new(self):

def _message(self, *args, **kwargs):
"""Display message to status bar"""
QObject.tagger.window.set_statusbar_message(*args, **kwargs)
tagger = QtCore.QCoreApplication.instance()
tagger.window.set_statusbar_message(*args, **kwargs)


def _retrieve_coverart(album, metadata, release):
Expand Down
5 changes: 3 additions & 2 deletions picard/coverart/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import shutil
import tempfile

from PyQt6 import QtCore
from PyQt6.QtCore import (
QMutex,
QObject,
QUrl,
)

Expand Down Expand Up @@ -80,7 +80,8 @@ def __init__(self, data, prefix='picard', suffix=''):
self._hash = blake2b(data).hexdigest()
if self._hash not in _datafiles:
(fd, self._filename) = tempfile.mkstemp(prefix=prefix, suffix=suffix)
QObject.tagger.register_cleanup(self.delete_file)
tagger = QtCore.QCoreApplication.instance()
tagger.register_cleanup(self.delete_file)
with os.fdopen(fd, 'wb') as imagefile:
imagefile.write(data)
_datafiles[self._hash] = self._filename
Expand Down
5 changes: 3 additions & 2 deletions picard/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
)
from functools import partial

from PyQt6.QtCore import QObject
from PyQt6 import QtCore

from picard.config import get_config
from picard.mbjson import (
Expand Down Expand Up @@ -346,7 +346,8 @@ def compare_to_release_parts(self, release, weights):
weights['releasetype'])

if 'release-group' in release:
rg = QObject.tagger.get_release_group_by_id(release['release-group']['id'])
tagger = QtCore.QCoreApplication.instance()
rg = tagger.get_release_group_by_id(release['release-group']['id'])
if release['id'] in rg.loaded_albums:
parts.append((1.0, 6))

Expand Down
6 changes: 5 additions & 1 deletion picard/ui/options/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@

import re

from PyQt6 import QtWidgets
from PyQt6 import (
QtCore,
QtWidgets,
)

from picard import log
from picard.config import get_config
Expand All @@ -51,6 +54,7 @@ class OptionsPage(QtWidgets.QWidget):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.tagger = QtCore.QCoreApplication.instance()
self.setStyleSheet(self.STYLESHEET)

# Keep track whether the options page has been destroyed to avoid
Expand Down

0 comments on commit 942c656

Please sign in to comment.