Skip to content

Commit c4b6392

Browse files
authored
Merge branch 'master' into plugins-v3
2 parents cf256a4 + 6aa68cf commit c4b6392

File tree

240 files changed

+100049
-95152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+100049
-95152
lines changed

.github/workflows/run-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
os: [macos-latest, ubuntu-latest, windows-2019]
11+
os: [macos-12, ubuntu-latest, windows-2019]
1212
python-version: ['3.9', '3.10', '3.11', '3.12']
1313
include:
1414
- os: macos-11
@@ -109,7 +109,7 @@ jobs:
109109
runs-on: ${{ matrix.os }}
110110
strategy:
111111
matrix:
112-
os: [macos-latest, ubuntu-latest, windows-latest]
112+
os: [macos-12, ubuntu-latest, windows-latest]
113113
python-version: ['3.9', '3.12']
114114

115115
steps:

.pylintrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ min-similarity-lines=4
283283

284284
# List of additional names supposed to be defined in builtins. Remember that
285285
# you should avoid defining new builtins when possible.
286-
additional-builtins=_, N_, ngettext, gettext_attributes, pgettext_attributes,
287-
gettext_constants, gettext_countries
286+
additional-builtins=
288287

289288
# Tells whether unused global variables should be treated as a violation.
290289
allow-global-unused-variables=yes

INSTALL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ To uninstall Picard run:
6262
pip3 uninstall picard
6363

6464

65+
Note about Qt6 installed via pip
66+
--------------------------------
67+
68+
If you get errors related to `libxcb` on application startup, you may need to install extra libraries on your system.
69+
70+
Typical error looks like:
71+
72+
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
73+
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
74+
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
75+
76+
77+
In this case, you have to install extra packages system-wide, for example, in this case, on Ubuntu:
78+
79+
sudo apt install libxcb-cursor0
80+
81+
6582
Installation using setup.py
6683
---------------------------
6784

org.musicbrainz.Picard.appdata.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<recommends>
7777
<control>keyboard</control>
7878
<control>pointing</control>
79-
<display_length compare="ge">medium</display_length>
79+
<display_length compare="ge">768</display_length>
8080
<internet>always</internet>
8181
</recommends>
8282

picard/__init__.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Picard, the next-generation MusicBrainz tagger
44
#
55
# Copyright (C) 2006-2008, 2011-2014 Lukáš Lalinský
6-
# Copyright (C) 2009, 2018-2023 Philipp Wolfer
6+
# Copyright (C) 2009, 2018-2024 Philipp Wolfer
77
# Copyright (C) 2012 Chad Wilson
88
# Copyright (C) 2012-2013 Michael Wiencek
99
# Copyright (C) 2013-2024 Laurent Monin
@@ -31,6 +31,7 @@
3131
# along with this program; if not, write to the Free Software
3232
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
3333

34+
import sys
3435

3536
from picard.version import Version
3637

@@ -67,14 +68,12 @@
6768
api_versions_tuple = [Version.from_string(v) for v in api_versions]
6869

6970

70-
def crash_handler():
71+
def crash_handler(exc: Exception = None):
7172
"""Implements minimal handling of an exception crashing the application.
7273
This function tries to log the exception to a log file and display
7374
a minimal crash dialog to the user.
7475
This function is supposed to be called from inside an except blog.
7576
"""
76-
import sys
77-
7877
# Allow disabling the graphical crash handler for debugging and CI purposes.
7978
if set(sys.argv) & {'--no-crash-dialog', '-v', '--version', '-V', '--long-version', '-h', '--help'}:
8079
return
@@ -83,7 +82,14 @@ def crash_handler():
8382
# with minimum chance to fail.
8483
from tempfile import NamedTemporaryFile
8584
import traceback
86-
trace = traceback.format_exc()
85+
if exc:
86+
if sys.version_info < (3, 10):
87+
trace_list = traceback.format_exception(None, exc, exc.__traceback__)
88+
else:
89+
trace_list = traceback.format_exception(exc) # pylint: disable=no-value-for-parameter
90+
trace = "".join(trace_list)
91+
else:
92+
trace = traceback.format_exc()
8793
logfile = None
8894
try:
8995
with NamedTemporaryFile(suffix='.log', prefix='picard-crash-', delete=False) as f:
@@ -124,3 +130,12 @@ def crash_handler():
124130
msgbox.setDefaultButton(QMessageBox.StandardButton.Close)
125131
msgbox.exec()
126132
app.quit()
133+
134+
135+
def register_excepthook():
136+
def _global_exception_handler(exctype, value, traceback):
137+
from picard import crash_handler
138+
crash_handler(exc=value)
139+
sys.__excepthook__(exctype, value, traceback)
140+
141+
sys.excepthook = _global_exception_handler

picard/acoustid/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@
3737
from picard import log
3838
from picard.acoustid.recordings import RecordingResolver
3939
from picard.config import get_config
40-
from picard.const import (
41-
DEFAULT_FPCALC_THREADS,
42-
FPCALC_NAMES,
43-
)
40+
from picard.const import FPCALC_NAMES
41+
from picard.const.defaults import DEFAULT_FPCALC_THREADS
4442
from picard.const.sys import IS_WIN
4543
from picard.file import File
44+
from picard.i18n import N_
4645
from picard.util import (
4746
find_executable,
4847
win_prefix_longpath,
@@ -84,6 +83,7 @@ class AcoustIDClient(QtCore.QObject):
8483

8584
def __init__(self, acoustid_api: AcoustIdAPIHelper):
8685
super().__init__()
86+
self.tagger = QtCore.QCoreApplication.instance()
8787
self._queue = deque()
8888
self._running = 0
8989
self._acoustid_api = acoustid_api

picard/acoustid/manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from PyQt6 import QtCore
3030

3131
from picard import log
32+
from picard.i18n import N_
3233
from picard.util import load_json
3334

3435

@@ -110,6 +111,7 @@ class AcoustIDManager(QtCore.QObject):
110111

111112
def __init__(self, acoustid_api):
112113
super().__init__()
114+
self.tagger = QtCore.QCoreApplication.instance()
113115
self._submissions = {}
114116
self._acoustid_api = acoustid_api
115117

picard/album.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
from picard.const import VARIOUS_ARTISTS_ID
6060
from picard.dataobj import DataObject
6161
from picard.file import File
62+
from picard.i18n import (
63+
N_,
64+
gettext as _,
65+
)
6266
from picard.mbjson import (
6367
medium_to_metadata,
6468
release_group_to_metadata,
@@ -133,6 +137,7 @@ class Album(DataObject, Item):
133137

134138
def __init__(self, album_id, discid=None):
135139
DataObject.__init__(self, album_id)
140+
self.tagger = QtCore.QCoreApplication.instance()
136141
self.metadata = Metadata()
137142
self.orig_metadata = Metadata()
138143
self.tracks = []

picard/browser/addrelease.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from PyQt6.QtCore import QCoreApplication
2929

3030
from picard import log
31+
from picard.i18n import gettext as _
3132
from picard.util import format_time
3233
from picard.util.mbserver import build_submission_url
3334
from picard.util.webbrowser2 import open

picard/browser/filelookup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(self, parent, server, port, local_port):
6262
self.server = server
6363
self.local_port = int(local_port)
6464
self.port = port
65+
self.tagger = QtCore.QCoreApplication.instance()
6566

6667
def _url(self, path, params=None):
6768
if params is None:
@@ -137,10 +138,10 @@ def mbid_lookup(self, string, type_=None, mbid_matched_callback=None, browser_fa
137138
if mbid_matched_callback:
138139
mbid_matched_callback(entity, id)
139140
if entity == 'release':
140-
QtCore.QObject.tagger.load_album(id)
141+
self.tagger.load_album(id)
141142
return True
142143
elif entity == 'recording':
143-
QtCore.QObject.tagger.load_nat(id)
144+
self.tagger.load_nat(id)
144145
return True
145146
elif entity == 'release-group':
146147
AlbumSearchDialog.show_releasegroup_search(id)

0 commit comments

Comments
 (0)