mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-22 13:15:13 +00:00
PICARD-1624: Update default CD lookup shortcut on option save
This ensures the CD lookup keyboard shortcut uses the correct CD drive if the user changed it in options.
This commit is contained in:
@@ -565,14 +565,18 @@ class MainWindow(QtWidgets.QMainWindow, PreserveGeometry):
|
||||
self.check_update_action.triggered.connect(self.do_update_check)
|
||||
|
||||
def _update_cd_lookup_actions(self, result=None, error=None):
|
||||
drives = result
|
||||
if error:
|
||||
log.error("CDROM: Error on CD-ROM drive detection: %r", error)
|
||||
elif not drives:
|
||||
else:
|
||||
self.update_cd_lookup_drives(result)
|
||||
|
||||
def update_cd_lookup_drives(self, drives):
|
||||
if not drives:
|
||||
log.warning("CDROM: No CD-ROM drives found - Lookup CD functionality disabled")
|
||||
else:
|
||||
shortcut_drive = config.setting["cd_lookup_device"].split(",")[0] if len(drives) > 1 else ""
|
||||
self.cd_lookup_action.setEnabled(True)
|
||||
self.cd_lookup_action.setEnabled(discid is not None)
|
||||
self.cd_lookup_menu.clear()
|
||||
for drive in drives:
|
||||
action = self.cd_lookup_menu.addAction(drive)
|
||||
action.setData(drive)
|
||||
|
||||
@@ -72,6 +72,7 @@ class CDLookupOptionsPage(OptionsPage):
|
||||
config.setting["cd_lookup_device"] = self.ui.cd_lookup_device.currentText()
|
||||
else:
|
||||
config.setting["cd_lookup_device"] = self.ui.cd_lookup_device.text()
|
||||
self.tagger.window.update_cd_lookup_drives(self.drives)
|
||||
|
||||
|
||||
register_options_page(CDLookupOptionsPage)
|
||||
|
||||
Reference in New Issue
Block a user