from flatland import Form, Dict, String, Integer, Boolean
from flatland.validation import ValueAtLeast, ValueAtMost
from pygtkhelpers.forms import FormView
class PersonSchema(Form):
name = String
age = Integer.using(validators=[
ValueAtLeast(minimum=18),
ValueAtMost(maximum=120)
])
weight = Integer.using(validators=[
ValueAtLeast(minimum=0),
ValueAtMost(maximum=300)
])
weight.render_options = dict(
style='slider'
)
friendly = Boolean
address = String.using()
address.render_options = dict(
style='multiline'
)
happy = Boolean.using()
happy.render_options = dict(
style='toggle'
)
class PersonView(FormView):
schema_type = PersonSchema
if __name__ == '__main__':
PersonView().show_and_run()
Providing specialized delegates that can be used to map and validate against schemas. Validation and schema support is provided by Flatland_.
copyright: | 2005-2008 by pygtkhelpers Authors |
---|---|
license: | LGPL 2 or later (see README/COPYING/LICENSE) |
Encapsulates the widget and the label display
A specialized delegate that adds widget proxying and schema support
Defer widget building to allow post-configuration
Map of flatland element types to view types
map of view types to flatland element types
Create a widget for a schema item