Skip to content

Commit

Permalink
use plugin name instead of class name when referring to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Mar 19, 2024
1 parent 33acdea commit 3815c55
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jdaviz/core/template_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ def __init__(self, *args, **kwargs):
handler=lambda msg: self._remove_viewer_callbacks(msg.viewer_id))

def new(self):
return self.__class__(app=self.app)
new = self.__class__(app=self.app)
new._plugin_name = self._plugin_name
return new

@property
def app(self):
Expand Down Expand Up @@ -349,6 +351,7 @@ class PluginTemplateMixin(TemplateMixin):
"""
This base class can be inherited by all sidebar/tray plugins to expose common functionality.
"""
_plugin_name = None # noqa overwritten by the registry - won't be populated by plugins instantiated directly
disabled_msg = Unicode("").tag(sync=True)
docs_link = Unicode("").tag(sync=True) # set to non-empty to override value in vue file
docs_description = Unicode("").tag(sync=True) # set to non-empty to override value in vue file
Expand Down Expand Up @@ -3032,7 +3035,7 @@ def not_from_plugin(data):
return data.meta.get('Plugin', None) is None

def not_from_this_plugin(data):
return data.meta.get('Plugin', None) != self.plugin.__class__.__name__
return data.meta.get('Plugin', None) != self.plugin._plugin_name

def not_from_plugin_model_fitting(data):
return data.meta.get('Plugin', None) != 'ModelFitting'
Expand Down Expand Up @@ -3398,7 +3401,7 @@ def _on_label_changed(self, msg={}):

for data in self.app.data_collection:
if self.label == data.label:
if data.meta.get('Plugin', None) == self._plugin.__class__.__name__ or\
if data.meta.get('Plugin', None) == self._plugin._plugin_name or\
data.label in self.label_whitelist_overwrite:
self.label_invalid_msg = ''
self.label_overwrite = True
Expand Down

0 comments on commit 3815c55

Please sign in to comment.