mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-21 20:55:08 +00:00
PICARD-1726: Moved widget deleted detection logic to OptionsPage
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user