Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed Apr 22, 2024
1 parent 94e81a5 commit 1df3c7d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 3 additions & 2 deletions picard/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ def convert(self, value):
profiles = None


def setup_config(app, filename=None):
def setup_config(filename=None):
app = QtCore.QCoreApplication.instance()
global config, setting, persist, profiles
if filename is None:
config = Config.from_app(app)
Expand All @@ -477,5 +478,5 @@ def load_new_config(filename=None):
except OSError:
log.error("Failed restoring config file from %s", filename)
return False
setup_config(QtCore.QObject.tagger, config_file)
setup_config(config_file)
return True
2 changes: 1 addition & 1 deletion picard/tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def __init__(self, picard_args, localedir, autoupdate, pipe_handler=None):

super().__init__(sys.argv)
self.__class__.__instance = self
setup_config(self, picard_args.config_file)
setup_config(picard_args.config_file)
config = get_config()
theme.setup(self)

Expand Down
5 changes: 3 additions & 2 deletions picard/ui/filebrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class FileBrowser(QtWidgets.QTreeView):

def __init__(self, parent):
super().__init__(parent)
self.tagger = QtCore.QCoreApplication.instance()
self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
self.setDragEnabled(True)
self.load_selected_files_action = QtGui.QAction(_("&Load selected files"), self)
Expand Down Expand Up @@ -226,7 +227,7 @@ def _get_destination_from_path(self, path):
def load_file_for_item(self, index):
model = self.model()
if not model.isDir(index):
QtCore.QObject.tagger.add_paths([
self.tagger.add_paths([
model.filePath(index)
])

Expand All @@ -235,7 +236,7 @@ def load_selected_files(self):
if not indexes:
return
paths = set(self.model().filePath(index) for index in indexes)
QtCore.QObject.tagger.add_paths(paths)
self.tagger.add_paths(paths)

def move_files_here(self):
indexes = self.selectedIndexes()
Expand Down
5 changes: 3 additions & 2 deletions picard/ui/itemviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def scrollTo(self, index, scrolltype=QtWidgets.QAbstractItemView.ScrollHint.Ensu
def drop_urls(urls, target, move_to_multi_tracks=True):
files = []
new_paths = []
tagger = QtCore.QObject.tagger
tagger = QtCore.QCoreApplication.instance()
for url in urls:
log.debug("Dropped the URL: %r", url.toString(QtCore.QUrl.UrlFormattingOption.RemoveUserInfo))
if url.scheme() == 'file' or not url.scheme():
Expand Down Expand Up @@ -1209,7 +1209,8 @@ def decide_file_icon_info(file):
@staticmethod
def decide_fingerprint_icon_info(file):
if getattr(file, 'acoustid_fingerprint', None):
if QtCore.QObject.tagger.acoustidmanager.is_submitted(file):
tagger = QtCore.QCoreApplication.instance()
if tagger.acoustidmanager.is_submitted(file):
icon = FileItem.icon_fingerprint_gray
tooltip = _("Fingerprint has already been submitted")
else:
Expand Down
3 changes: 2 additions & 1 deletion picard/ui/logview.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ def _verbosity_changed(self, level):
config.setting['log_verbosity'] = level
self.verbosity = level
self._update_verbosity_label()
QtCore.QObject.tagger.set_log_level(level)
tagger = QtCore.QCoreApplication.instance()
tagger.set_log_level(level)
self.display(clear=True)

def _update_verbosity_label(self):
Expand Down
3 changes: 2 additions & 1 deletion picard/ui/searchdialog/album.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ def __init__(self, parent, force_advanced_search=None, existing_album=None):

@staticmethod
def show_releasegroup_search(releasegroup_id, existing_album=None):
tagger = QtCore.QCoreApplication.instance()
dialog = AlbumSearchDialog(
QtCore.QObject.tagger.window,
tagger.window,
force_advanced_search=True,
existing_album=existing_album)
dialog.search("rgid:{0}".format(releasegroup_id))
Expand Down

0 comments on commit 1df3c7d

Please sign in to comment.