-
Notifications
You must be signed in to change notification settings - Fork 2
Description
The suggestion
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:
class MyPlugin:
def __init__(self, dsviewer):
self.dsviewer = dsviewer
dsviewer.AddMenuItem('Experimental>MyMenuSection', "Do something", self.OnDoSomething)
def OnDoSomething(self, event):
pass
def Plug(dsviewer):
"""Plugs this module into the gui"""
MyPlugin(dsviewer)visgui_template_plugin.py:
# import numpy as np
class MyPlugin:
def __init__(self, visFr):
self.visFr = visFr
visFr.AddMenuItem('Experimental>MyMenuSection', "Do something", self.OnDoSomething)
def OnDoSomething(self, event):
pass
def Plug(visFr):
"""Plugs this module into the gui"""
MyPlugin(visFr)