Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.submit_acoustid_action.setStatusTip(_("Submit acoustic fingerprints"))
self.submit_acoustid_action.setEnabled(False)
self.submit_acoustid_action.triggered.connect(self._on_submit_acoustid)
self.exit_action = QtWidgets.QAction(_("E&xit"), self)
self.exit_action.setMenuRole(QtWidgets.QAction.QuitRole)
# TR: Keyboard shortcut for "Exit"
self.exit_action.setShortcut(QtGui.QKeySequence(_("Ctrl+Q")))
self.exit_action.triggered.connect(self.close)
self.remove_action = QtWidgets.QAction(icontheme.lookup('list-remove'), _("&Remove"), self)
self.remove_action.setStatusTip(_("Remove selected files/albums"))
self.remove_action.setEnabled(False)
self.remove_action.triggered.connect(self.remove)
self.browser_lookup_action = QtWidgets.QAction(icontheme.lookup('lookup-musicbrainz'), _("Lookup in &Browser"), self)
self.browser_lookup_action.setStatusTip(_("Lookup selected item on MusicBrainz website"))
self.browser_lookup_action.setEnabled(False)
# TR: Keyboard shortcut for "Lookup in Browser"
self.browser_lookup_action.setShortcut(QtGui.QKeySequence(_("Ctrl+Shift+L")))
self.browser_lookup_action.triggered.connect(self.browser_lookup)
self.album_search_action = QtWidgets.QAction(icontheme.lookup('system-search'), _("Search for similar albums..."), self)
self.album_search_action.setStatusTip(_("View similar releases and optionally choose a different release"))
self.album_search_action.triggered.connect(self.show_more_albums)
self.track_search_action = QtWidgets.QAction(icontheme.lookup('system-search'), _("Search for similar tracks..."), self)
self.track_search_action.setStatusTip(_("View similar tracks and optionally choose a different release"))
self.track_search_action.triggered.connect(self.show_more_tracks)
self.show_file_browser_action = QtWidgets.QAction(_("File &Browser"), self)
self.show_file_browser_action.setCheckable(True)
self.show_file_browser_action.setShortcut(QtGui.QKeySequence(_("Ctrl+B")))
self.show_file_browser_action.triggered.connect(self.show_file_browser)
self.show_cover_art_action = QtWidgets.QAction(_("&Cover Art"), self)
self.show_cover_art_action.setCheckable(True)
if config.persist["view_cover_art"]:
self.show_cover_art_action.setChecked(True)
self.show_cover_art_action.triggered.connect(self.show_cover_art)
self.show_toolbar_action = QtWidgets.QAction(_("&Actions"), self)
self.show_toolbar_action.setCheckable(True)
if config.persist["view_toolbar"]:
self.show_toolbar_action.setChecked(True)
self.show_toolbar_action.triggered.connect(self.show_toolbar)
self.search_action = QtWidgets.QAction(icontheme.lookup('system-search'), _("Search"), self)
self.search_action.setEnabled(False)
self.search_action.triggered.connect(self.search)
self.cd_lookup_action = QtWidgets.QAction(icontheme.lookup('media-optical'), _("Lookup &CD..."), self)
self.cd_lookup_action.setStatusTip(_("Lookup the details of the CD in your drive"))
# TR: Keyboard shortcut for "Lookup CD"
self.cd_lookup_action.setShortcut(QtGui.QKeySequence(_("Ctrl+K")))
self.cd_lookup_action.triggered.connect(self.tagger.lookup_cd)
self.cd_lookup_menu = QtWidgets.QMenu(_("Lookup &CD..."))
self.cd_lookup_menu.triggered.connect(self.tagger.lookup_cd)
self.cd_lookup_action.setEnabled(False)
if discid is None:
log.warning("CDROM: discid library not found - Lookup CD functionality disabled")
else:
thread.run_task(get_cdrom_drives, self._update_cd_lookup_actions)
def create_icons(self):
if hasattr(QtWidgets.QStyle, 'SP_DirIcon'):
ClusterItem.icon_dir = self.style().standardIcon(QtWidgets.QStyle.SP_DirIcon)
else:
ClusterItem.icon_dir = icontheme.lookup('folder', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd = icontheme.lookup('media-optical', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd_modified = icontheme.lookup('media-optical-modified', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd_saved = icontheme.lookup('media-optical-saved', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd_saved_modified = icontheme.lookup('media-optical-saved-modified',
icontheme.ICON_SIZE_MENU)
AlbumItem.icon_error = icontheme.lookup('media-optical-error', icontheme.ICON_SIZE_MENU)
TrackItem.icon_audio = QtGui.QIcon(":/images/track-audio.png")
TrackItem.icon_video = QtGui.QIcon(":/images/track-video.png")
TrackItem.icon_data = QtGui.QIcon(":/images/track-data.png")
TrackItem.icon_error = icontheme.lookup('dialog-error', icontheme.ICON_SIZE_MENU)
FileItem.icon_file = QtGui.QIcon(":/images/file.png")
FileItem.icon_file_pending = QtGui.QIcon(":/images/file-pending.png")
FileItem.icon_error = icontheme.lookup('dialog-error', icontheme.ICON_SIZE_MENU)
FileItem.icon_saved = QtGui.QIcon(":/images/track-saved.png")
FileItem.match_icons = [
QtGui.QIcon(":/images/match-50.png"),
QtGui.QIcon(":/images/match-60.png"),
QtGui.QIcon(":/images/match-70.png"),
QtGui.QIcon(":/images/match-80.png"),
QtGui.QIcon(":/images/match-90.png"),
self.analyze_action = QtWidgets.QAction(icontheme.lookup('picard-analyze'), _("&Scan"), self)
self.analyze_action.setStatusTip(_("Use AcoustID audio fingerprint to identify the files by the actual music, even if they have no metadata"))
self.analyze_action.setEnabled(False)
self.analyze_action.setToolTip(_('Identify the file using its AcoustID audio fingerprint'))
# TR: Keyboard shortcut for "Analyze"
self.analyze_action.setShortcut(QtGui.QKeySequence(_("Ctrl+Y")))
self.analyze_action.triggered.connect(self.analyze)
self.cluster_action = QtWidgets.QAction(icontheme.lookup('picard-cluster'), _("Cl&uster"), self)
self.cluster_action.setStatusTip(_("Cluster files into album clusters"))
self.cluster_action.setEnabled(False)
# TR: Keyboard shortcut for "Cluster"
self.cluster_action.setShortcut(QtGui.QKeySequence(_("Ctrl+U")))
self.cluster_action.triggered.connect(self.cluster)
self.autotag_action = QtWidgets.QAction(icontheme.lookup('picard-auto-tag'), _("&Lookup"), self)
tip = _("Lookup selected items in MusicBrainz")
self.autotag_action.setToolTip(tip)
self.autotag_action.setStatusTip(tip)
self.autotag_action.setEnabled(False)
# TR: Keyboard shortcut for "Lookup"
self.autotag_action.setShortcut(QtGui.QKeySequence(_("Ctrl+L")))
self.autotag_action.triggered.connect(self.autotag)
self.view_info_action = QtWidgets.QAction(icontheme.lookup('picard-edit-tags'), _("&Info..."), self)
self.view_info_action.setEnabled(False)
# TR: Keyboard shortcut for "Info"
self.view_info_action.setShortcut(QtGui.QKeySequence(_("Ctrl+I")))
self.view_info_action.triggered.connect(self.view_info)
self.refresh_action = QtWidgets.QAction(icontheme.lookup('view-refresh', icontheme.ICON_SIZE_MENU), _("&Refresh"), self)
self.refresh_action.setShortcut(QtGui.QKeySequence(_("Ctrl+R")))
self.view_log_action = QtWidgets.QAction(_("View &Error/Debug Log"), self)
self.view_log_action.triggered.connect(self.show_log)
# TR: Keyboard shortcut for "View Error/Debug Log"
self.view_log_action.setShortcut(QtGui.QKeySequence(_("Ctrl+E")))
self.view_history_action = QtWidgets.QAction(_("View Activity &History"), self)
self.view_history_action.triggered.connect(self.show_history)
# TR: Keyboard shortcut for "View Activity History"
self.view_history_action.setShortcut(QtGui.QKeySequence(_("Ctrl+H")))
webservice_manager = self.tagger.webservice.manager
webservice_manager.authenticationRequired.connect(self.show_password_dialog)
webservice_manager.proxyAuthenticationRequired.connect(self.show_proxy_dialog)
self.play_file_action = QtWidgets.QAction(icontheme.lookup('play-music'), _("Open in &Player"), self)
self.play_file_action.setStatusTip(_("Play the file in your default media player"))
self.play_file_action.setEnabled(False)
self.play_file_action.triggered.connect(self.play_file)
self.open_folder_action = QtWidgets.QAction(icontheme.lookup('folder', icontheme.ICON_SIZE_MENU), _("Open Containing &Folder"), self)
self.open_folder_action.setStatusTip(_("Open the containing folder in your file explorer"))
self.open_folder_action.setEnabled(False)
self.open_folder_action.triggered.connect(self.open_folder)
if self.tagger.autoupdate_enabled:
self.check_update_action = QtWidgets.QAction(_("&Check for Update…"), self)
self.check_update_action.setMenuRole(QtWidgets.QAction.ApplicationSpecificRole)
self.check_update_action.triggered.connect(self.do_update_check)
def create_icons(self):
if hasattr(QtWidgets.QStyle, 'SP_DirIcon'):
ClusterItem.icon_dir = self.style().standardIcon(QtWidgets.QStyle.SP_DirIcon)
else:
ClusterItem.icon_dir = icontheme.lookup('folder', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd = icontheme.lookup('media-optical', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd_modified = icontheme.lookup('media-optical-modified', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd_saved = icontheme.lookup('media-optical-saved', icontheme.ICON_SIZE_MENU)
AlbumItem.icon_cd_saved_modified = icontheme.lookup('media-optical-saved-modified',
icontheme.ICON_SIZE_MENU)
AlbumItem.icon_error = icontheme.lookup('media-optical-error', icontheme.ICON_SIZE_MENU)
TrackItem.icon_audio = QtGui.QIcon(":/images/track-audio.png")
TrackItem.icon_video = QtGui.QIcon(":/images/track-video.png")
TrackItem.icon_data = QtGui.QIcon(":/images/track-data.png")
TrackItem.icon_error = icontheme.lookup('dialog-error', icontheme.ICON_SIZE_MENU)
FileItem.icon_file = QtGui.QIcon(":/images/file.png")
FileItem.icon_file_pending = QtGui.QIcon(":/images/file-pending.png")
FileItem.icon_error = icontheme.lookup('dialog-error', icontheme.ICON_SIZE_MENU)
FileItem.icon_saved = QtGui.QIcon(":/images/track-saved.png")
FileItem.match_icons = [
QtGui.QIcon(":/images/match-50.png"),
QtGui.QIcon(":/images/match-60.png"),
QtGui.QIcon(":/images/match-70.png"),
QtGui.QIcon(":/images/match-80.png"),
QtGui.QIcon(":/images/match-90.png"),
QtGui.QIcon(":/images/match-100.png"),
]
self.cd_lookup_menu.triggered.connect(self.tagger.lookup_cd)
self.cd_lookup_action.setEnabled(False)
if discid is None:
log.warning("CDROM: discid library not found - Lookup CD functionality disabled")
else:
thread.run_task(get_cdrom_drives, self._update_cd_lookup_actions)
self.analyze_action = QtWidgets.QAction(icontheme.lookup('picard-analyze'), _("&Scan"), self)
self.analyze_action.setStatusTip(_("Use AcoustID audio fingerprint to identify the files by the actual music, even if they have no metadata"))
self.analyze_action.setEnabled(False)
self.analyze_action.setToolTip(_('Identify the file using its AcoustID audio fingerprint'))
# TR: Keyboard shortcut for "Analyze"
self.analyze_action.setShortcut(QtGui.QKeySequence(_("Ctrl+Y")))
self.analyze_action.triggered.connect(self.analyze)
self.cluster_action = QtWidgets.QAction(icontheme.lookup('picard-cluster'), _("Cl&uster"), self)
self.cluster_action.setStatusTip(_("Cluster files into album clusters"))
self.cluster_action.setEnabled(False)
# TR: Keyboard shortcut for "Cluster"
self.cluster_action.setShortcut(QtGui.QKeySequence(_("Ctrl+U")))
self.cluster_action.triggered.connect(self.cluster)
self.autotag_action = QtWidgets.QAction(icontheme.lookup('picard-auto-tag'), _("&Lookup"), self)
tip = _("Lookup selected items in MusicBrainz")
self.autotag_action.setToolTip(tip)
self.autotag_action.setStatusTip(tip)
self.autotag_action.setEnabled(False)
# TR: Keyboard shortcut for "Lookup"
self.autotag_action.setShortcut(QtGui.QKeySequence(_("Ctrl+L")))
self.autotag_action.triggered.connect(self.autotag)
self.view_info_action = QtWidgets.QAction(icontheme.lookup('picard-edit-tags'), _("&Info..."), self)
self.save_action.setShortcut(QtGui.QKeySequence.Save)
self.save_action.setEnabled(False)
self.save_action.triggered.connect(self.save)
self.submit_acoustid_action = QtWidgets.QAction(icontheme.lookup('acoustid-fingerprinter'), _("S&ubmit AcoustIDs"), self)
self.submit_acoustid_action.setStatusTip(_("Submit acoustic fingerprints"))
self.submit_acoustid_action.setEnabled(False)
self.submit_acoustid_action.triggered.connect(self._on_submit_acoustid)
self.exit_action = QtWidgets.QAction(_("E&xit"), self)
self.exit_action.setMenuRole(QtWidgets.QAction.QuitRole)
# TR: Keyboard shortcut for "Exit"
self.exit_action.setShortcut(QtGui.QKeySequence(_("Ctrl+Q")))
self.exit_action.triggered.connect(self.close)
self.remove_action = QtWidgets.QAction(icontheme.lookup('list-remove'), _("&Remove"), self)
self.remove_action.setStatusTip(_("Remove selected files/albums"))
self.remove_action.setEnabled(False)
self.remove_action.triggered.connect(self.remove)
self.browser_lookup_action = QtWidgets.QAction(icontheme.lookup('lookup-musicbrainz'), _("Lookup in &Browser"), self)
self.browser_lookup_action.setStatusTip(_("Lookup selected item on MusicBrainz website"))
self.browser_lookup_action.setEnabled(False)
# TR: Keyboard shortcut for "Lookup in Browser"
self.browser_lookup_action.setShortcut(QtGui.QKeySequence(_("Ctrl+Shift+L")))
self.browser_lookup_action.triggered.connect(self.browser_lookup)
self.album_search_action = QtWidgets.QAction(icontheme.lookup('system-search'), _("Search for similar albums..."), self)
self.album_search_action.setStatusTip(_("View similar releases and optionally choose a different release"))
self.album_search_action.triggered.connect(self.show_more_albums)
self.track_search_action = QtWidgets.QAction(icontheme.lookup('system-search'), _("Search for similar tracks..."), self)
def __init__(self, parent):
super().__init__(parent)
self.search_action = QtWidgets.QAction(icontheme.lookup('system-search'),
_("Search"), self)
self.search_action.setEnabled(False)
self.search_action.triggered.connect(self.search)
self.setupUi()