Config Elements
Config elements for the “settings.xml” part.
This module defines classes representing configuration elements found within
the settings.xml file of an ODF document, specifically those related to
config:config-item-set.
Classes:
| Name | Description |
|---|---|
ConfigItem |
Represents an element containing the value of an application setting, |
ConfigItemMapEntry |
Represents a single setting entry in a sequence of settings, |
ConfigItemMapIndexed |
Represents a container for ordered sequences of application settings, |
ConfigItemMapNamed |
Represents a container for a sequence of application setting elements, |
ConfigItemSet |
Represents a container element for application setting elements, |
ConfigItem
Bases: Element
Represents an element containing the value of an application setting,
identified by its config:name attribute. This corresponds to the
“config:config-item” tag.
This element holds a single configuration value and does not have any child elements.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the configuration item. |
config_type |
str
|
The data type of the configuration item’s value. |
value |
str | int | bool
|
The actual value of the configuration item. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a ConfigItem element. |
__repr__ |
|
as_dict |
Serialize the element to a dictionary. |
from_dict |
Create an element from a dictionary. |
Source code in odfdo/config_elements.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
TYPES
class-attribute
instance-attribute
TYPES: ClassVar = {
"boolean",
"short",
"int",
"long",
"double",
"string",
"datetime",
"base64Binary",
}
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = (
PropDef("name", "config:name"),
)
_tag
class-attribute
instance-attribute
_tag: str = 'config:config-item'
config_type
property
writable
config_type: str
Get the data type of the configuration item’s value.
name
instance-attribute
name = name
value
property
writable
value: str | int | bool
Get or set the value of the configuration item.
When getting, the value is cast to its appropriate Python type (str,
int, or bool) based on the config_type attribute.
When setting, the provided value is converted to a string and stored
as the element’s text content, applying type-specific encoding (e.g.,
for booleans) based on the config_type attribute.
Returns:
| Type | Description |
|---|---|
str | int | bool
|
The value of the configuration item as a str, int, or bool. |
__init__
__init__(
name: str | None = None,
config_type: str | None = None,
value: str | int | bool | None = None,
**kwargs: Any,
) -> None
Initialize a ConfigItem element.
This element contains the value of an application setting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the configuration item. |
None
|
config_type
|
str | None
|
The data type of the configuration item’s value, one of “boolean”, “short”, “int”, “long”, “double”, “string”, “datetime”, or “base64Binary”. |
None
|
value
|
str | int | bool | None
|
The actual value of the configuration item. |
None
|
Source code in odfdo/config_elements.py
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
__repr__
__repr__() -> str
Source code in odfdo/config_elements.py
492 493 | |
as_dict
as_dict() -> dict[str, str | int | bool]
Serialize the element to a dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, str | int | bool]
|
A dict with content of the ConfigItem serialized. |
Source code in odfdo/config_elements.py
542 543 544 545 546 547 548 549 550 551 552 553 | |
from_dict
classmethod
from_dict(data: dict[str, str | int | bool]) -> ConfigItem
Create an element from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, str | int | bool]
|
The ConfigItem content serialized in a dict. |
required |
Returns:
| Type | Description |
|---|---|
ConfigItem
|
A ConfigItem instance.” |
Source code in odfdo/config_elements.py
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
ConfigItemMapEntry
Bases: Element
Represents a single setting entry in a sequence of settings, corresponding to the “config:config-item-map-entry” tag.
The setting itself is defined by the child element of “config:config-item-map-entry”, and may be a single value, a set of settings, or a sequence of settings.
The “config:config-item-map-entry” element has the following child elements: “config:config-item”, “config:config-item-map-indexed”, “config:config-item-map-named”, and “config:config-item-set.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the entry. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a ConfigItemMapEntry element. |
__repr__ |
|
as_dict |
Serialize the element to a dictionary. |
from_dict |
Create an element from a dictionary. |
Source code in odfdo/config_elements.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = (
PropDef("name", "config:name"),
)
_tag
class-attribute
instance-attribute
_tag: str = 'config:config-item-map-entry'
config_item_maps_indexed
property
config_item_maps_indexed: list[ConfigItemMapIndexed]
Get the list of indexed configuration item maps.
Returns:
| Type | Description |
|---|---|
list[ConfigItemMapIndexed]
|
list[ConfigItemMapIndexed]: A list of |
config_item_maps_named
property
config_item_maps_named: list[ConfigItemMapNamed]
Get the list of named configuration item maps.
Returns:
| Type | Description |
|---|---|
list[ConfigItemMapNamed]
|
list[ConfigItemMapNamed]: A list of |
config_item_sets
property
config_item_sets: list[ConfigItemSet]
Get the list of nested ConfigItemSet elements.
Returns:
| Type | Description |
|---|---|
list[ConfigItemSet]
|
list[ConfigItemSet]: A list of |
config_items
property
config_items: list[ConfigItem]
Get the list of individual configuration items.
Returns:
| Type | Description |
|---|---|
list[ConfigItem]
|
list[ConfigItem]: A list of |
name
instance-attribute
name = name
__init__
__init__(name: str | None = None, **kwargs: Any) -> None
Initialize a ConfigItemMapEntry element.
This represents an entry within an ordered configuration map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the entry. |
None
|
Source code in odfdo/config_elements.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
__repr__
__repr__() -> str
Source code in odfdo/config_elements.py
293 294 | |
as_dict
as_dict() -> dict[
str, str | int | bool | list[Any] | dict[str, Any]
]
Serialize the element to a dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, str | int | bool | list[Any] | dict[str, Any]]
|
A dict with content of the ConfigItemMapEntry serialized. |
Source code in odfdo/config_elements.py
338 339 340 341 342 343 | |
from_dict
classmethod
from_dict(
data: dict[str, str | int | bool | dict[str, Any]],
) -> ConfigItemMapEntry
Create an element from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, str | int | bool | dict[str, Any]]
|
The ConfigItemMapEntry content serialized as a dict. |
required |
Returns:
| Type | Description |
|---|---|
ConfigItemMapEntry
|
A ConfigItemMapEntry. |
Source code in odfdo/config_elements.py
345 346 347 348 349 350 351 352 353 354 355 356 357 | |
ConfigItemMapIndexed
Bases: Element
Represents a container for ordered sequences of application settings, corresponding to the “config:config-item-map-indexed” tag.
This element is used to store a collection of configuration items that are ordered and can be accessed by index.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the indexed configuration item map. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a ConfigItemMapIndexed element. |
__repr__ |
|
as_dict |
Serialize the element to a dictionary. |
from_dict |
Create an element from a dictionary. |
Source code in odfdo/config_elements.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = (
PropDef("name", "config:name"),
)
_tag
class-attribute
instance-attribute
_tag: str = 'config:config-item-map-indexed'
config_item_maps_entries
property
config_item_maps_entries: list[ConfigItemMapEntry]
Get the list of configuration item map entries.
Returns:
| Type | Description |
|---|---|
list[ConfigItemMapEntry]
|
list[ConfigItemMapEntry]: A list of |
name
instance-attribute
name = name
__init__
__init__(name: str | None = None, **kwargs: Any) -> None
Initialize a ConfigItemMapIndexed element.
This container holds ordered sequences of application settings.
The “config:config-item-map-indexed” element has the following child element: “config:config-item-map-entry”.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the indexed configuration item map. |
None
|
Source code in odfdo/config_elements.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
__repr__
__repr__() -> str
Source code in odfdo/config_elements.py
219 220 | |
as_dict
as_dict() -> dict[
str, str | int | bool | list[Any] | dict[str, Any]
]
Serialize the element to a dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, str | int | bool | list[Any] | dict[str, Any]]
|
A dict with content of the ConfigItemMapIndexed serialized. |
Source code in odfdo/config_elements.py
233 234 235 236 237 238 239 | |
from_dict
classmethod
from_dict(
data: dict[str, str | int | bool | dict[str, Any]],
) -> ConfigItemMapIndexed
Create an element from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, str | int | bool | dict[str, Any]]
|
The ConfigItemMapIndexed content serialized as a dict. |
required |
Returns:
| Type | Description |
|---|---|
ConfigItemMapIndexed
|
A ConfigItemMapIndexed. |
Source code in odfdo/config_elements.py
241 242 243 244 245 246 247 248 249 250 251 252 253 | |
ConfigItemMapNamed
Bases: Element
Represents a container for a sequence of application setting elements,
where each sequence is identified by the value of its config:name
attribute. This corresponds to the “config:config-item-map-named” tag.
This element is used to store a collection of configuration items that can be accessed by a descriptive name rather than an index.
The “config:config-item-map-named” element has the following child element: “config:config-item-map-entry”.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the named configuration item map. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a ConfigItemMapNamed element. |
__repr__ |
|
as_dict |
Serialize the element to a dictionary. |
from_dict |
Create an element from a dictionary. |
Source code in odfdo/config_elements.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = (
PropDef("name", "config:name"),
)
_tag
class-attribute
instance-attribute
_tag: str = 'config:config-item-map-named'
config_item_maps_entries
property
config_item_maps_entries: list[ConfigItemMapEntry]
Get the list of configuration item map entries.
Returns:
| Type | Description |
|---|---|
list[ConfigItemMapEntry]
|
list[ConfigItemMapEntry]: A list of |
name
instance-attribute
name = name
__init__
__init__(name: str | None = None, **kwargs: Any) -> None
Initialize a ConfigItemMapNamed element.
This container holds named sequences of application setting elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the named configuration item map. |
None
|
Source code in odfdo/config_elements.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
__repr__
__repr__() -> str
Source code in odfdo/config_elements.py
397 398 | |
as_dict
as_dict() -> dict[
str, str | int | bool | list[Any] | dict[str, Any]
]
Serialize the element to a dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, str | int | bool | list[Any] | dict[str, Any]]
|
A dict with content of the ConfigItemMapNamed serialized. |
Source code in odfdo/config_elements.py
411 412 413 414 415 416 417 | |
from_dict
classmethod
from_dict(
data: dict[str, str | int | bool | dict[str, Any]],
) -> ConfigItemMapNamed
Create an element from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, str | int | bool | dict[str, Any]]
|
The ConfigItemMapNamed content serialized as a dict. |
required |
Returns:
| Type | Description |
|---|---|
ConfigItemMapNamed
|
A ConfigItemMapNamed. |
Source code in odfdo/config_elements.py
419 420 421 422 423 424 425 426 427 428 429 430 431 | |
ConfigItemSet
Bases: Element
Represents a container element for application setting elements, “config:config-item-set” tag.
This element can contain other configuration items, item maps, or item sets, forming a hierarchical structure for document settings.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The name of the configuration item set. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a ConfigItemSet element. |
__repr__ |
|
as_dict |
Serialize the element to a dictionary. |
from_dict |
Create an element from a dictionary. |
Source code in odfdo/config_elements.py
78 79 80 81 82 83 84 85 86 87 88 89 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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = (
PropDef("name", "config:name"),
)
_tag
class-attribute
instance-attribute
_tag: str = 'config:config-item-set'
config_item_maps_indexed
property
config_item_maps_indexed: list[ConfigItemMapIndexed]
Get the list of indexed configuration item maps.
Returns:
| Type | Description |
|---|---|
list[ConfigItemMapIndexed]
|
list[ConfigItemMapIndexed]: A list of |
config_item_maps_named
property
config_item_maps_named: list[ConfigItemMapNamed]
Get the list of named configuration item maps.
Returns:
| Type | Description |
|---|---|
list[ConfigItemMapNamed]
|
list[ConfigItemMapNamed]: A list of |
config_item_sets
property
config_item_sets: list[ConfigItemSet]
Get the list of nested ConfigItemSet elements.
Returns:
| Type | Description |
|---|---|
list[ConfigItemSet]
|
list[ConfigItemSet]: A list of |
config_items
property
config_items: list[ConfigItem]
Get the list of individual configuration items.
Returns:
| Type | Description |
|---|---|
list[ConfigItem]
|
list[ConfigItem]: A list of |
name
instance-attribute
name = name
__init__
__init__(name: str | None = None, **kwargs: Any) -> None
Initialize a ConfigItemSet element.
This element acts as a container for various application setting
elements, including config:config-item,
config:config-item-map-indexed, config:config-item-map-named,
and nested config:config-item-set.
The “config:config-item-set” element has the following child elements: “config:config-item”, “config:config-item-map-indexed”, “config:config-item-map-named” and “config:config-item-set”
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name of the configuration item set. |
None
|
Source code in odfdo/config_elements.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
__repr__
__repr__() -> str
Source code in odfdo/config_elements.py
115 116 | |
as_dict
as_dict() -> dict[
str, str | int | bool | list[Any] | dict[str, Any]
]
Serialize the element to a dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, str | int | bool | list[Any] | dict[str, Any]]
|
A dict with content of the ConfigItemSet serialized. |
Source code in odfdo/config_elements.py
160 161 162 163 164 165 166 | |
from_dict
classmethod
from_dict(
data: dict[str, str | int | bool | dict[str, Any]],
) -> ConfigItemSet
Create an element from a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, str | int | bool | dict[str, Any]]
|
The ConfigItemSet content serialized as a dict. |
required |
Returns:
| Type | Description |
|---|---|
ConfigItemSet
|
A ConfigItemSet. |
Source code in odfdo/config_elements.py
168 169 170 171 172 173 174 175 176 177 178 179 180 | |
_as_dict
_as_dict(
element: ConfigItemMapEntry
| ConfigItemMapIndexed
| ConfigItemMapNamed
| ConfigItemSet,
) -> dict[
str, str | int | bool | list[Any] | dict[str, Any]
]
Internal helper to serialize a configuration element to a dictionary.
Source code in odfdo/config_elements.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
_from_dict
_from_dict(
data: dict[str, str | int | bool | dict[str, Any]],
) -> Element
Internal helper to deserialize a dictionary into a configuration element.
Source code in odfdo/config_elements.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |