Draw Page
DrawPage class for “draw:page” tag.
Classes:
| Name | Description |
|---|---|
DrawPage |
ODF draw page for presentations and drawings, “draw:page”. |
DrawPage
Bases: SvgMixin, OfficeFormsMixin, Element
ODF draw page for presentations and drawings, “draw:page”.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the DrawPage. |
get_formatted_text |
Return a formatted string representation of the page’s content. |
get_shapes |
Get all shape elements within the page. |
get_transition |
Get the animation transition element for the page. |
set_transition |
Set or replace the animation transition for the page. |
Attributes:
| Name | Type | Description |
|---|---|---|
draw_id |
|
|
master_page |
|
|
name |
|
|
presentation_page_layout |
|
|
style |
|
Source code in odfdo/draw_page.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 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 | |
_properties
class-attribute
instance-attribute
_properties = (
PropDef("name", "draw:name"),
PropDef("draw_id", "draw:id"),
PropDef("master_page", "draw:master-page-name"),
PropDef(
"presentation_page_layout",
"presentation:presentation-page-layout-name",
),
PropDef("style", "draw:style-name"),
)
_tag
class-attribute
instance-attribute
_tag = 'draw:page'
draw_id
instance-attribute
draw_id = draw_id
master_page
instance-attribute
master_page = master_page
name
instance-attribute
name = name
presentation_page_layout
instance-attribute
presentation_page_layout = presentation_page_layout
style
instance-attribute
style = style
__init__
__init__(
draw_id: str | None = None,
name: str | None = None,
master_page: str | None = None,
presentation_page_layout: str | None = None,
style: str | None = None,
**kwargs: Any,
) -> None
Initialize the DrawPage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
draw_id
|
str | None
|
The ID of the draw page (‘draw:id’). |
None
|
name
|
str | None
|
The name of the draw page (‘draw:name’). |
None
|
master_page
|
str | None
|
The name of the master page to use (‘draw:master-page-name’). |
None
|
presentation_page_layout
|
str | None
|
The name of the presentation page layout to use (‘presentation:presentation-page-layout-name’). |
None
|
style
|
str | None
|
The name of the style to apply to the page (‘draw:style-name’). |
None
|
**kwargs
|
Any
|
Additional keyword arguments for the parent |
{}
|
Source code in odfdo/draw_page.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
get_formatted_text
get_formatted_text(context: dict | None = None) -> str
Return a formatted string representation of the page’s content.
This method recursively formats the text of all child elements, including presentation notes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
dict | None
|
A dictionary providing context for formatting, such as footnote or annotation tracking. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A formatted string of the page’s textual content. |
Source code in odfdo/draw_page.py
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 | |
get_shapes
get_shapes() -> list[Element]
Get all shape elements within the page.
This includes all registered shapes such as lines, rectangles, ellipses, and connectors.
Returns:
| Type | Description |
|---|---|
list[Element]
|
list[Element]: A list of all shape elements found on the page. |
Source code in odfdo/draw_page.py
128 129 130 131 132 133 134 135 136 137 138 | |
get_transition
get_transition() -> AnimPar | None
Get the animation transition element for the page.
Returns:
| Type | Description |
|---|---|
AnimPar | None
|
AnimPar | None: The animation transition element ( |
Source code in odfdo/draw_page.py
84 85 86 87 88 89 90 91 | |
set_transition
set_transition(
smil_type: str,
subtype: str | None = None,
dur: str = "2s",
node_type: str = "default",
) -> None
Set or replace the animation transition for the page.
This method creates a new animation transition (anim:par element)
and replaces any existing transition on the page.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smil_type
|
str
|
The SMIL type for the transition (e.g., “fade”). |
required |
subtype
|
str | None
|
The SMIL subtype for the transition. |
None
|
dur
|
str
|
The duration of the transition (e.g., “2s”). |
'2s'
|
node_type
|
str
|
The presentation node type. |
'default'
|
Source code in odfdo/draw_page.py
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 | |