-
Notifications
You must be signed in to change notification settings - Fork 9
Fixed changed class names in custom viewer docs #32
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like TutorialViewerState
was previously MyExampleState
and this line didn't get updated when renaming. We need to access linestyle
through the class in order to set the choices - self.linestyle
will just return the current linestyle
value, but TutorialViewerState.linestyle
will give us the SelectionCallbackProperty
object.
@@ -149,7 +149,7 @@ which should be used as follows:: | |||
|
|||
def __init__(self, *args, **kwargs): | |||
super(TutorialViewerState).__init__(*args, **kwargs) | |||
MyExampleState.linestyle.set_choices(['solid', 'dashed', 'dotted']) | |||
self.linestyle.set_choices(['solid', 'dashed', 'dotted']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.linestyle.set_choices(['solid', 'dashed', 'dotted']) | |
TutorialViewerState.linestyle.set_choices(['solid', 'dashed', 'dotted']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the proposed fix fails for me because self.linestyle
is a just initialised SelectionCallbackProperty()
here.
The equivalent in existing classes seems to be
https://github.com/glue-viz/glue/blob/f933d4bb69395c986ef1e2b3ec6ef0e64d422aea/glue/viewers/scatter/state.py#L319
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be another similar leftover further down at
glue-qt/doc/customizing_guide/viewer.rst
Lines 239 to 245 in fe1868d
class TutorialLayerArtist(LayerArtist): | |
_layer_artist_cls = TutorialLayerState | |
def __init__(self, *args, **kwargs): | |
super(MyLayerArtist, self).__init__(*args, **kwargs) | |
self.state.add_callback('fill', self._on_fill_change) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmorris3 would you have time to make the change to super(TutorialLayerArtist, self)
there as well, along with @Carifio24's suggestion? Then we could get this fixed in the same PR.
Description
In the custom viewer docs, there's a reference to a variable that's never defined. It looks like a holdover/typo. I revised the line with my best-guess at what I think belongs there, correct me if I'm wrong.