Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge __init__ in start() function #17

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions plugin/RealtimeScoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -40,13 +27,25 @@ 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'):
self.color_positive_score = custom_data.get('color_positive_score')
if custom_data.get('realtime_enabled'):
self.realtime_enabled = custom_data.get('realtime_enabled')

self.last_update = datetime.now()
self.is_updating = False
# 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()
Expand Down
Loading