# HG changeset patch # User Thierry Florac # Date 1425126800 -3600 # Node ID dfa0508e40550af21d41131fd00b3f0cf5f4a4e8 # Parent 7a0b409fd4b8ef270e3e69f466e57bd86da5aec2 Changed inner and widget form interfaces diff -r 7a0b409fd4b8 -r dfa0508e4055 src/pyams_form/interfaces/form.py --- a/src/pyams_form/interfaces/form.py Thu Feb 19 10:55:46 2015 +0100 +++ b/src/pyams_form/interfaces/form.py Sat Feb 28 13:33:20 2015 +0100 @@ -9,7 +9,6 @@ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # -from pyams_template.template import template_config __docformat__ = 'restructuredtext' @@ -21,9 +20,11 @@ from z3c.form.interfaces import INPUT_MODE, ISubForm, IWidget, IFormLayer as IBaseFormLayer, ISubmitWidget from zope.interface.interfaces import IObjectEvent, ObjectEvent from zope.lifecycleevent.interfaces import IObjectCreatedEvent, IObjectModifiedEvent +from zope.schema.interfaces import IField # import packages from pyams_form.schema import ResetButton, CloseButton +from pyams_template.template import template_config from z3c.form import button from zope.interface import implementer, Interface, Attribute from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent @@ -169,6 +170,9 @@ widgets = List(title="Group's widgets list", value_type=Object(schema=IWidget)) + bordered = Bool(title="Bordered fieldset", + required=False) + legend = TextLine(title="Group legend", required=False) @@ -187,10 +191,12 @@ required=True, default=False) - checkbox_field = TextLine(title="Field name matching switch checkbox?", - required=False) + checkbox_field = Object(title="Field name matching switch checkbox", + schema=Interface, + required=False) - checkbox_widget = Object(schema=IWidget, + checkbox_widget = Object(title="Checkbox switch widget", + schema=IWidget, required=False, readonly=True) @@ -229,11 +235,35 @@ required=True) -class IInnerSubForm(ISubForm): +# +# Inner form interfaces +# + +@template_config(template='../templates/inner-form.pt', layer=IFormLayer) +class IInnerForm(IForm): + """Inner form marker interface""" + + parent_form = Object(title="Parent form", + schema=IForm) + + +@template_config(template='../templates/widget-form.pt', layer=IFormLayer) +class IWidgetForm(IForm): + """Widget form marker interface""" + + widget_icon_class = TextLine(title="Widget icon class", + default="fa fa-edit") + + +# +# Sub-forms interfaces +# + +class IInnerSubForm(IInnerForm, ISubForm): """Inner sub-form interface""" -class IInnerTabForm(ISubForm): +class IInnerTabForm(IInnerForm, ISubForm): """Inner tab-form interface""" @@ -352,23 +382,6 @@ # -# Inner form interface -# - -@template_config(template='../templates/inner-form.pt', layer=IFormLayer) -class IInnerForm(Interface): - """Inner form marker interface""" - - -@template_config(template='../templates/widget-form.pt', layer=IFormLayer) -class IWidgetForm(Interface): - """Widget form marker interface""" - - widget_icon_class = TextLine(title="Widget icon class", - default="fa fa-edit") - - -# # Form buttons widgets #