diff --git a/picard/ui/options/__init__.py b/picard/ui/options/__init__.py index ff2171c2d..ee024891a 100644 --- a/picard/ui/options/__init__.py +++ b/picard/ui/options/__init__.py @@ -44,6 +44,16 @@ class OptionsPage(QtWidgets.QWidget): super().__init__(*args, **kwargs) self.setStyleSheet(self.STYLESHEET) + # Keep track whether the options page has been destroyed to avoid + # trying to update deleted UI widgets after plugin list refresh. + self.deleted = False + + # The on destroyed cannot be created as a method on this class or it will never get called. + # See https://stackoverflow.com/questions/16842955/widgets-destroyed-signal-is-not-fired-pyqt + def on_destroyed(obj=None): + self.deleted = True + self.destroyed.connect(on_destroyed) + def check(self): pass diff --git a/picard/ui/options/plugins.py b/picard/ui/options/plugins.py index ec45b6f27..98f41631f 100644 --- a/picard/ui/options/plugins.py +++ b/picard/ui/options/plugins.py @@ -235,16 +235,6 @@ class PluginsOptionsPage(OptionsPage): self.ui.folder_open.clicked.connect(self.open_plugin_dir) self.ui.reload_list_of_plugins.clicked.connect(self.reload_list_of_plugins) - # Keep track whether the object has been destroyed to avoid trying to update - # deleted UI widgets after plugin list refresh. - self._deleted = False - - # The on destroyed cannot be created as a method on this class or it will never get called. - # See https://stackoverflow.com/questions/16842955/widgets-destroyed-signal-is-not-fired-pyqt - def on_destroyed(obj=None): - self._deleted = True - self.destroyed.connect(on_destroyed) - self.manager = self.tagger.pluginmanager self.manager.plugin_installed.connect(self.plugin_installed) self.manager.plugin_updated.connect(self.plugin_updated) @@ -383,7 +373,7 @@ class PluginsOptionsPage(OptionsPage): self.set_current_item(item, scroll=True) def _reload(self): - if self._deleted: + if self.deleted: return self._remove_all() self._populate()