Changeset 4563
- Timestamp:
- 05/07/08 08:06:26 (7 months ago)
- Files:
-
- projects/ToscaWidgetsForms/trunk/docs/base_widgets.rst (deleted)
- projects/ToscaWidgetsForms/trunk/docs/container_widgets.rst (deleted)
- projects/ToscaWidgetsForms/trunk/docs/index.rst (modified) (1 diff)
- projects/ToscaWidgetsForms/trunk/docs/modules/calendar.rst (modified) (1 diff)
- projects/ToscaWidgetsForms/trunk/docs/modules/core.rst (modified) (1 diff)
- projects/ToscaWidgetsForms/trunk/docs/modules/datagrid.rst (modified) (1 diff)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields (added)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields/basic_fields.rst (added)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields/buttons.rst (added)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields/fieldsets.rst (added)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields/forms.rst (added)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields/index.rst (added)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields.rst (deleted)
- projects/ToscaWidgetsForms/trunk/docs/modules/fields/select_fields.rst (added)
- projects/ToscaWidgetsForms/trunk/docs/modules/index.rst (modified) (1 diff)
- projects/ToscaWidgetsForms/trunk/docs/modules/validators.rst (modified) (1 diff)
- projects/ToscaWidgetsForms/trunk/docs/secure_forms.rst (deleted)
- projects/ToscaWidgetsForms/trunk/docs/tutorials/sample_form.rst (modified) (1 diff)
- projects/ToscaWidgetsForms/trunk/docs/widgets.rst (deleted)
- projects/ToscaWidgetsForms/trunk/tw/forms/core.py (modified) (3 diffs)
- projects/ToscaWidgetsForms/trunk/tw/forms/samples.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
projects/ToscaWidgetsForms/trunk/docs/index.rst
r4561 r4563 13 13 14 14 intro 15 widgets15 tutorials/index 16 16 modules/index 17 tutorials/index18 17 19 18 Indices and tables projects/ToscaWidgetsForms/trunk/docs/modules/calendar.rst
r4540 r4563 1 1 .. _calendars_module: 2 2 3 tw.forms.calendars 4 ================== 3 :mod:`tw.forms.calendars` 4 ========================= 5 5 6 6 .. automodule:: tw.forms.calendars 7 :members: 7 8 :class:`CalendarDatePicker` 9 --------------------------- 8 10 11 .. autoclass:: tw.forms.calendars.CalendarDatePicker 12 .. widgetbrowser:: tw.forms.calendars.CalendarDatePicker 13 :size: large 9 14 15 :class:`CalendarDateTimePicker` 16 ------------------------------- 17 18 .. autoclass:: tw.forms.calendars.CalendarDateTimePicker 19 .. widgetbrowser:: tw.forms.calendars.CalendarDateTimePicker 20 :size: large projects/ToscaWidgetsForms/trunk/docs/modules/core.rst
r4540 r4563 1 1 .. _core_module: 2 2 3 tw.forms.core 4 =============== 3 :mod:`tw.forms.core` 4 ==================== 5 5 6 6 .. automodule:: tw.forms.core 7 :members: 7 8 :class:`InputWidget` 9 -------------------- 8 10 11 This is the base class for all widgets that can submit input. It has the 12 machinery to validate and coerce the received data. 13 14 .. autoclass:: tw.forms.core.InputWidget 15 :members: adjust_value, validate, safe_validate, prepare_dict, post_init, name, error_at_request, value_at_request 16 17 18 :class:`InputWidgetRepeater` 19 ---------------------------- 20 21 This is the base class to create repeated InputWidgets. 22 23 .. autoclass:: tw.forms.core.InputWidgetRepeater projects/ToscaWidgetsForms/trunk/docs/modules/datagrid.rst
r4540 r4563 1 1 .. _datagrid_module: 2 2 3 tw.forms.datagrid 4 ================== 3 :mod:`tw.forms.datagrid` 4 ======================== 5 6 Widgets to present data in tabular form 5 7 6 8 .. automodule:: tw.forms.datagrid 7 :members: 9 10 .. autoclass:: tw.forms.datagrid.DataGrid 11 .. widgetbrowser:: tw.forms.samples.DemoDataGrid 12 :size: large projects/ToscaWidgetsForms/trunk/docs/modules/index.rst
r4561 r4563 4 4 ======= 5 5 6 All public symbols are available at :mod:`tw.forms` and should be imported 7 from there. 8 6 9 .. toctree:: 7 :maxdepth: 310 :maxdepth: 2 8 11 9 12 core 10 fields 13 fields/index 11 14 validators 12 15 calendar projects/ToscaWidgetsForms/trunk/docs/modules/validators.rst
r4540 r4563 1 1 .. _validators_module: 2 2 3 tw.forms.validators 4 =================== 3 :mod:`tw.forms.validators` 4 ========================== 5 5 6 6 .. automodule:: tw.forms.validators projects/ToscaWidgetsForms/trunk/docs/tutorials/sample_form.rst
r4540 r4563 7 7 8 8 TODO: Explain how it is built and how it works 9 10 .. literalinclude:: ../../tw/forms/samples.pyprojects/ToscaWidgetsForms/trunk/tw/forms/core.py
r4429 r4563 140 140 141 141 def adjust_value(self,value, validator=None): 142 """ 143 Adjusts the python value sent to :meth:`InputWidget.display` with 144 the validator so it can be rendered in the template. 145 """ 142 146 validator = validator or self.validator 143 147 if validator and ((not isinstance(self.validator, Schema)) or … … 173 177 174 178 def prepare_dict(self, value, kw, adapt=True): 179 """ 180 Prepares the dict sent to the template with functions to access the 181 children's errors if any. 182 """ 175 183 if value is None: 176 184 value = self.get_default() … … 241 249 242 250 def post_init(self, *args, **kw): 251 """Takes care of post-initialization of InputWidgets. 252 253 If the widget has children this method generates a `Schema` to validate 254 including the validators from all children once these are all known. 255 """ 243 256 if _has_child_validators(self) and not isinstance(self, WidgetRepeater): 244 257 if isinstance(self.validator, Schema): projects/ToscaWidgetsForms/trunk/tw/forms/samples.py
r4429 r4563 109 109 alert('The form contains invalid data\n%s'% unicode(d.error)) 110 110 ) 111 112 class DemoSingleSelect(SingleSelectField): 113 options = [ 114 "Python", 115 "Haskell", 116 "Java", 117 "Ruby", 118 "Erlang", 119 "Javascript" 120 ] 121 122 class DemoMultipleSelect(MultipleSelectField): 123 options = [ 124 "Python", 125 "Haskell", 126 "Java", 127 "Ruby", 128 "Erlang", 129 "Javascript" 130 ] 131 132 class DemoCheckBoxList(CheckBoxList): 133 options = [ 134 "Python", 135 "Haskell", 136 "Java", 137 "Ruby", 138 "Erlang", 139 "Javascript" 140 ] 141 142 class DemoRadioButtonList(RadioButtonList): 143 options = [ 144 "Python", 145 "Haskell", 146 "Java", 147 "Ruby", 148 "Erlang", 149 "Javascript" 150 ] 151 152 class DemoCheckBoxTable(CheckBoxTable): 153 num_cols = 2 154 options = [ 155 "Python", 156 "Haskell", 157 "Java", 158 "Ruby", 159 "Erlang", 160 "Javascript" 161 ] 162 163 class Person(object): 164 def __init__(self, name, age): 165 self.__dict__.update(locals()) 166 167 class DemoDataGrid(DataGrid): 168 fields = [("Name", "name"), ("Age","age")] 169 default = [ 170 Person('Lucy', 29), 171 Person('Peter', 15), 172 Person('Tiffany', 17), 173 ]