You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ENHANCEMENT] add simple plugin stubs to this repo #12
We need some info/examples on plugin strategies IMHO.
It has become clear to me that we need a bit of info how to do
a visgui plugin
a dh5view plugin
a pymeacquire plugin
Rather than having long doc diatribes I would suggest adding stub templates according to current wisdom to this repo, including adding an example init file with a plugin example for PYMEAcquire and an associated install example. This should encapsulate current best practice and be updated with PYME refinements/changes over time.
I cannot think of a better place than this repo but feel free to suggest alternatives.
Current stub ideas
Here are a couple of stubs that could do with David's input for improvement where necessary, e.g. should some of these be derived from the plugin base class etc?
They could probably show off a little more functionality but this could be a starting point.
I will be happy to create a PR if there is general agreement that is could be a reasonable idea.
dh5view_template_plugin.py:
classMyPlugin:
def__init__(self, dsviewer):
self.dsviewer=dsviewerdsviewer.AddMenuItem('Experimental>MyMenuSection', "Do something", self.OnDoSomething)
defOnDoSomething(self, event):
passdefPlug(dsviewer):
"""Plugs this module into the gui"""MyPlugin(dsviewer)
visgui_template_plugin.py:
# import numpy as npclassMyPlugin:
def__init__(self, visFr):
self.visFr=visFrvisFr.AddMenuItem('Experimental>MyMenuSection', "Do something", self.OnDoSomething)
defOnDoSomething(self, event):
passdefPlug(visFr):
"""Plugs this module into the gui"""MyPlugin(visFr)
PS - If it is thought that it may be better to keep this repo just an empty shell I am happy to create a pyme-plugin-example repo that has some simple examples as described above. Still would not mind some feedback how to properly write these plugins either way.
Great, would be good to get @barentine's view on this as I can either (a) make a PR against this repo or (b) fork this repo into something like pyme-plugin-example that gets the example minimal plugins. The upside would be that it keeps this repo clean but it may also create maintenance issues down the line.
Would certainly be great to get more of this into the formal docs.
I think it's probably helpful to keep stubs somewhere in this repo if we can, otherwise we add maintenance as you say and also it gets harder to see what the advantage is over just looking at another existing plugin.
I'm not a huge fan of an examples folder - it's not a big deal, but I think even our existing pyme-plugin/package_name/plugins/ filetree stuff that we copy into the right location during install_plugin feels a little superfluous and maybe messier than just adding filenames to a dict in install_plugin itself or so which people already have to edit.
As far as where to put the stubs, I could see putting them all in readme.md, or just in an example.py directly in the folder they're supposed to go in so they can just be edited/file renamed like an actual template.
Thanks both for thinking about this/working on it - sorry I'm a bit MIA at the moment - submitting my thesis in a couple weeks.
Activity
csoeller commentedon Mar 27, 2021
PS - If it is thought that it may be better to keep this repo just an empty shell I am happy to create a pyme-plugin-example repo that has some simple examples as described above. Still would not mind some feedback how to properly write these plugins either way.
zacsimile commentedon Mar 28, 2021
I think it makes sense to include a
stubsorexamplesfolder. The alternative is to include these in their respective sections in the docs (e.g. https://python-microscopy.org/doc/ExtendingVisGUI.html and https://python-microscopy.org/doc/ExtendingDsviewer.html). It would be neat if we can also include a PYMEAcquire example.csoeller commentedon Mar 28, 2021
Great, would be good to get @barentine's view on this as I can either (a) make a PR against this repo or (b) fork this repo into something like
pyme-plugin-examplethat gets the example minimal plugins. The upside would be that it keeps this repo clean but it may also create maintenance issues down the line.barentine commentedon Mar 28, 2021
Would certainly be great to get more of this into the formal docs.
I think it's probably helpful to keep stubs somewhere in this repo if we can, otherwise we add maintenance as you say and also it gets harder to see what the advantage is over just looking at another existing plugin.
I'm not a huge fan of an
examplesfolder - it's not a big deal, but I think even our existingpyme-plugin/package_name/plugins/filetree stuff that we copy into the right location duringinstall_pluginfeels a little superfluous and maybe messier than just adding filenames to a dict in install_plugin itself or so which people already have to edit.As far as where to put the stubs, I could see putting them all in readme.md, or just in an
example.pydirectly in the folder they're supposed to go in so they can just be edited/file renamed like an actual template.Thanks both for thinking about this/working on it - sorry I'm a bit MIA at the moment - submitting my thesis in a couple weeks.