Form Controls Mixins
Mixin classes for Form controls.
(The main objective of the current minimal implementation of forms is to parse the existing form contents in a document.)
Classes:
| Name | Description |
|---|---|
FormAsDictMixin |
Mixin for the as_dict() method of Form Control classes. |
FormButtonTypeMixin |
Mixin for the “form:button-type” attribute. |
FormDelayRepeatMixin |
Mixin for the “form:delay-for-repeat” attribute. |
FormImageAlignMixin |
Mixin for the “form:image-align” attribute. |
FormImagePositionMixin |
Mixin for the “form:image-position” attribute. |
FormMaxLengthMixin |
Mixin for the “form:max-length” attribute. |
FormSizetMixin |
Mixin for the “form:size” attribute. |
FormSourceListMixin |
Mixin for the “form:list-source-type” attribute. |
OfficeTargetFrameMixin |
Mixin for the “office:target-frame” attribute. |
FormAsDictMixin
Mixin for the as_dict() method of Form Control classes.
Methods:
| Name | Description |
|---|---|
as_dict |
Serialize the Form content as a Python dict. |
Source code in odfdo/form_controls_mixins.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
as_dict
as_dict() -> dict[str, str | Decimal | int | None]
Serialize the Form content as a Python dict.
Returns:
| Type | Description |
|---|---|
dict[str, str | Decimal | int | None]
|
The Form content as a Python dict. |
Source code in odfdo/form_controls_mixins.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
FormButtonTypeMixin
Bases: Element
Mixin for the “form:button-type” attribute.
Attributes:
| Name | Type | Description |
|---|---|---|
BUTTON_TYPES |
set[str]
|
|
button_type |
str | None
|
Get or set the button type of the form button. |
Source code in odfdo/form_controls_mixins.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
BUTTON_TYPES
class-attribute
BUTTON_TYPES: set[str] = {'submit', 'reset', 'push', 'url'}
button_type
property
writable
button_type: str | None
Get or set the button type of the form button.
FormDelayRepeatMixin
Bases: Element
Mixin for the “form:delay-for-repeat” attribute.
Attributes:
| Name | Type | Description |
|---|---|---|
delay_for_repeat |
str
|
Get or set the delay for repeat attribute. |
Source code in odfdo/form_controls_mixins.py
36 37 38 39 40 41 42 43 44 45 46 47 48 | |
delay_for_repeat
property
writable
delay_for_repeat: str
Get or set the delay for repeat attribute.
FormImageAlignMixin
Bases: Element
Mixin for the “form:image-align” attribute.
Attributes:
| Name | Type | Description |
|---|---|---|
IMAGE_ALIGN |
set[str]
|
|
image_align |
str | None
|
Get or set the alignment of the image on the control. |
Source code in odfdo/form_controls_mixins.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
IMAGE_ALIGN
class-attribute
IMAGE_ALIGN: set[str] = {'start', 'center', 'end'}
image_align
property
writable
image_align: str | None
Get or set the alignment of the image on the control.
FormImagePositionMixin
Bases: Element
Mixin for the “form:image-position” attribute.
Attributes:
| Name | Type | Description |
|---|---|---|
IMAGE_POSITION |
set[str]
|
|
image_position |
str | None
|
Get or set the position of the image on the control. |
Source code in odfdo/form_controls_mixins.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
IMAGE_POSITION
class-attribute
IMAGE_POSITION: set[str] = {
"bottom",
"center",
"end",
"start",
"top",
}
image_position
property
writable
image_position: str | None
Get or set the position of the image on the control.
FormMaxLengthMixin
Bases: Element
Mixin for the “form:max-length” attribute.
Attributes:
| Name | Type | Description |
|---|---|---|
max_length |
int | None
|
Get or set the maximum length of the text. |
Source code in odfdo/form_controls_mixins.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
max_length
property
writable
max_length: int | None
Get or set the maximum length of the text.
FormSizetMixin
Bases: Element
Mixin for the “form:size” attribute.
Attributes:
| Name | Type | Description |
|---|---|---|
size |
int | None
|
Get or set the size attribute of the control. |
Source code in odfdo/form_controls_mixins.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
size
property
writable
size: int | None
Get or set the size attribute of the control.
FormSourceListMixin
Bases: Element
Mixin for the “form:list-source-type” attribute.
Attributes:
| Name | Type | Description |
|---|---|---|
LIST_SOURCE_TYPE |
set[str]
|
|
list_source_type |
str | None
|
Get or set the list source type attribute. |
Source code in odfdo/form_controls_mixins.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
LIST_SOURCE_TYPE
class-attribute
LIST_SOURCE_TYPE: set[str] = {
"table",
"query",
"sql",
"sql-pass-through",
"value-list",
"table-fields",
}
list_source_type
property
writable
list_source_type: str | None
Get or set the list source type attribute.
OfficeTargetFrameMixin
Bases: Element
Mixin for the “office:target-frame” attribute.
Usable with the following elements: “form:button”, “form:form” and “form:imag”.
Attributes:
| Name | Type | Description |
|---|---|---|
TARGET_FRAME |
set[str]
|
|
target_frame |
str | None
|
Get or set the target frame for the control action. |
Source code in odfdo/form_controls_mixins.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
TARGET_FRAME
class-attribute
TARGET_FRAME: set[str] = {
"_blank",
"_parent",
"_self",
"_top",
}
target_frame
property
writable
target_frame: str | None
Get or set the target frame for the control action.