For a complete explanation of code to write for each function, or to create a class from scratch, please have a look to IControlWidget and example after.
To create a class for standard QWidget, you can copy/paste this code
Here plugin is exactly the same as simple approach, except that it returns XyzControlWidgetSelector instead of XyzControlWidget.
from openalea.oalab.plugin.control import ControlWidgetSelectorPlugin
from openalea.deploy.shared_data import shared_data
class PluginXyzWidgetSelector(ControlWidgetSelectorPlugin):
controls = ['IXyz'] # Interface name like IInt
edit_shape = ['responsive']
name = 'XyzWidgetSelector'
def __call__(self):
from mypackage.plugins.selectors import XyzControlWidgetSelector
return XyzControlWidgetSelector
See also
See IInt example for real case
All Qt sliders define "value" and "setValue" methods directly compatible with IInt (int), so there is almost nothing to do:
We define also a widget to edit constraints
Now, lets define widget selector to group all classes together :
You can notice in line 11, instruction to set widget to fit to vline shape.
And finally, lets define plugin that links to it.
Warning
All classes can be defined in same file excepted last one. PluginIntWidgetSelector must be defined in a separated file to allow to load only description.
shape supported by a control editor or viewer: