From 162472cdeda95e3c5fbaa14476cc14d5b9cbae7c Mon Sep 17 00:00:00 2001 From: Mike Rosengrant Date: Fri, 6 Oct 2023 11:01:43 -0400 Subject: [PATCH 1/2] remove __init__, which is likely cause of Uncaught AttributeError: 'Menu' object has no attribute 'render' --- plugin/RealtimeScoring.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/plugin/RealtimeScoring.py b/plugin/RealtimeScoring.py index fd77206..2f00129 100644 --- a/plugin/RealtimeScoring.py +++ b/plugin/RealtimeScoring.py @@ -16,19 +16,6 @@ class RealtimeScoring(nanome.AsyncPluginInstance): scoring_algorithm = scoring_algo.score_ligands - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.last_update = datetime.now() - self.is_updating = False - # Configurable settings - self.color_negative_score = Color(0, 0, 255, 200) # Blue - self.color_positive_score = Color(255, 0, 0, 200) # Red - self.realtime_enabled = True - # api structures - self.receptor_index = None - self.ligand_residue_indices = [] - self.complex_cache = [] - def start(self): self.menu = MainMenu(self) self.settings = SettingsMenu(self) @@ -47,6 +34,17 @@ def start(self): if custom_data.get('realtime_enabled'): self.realtime_enabled = custom_data.get('realtime_enabled') + self.last_update = datetime.now() + self.is_updating = False + # Configurable settings + self.color_negative_score = Color(0, 0, 255, 200) # Blue + self.color_positive_score = Color(255, 0, 0, 200) # Red + self.realtime_enabled = True + # api structures + self.receptor_index = None + self.ligand_residue_indices = [] + self.complex_cache = [] + @async_callback async def on_run(self): complex_list = await self.request_complex_list() From 9023b31ab0d56d10d8c72334a123b75ebe6f6d07 Mon Sep 17 00:00:00 2001 From: Mike Rosengrant Date: Fri, 6 Oct 2023 12:28:44 -0400 Subject: [PATCH 2/2] make sure defaults are set before custom data added --- plugin/RealtimeScoring.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin/RealtimeScoring.py b/plugin/RealtimeScoring.py index 2f00129..2204177 100644 --- a/plugin/RealtimeScoring.py +++ b/plugin/RealtimeScoring.py @@ -27,6 +27,11 @@ def start(self): except (IndexError, AttributeError): pass + # Default configurable values + self.color_negative_score = Color(0, 0, 255, 200) # Blue + self.color_positive_score = Color(255, 0, 0, 200) # Red + self.realtime_enabled = True + # Configure settings based on custom data added at runtime. if custom_data.get('color_negative_score'): self.color_negative_score = custom_data.get('color_negative_score') if custom_data.get('color_positive_score'): @@ -36,10 +41,6 @@ def start(self): self.last_update = datetime.now() self.is_updating = False - # Configurable settings - self.color_negative_score = Color(0, 0, 255, 200) # Blue - self.color_positive_score = Color(255, 0, 0, 200) # Red - self.realtime_enabled = True # api structures self.receptor_index = None self.ligand_residue_indices = []