-
Notifications
You must be signed in to change notification settings - Fork 153
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
Scatter Plot Grouping Plugin #600
Conversation
Ok, so the main issue here seems to be that At the moment you are overloading all of the stuff in
so that it will skip the code in Another thing is that the load_ui call should be given the full path to the file, so:
Finally, you should only inherit from Now obviously, changing the super call is not the proper solution, and a better solution would be that the the ui file is loaded in a method that you can overload, and you then won't need to re-define Now for some reason even with the hacks above the widget to edit the properties is not showing in the left panel, so I can look into that later. But at least it will no longer crash. @ChrisBeaumont - do you agree that the solution is to have |
Ah, it's an easy fix for the options not appearing - the call to
Ok, so to get things to work in the short term:
Once you have that working, you can then try and make it so you don't overload all of |
@astrofrog Thank you for that explanation! I removed the This functionality is awesome and I think we can definitely make use of it for a few 'bio-glue' visualization plugins. |
@@ -0,0 +1,10 @@ | |||
def setup(): | |||
from ...logger import logger |
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.
@astrofrog this logger module is new to me -- is that something you added? Before I was calling logging.getLogger(__name__)
to organize loggers into per-module hierarchies. Is that not needed anymore?
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, I changed it when setting up the lazy loading of modules - the issue I ran into is that I think we really only should have one logger for the whole application otherwise I think it's hard to set the logging level globally - or am I wrong?
In other packages, such as Astropy, we have a single logger but it's still able to display in what sub-pacakge the message occurred. Are there other reasons we might want individual loggers?
Sounds right to me @astrofrog |
add_callback(self, 'xatt', partial(self._set_xydata, 'x')) | ||
add_callback(self, 'yatt', partial(self._set_xydata, 'y')) | ||
add_callback(self, 'gatt', partial(self._set_xydata, 'g')) | ||
add_callback(self, 'jitter', self._jitter) |
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.
Likewise, you can call super() here and just add the callback to gatt
Very Cool! I left a bunch of small comments about using super() to cut down on code duplication, but this is looking great. Since this is bundled as a plugin instead of the main scatter viewer, I'm fine with merging this once its cleaned up. Unless @astrofrog has ideas about whether to put this in this repo or the experimental plugin repo? (I vote that it goes here, until we have an easy GUI way to install plugins from GH within the app). Should we add a piece of documentation somewhere, describing how to enable this? |
@ChrisBeaumont - putting it in the core package plugins is perfectly fine, as it's pretty generic. It would indeed be good to have a section in the docs describing available plugins. I like the idea of having a GUI plugin selector in future! |
@aak65 - thanks for cleaning this up! In general, for this kind of plugin, I wonder whether there might be a way to avoid duplicating the |
Yeah so if you wanted to cut down on duplication in the ui file, the strategy would be to override the function that builds the widget, call super() to construct the standard scatterplot widget, and then add your extra UI on top of that. In this case I think it's only a few extra widgets, so you could do that by instantiating widgets in python directly. Or you could have a (very tiny!) ui file that just adds the extra combo box, call load_ui a second time to build that widget, and then insert it into the right spot. We probably don't want to make the assumption that all plugins can be created in this way |
Ooo I like that we're failing builds where coverage decreases now :) @aak65 if we're going to put this in the main glue repository, we should add some tests |
I'm going to close this since the scatter widget code has now been completely re-written, but hopefully this would be simpler to implement with the new viewer code. @aak65 - if you are interested in porting over your code to the new viewers, just email me or reach out to me on Slack (you can get an invite here: https://glueviz-slack-invite.herokuapp.com/) |
I gave the scatter grouping plugin a shot, but haven't been able to get it to work completely yet. I was hoping you guys may be able to point me in the right direction.
I put everything in a plugin folder, but some parts of it (such as the util.py and the ui file) may belong better somewhere else. The issue I couldn't figure out is how to get the custom ui file to load properly. The extra grouping combo box isn't being seen by QWidget (line 324 in scattergroupwidget.ui).
Also, I put this in my config file:
ps. I'm putting this up as a separate PR because I worked off a fresh branch on this, and I didn't want to mess up the comments and history on the 'grouping' branch.