pydui.layout package¶
Submodules¶
pydui.layout.hlayout module¶
- class pydui.layout.hlayout.PyDuiHLayout¶
Bases:
PyDuiLayoutWithPogaSupport
Horizontal layout
- static build_name() str ¶
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
pydui.layout.pglayout module¶
- class pydui.layout.pglayout.PyDuiLayoutWithPogaSupport¶
Bases:
PyDuiLayout
,PogaView
PyDui-GTK internal layout engine, with poga layout support.
- bounds_size() Tuple[float, float] ¶
Return the layout bounds size.
- Returns:
bounds size, mainly equal the frame size.
- Return type:
Tuple[float, float]
- frame_origin() Tuple[float, float] ¶
Return frame position.
- Returns:
Return frame (x, y) position.
- Return type:
Tuple[float, float]
- is_container() bool ¶
Return current view is container or not.
- Returns:
Return True is container.
- Return type:
bool
- parse_attrib(k: str, v: str)¶
Parse single attribute
- Parameters:
attrib (Dict[str, str]) – attributes dict key=value …
- poga_layout() PogaLayout ¶
Return PogaLayout
- Returns:
PogaLayout object
- Return type:
PogaLayout
- set_frame_position_and_size(x: float, y: float, width: float, height: float)¶
Set the frame position and size.
- Parameters:
x (float) – Frame x position
y (float) – Frame y position
width (float) – Frame width
height (float) – Frame height
- size_that_fits(width: float, height: float) Tuple[float, float] ¶
Calculate the frame size.
- Parameters:
width (float) – Parent layout width.
height (float) – Parent layout height.
- Returns:
Return frame size (width, height).
- Return type:
Tuple[float, float]
- subviews() List[PogaView] ¶
Return subviews, subview type must be PogaView.
- Returns:
subviews
- Return type:
Iterable[PogaView]
- subviews_count() int ¶
Return subviews count.
- Returns:
subviews count
- Return type:
int
- class pydui.layout.pglayout.PyDuiPGLayout¶
Bases:
PyDuiLayout
,PogaView
YogaLayout on PyDui-GTK
- bounds_size() Tuple[float, float] ¶
Return the layout bounds size.
- Returns:
bounds size, mainly equal the frame size.
- Return type:
Tuple[float, float]
- static build_name() str ¶
PyDuiPGLayout build name: PGLayout
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- frame_origin() Tuple[float, float] ¶
Return frame position.
- Returns:
Return frame (x, y) position.
- Return type:
Tuple[float, float]
- is_container() bool ¶
Return current view is container or not.
- Returns:
Return True is container.
- Return type:
bool
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
- parse_attrib(k: str, v: str)¶
Parse single attribute
- Parameters:
attrib (Dict[str, str]) – attributes dict key=value …
- poga_layout() PogaLayout ¶
Return PogaLayout
- Returns:
PogaLayout object
- Return type:
PogaLayout
- set_frame_position_and_size(x: float, y: float, width: float, height: float)¶
Set the frame position and size.
- Parameters:
x (float) – Frame x position
y (float) – Frame y position
width (float) – Frame width
height (float) – Frame height
- size_that_fits(width: float, height: float) Tuple[float, float] ¶
Calculate the frame size.
- Parameters:
width (float) – Parent layout width.
height (float) – Parent layout height.
- Returns:
Return frame size (width, height).
- Return type:
Tuple[float, float]
- subviews() List[PogaView] ¶
Return subviews, subview type must be PogaView.
- Returns:
subviews
- Return type:
Iterable[PogaView]
- subviews_count() int ¶
Return subviews count.
- Returns:
subviews count
- Return type:
int
pydui.layout.scrolled_layout module¶
- class pydui.layout.scrolled_layout.PyDuiFitLayout¶
Bases:
PyDuiLayoutWithPogaSupport
- static build_name() str ¶
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
- class pydui.layout.scrolled_layout.PyDuiScrolledLayout¶
Bases:
PyDuiLayoutWithPogaSupport
- add_child(child: PyDuiWidget)¶
Add child widget.
if child has been added, ignore.
- Parameters:
child (PyDuiWidget) – child widget
- add_child_at(child: PyDuiWidget, index: int)¶
Add child widget at index
if the index overbound, it will add widget to last position.
- Parameters:
child (PyDuiWidget) – child widget
index (int) – target index
- Returns:
return widget object.
- Return type:
- static build_name() str ¶
- enable_hscroll(enabled: bool)¶
- enable_vscroll(enabled: bool)¶
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
- on_mouse_enter() None ¶
- on_mouse_leave(next_widget: Optional[PyDuiWidget]) None ¶
- on_scroll_event(event: ScrollEvent) bool ¶
- parse_attrib(k: str, v: str)¶
Parse single attribute
- Parameters:
attrib (Dict[str, str]) – attributes dict key=value …
- remove_child(child: PyDuiWidget)¶
Remove child widget.
- Parameters:
widget (PyDuiWidget) – widget object
- remove_child_at(index: int)¶
Remove child widget at index
if the index overbound, do nothing.
- Parameters:
index (int) – widget index
- remove_child_by_id(widget_id: str)¶
Remove child widget by widget_id
- Parameters:
widget_id (str) – widget id
- scroll_to(dx: float, dy: float)¶
pydui.layout.vlayout module¶
- class pydui.layout.vlayout.PyDuiVLayout¶
Bases:
PyDuiLayoutWithPogaSupport
Vertical layout
- static build_name() str ¶
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
Module contents¶
Layout Module
- class pydui.layout.PyDuiHLayout¶
Bases:
PyDuiLayoutWithPogaSupport
Horizontal layout
- static build_name() str ¶
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
- class pydui.layout.PyDuiPGLayout¶
Bases:
PyDuiLayout
,PogaView
YogaLayout on PyDui-GTK
- bounds_size() Tuple[float, float] ¶
Return the layout bounds size.
- Returns:
bounds size, mainly equal the frame size.
- Return type:
Tuple[float, float]
- static build_name() str ¶
PyDuiPGLayout build name: PGLayout
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- frame_origin() Tuple[float, float] ¶
Return frame position.
- Returns:
Return frame (x, y) position.
- Return type:
Tuple[float, float]
- is_container() bool ¶
Return current view is container or not.
- Returns:
Return True is container.
- Return type:
bool
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
- parse_attrib(k: str, v: str)¶
Parse single attribute
- Parameters:
attrib (Dict[str, str]) – attributes dict key=value …
- poga_layout() PogaLayout ¶
Return PogaLayout
- Returns:
PogaLayout object
- Return type:
PogaLayout
- set_frame_position_and_size(x: float, y: float, width: float, height: float)¶
Set the frame position and size.
- Parameters:
x (float) – Frame x position
y (float) – Frame y position
width (float) – Frame width
height (float) – Frame height
- size_that_fits(width: float, height: float) Tuple[float, float] ¶
Calculate the frame size.
- Parameters:
width (float) – Parent layout width.
height (float) – Parent layout height.
- Returns:
Return frame size (width, height).
- Return type:
Tuple[float, float]
- subviews() List[PogaView] ¶
Return subviews, subview type must be PogaView.
- Returns:
subviews
- Return type:
Iterable[PogaView]
- subviews_count() int ¶
Return subviews count.
- Returns:
subviews count
- Return type:
int
- class pydui.layout.PyDuiScrolledLayout¶
Bases:
PyDuiLayoutWithPogaSupport
- add_child(child: PyDuiWidget)¶
Add child widget.
if child has been added, ignore.
- Parameters:
child (PyDuiWidget) – child widget
- add_child_at(child: PyDuiWidget, index: int)¶
Add child widget at index
if the index overbound, it will add widget to last position.
- Parameters:
child (PyDuiWidget) – child widget
index (int) – target index
- Returns:
return widget object.
- Return type:
- static build_name() str ¶
- enable_hscroll(enabled: bool)¶
- enable_vscroll(enabled: bool)¶
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint
- on_mouse_enter() None ¶
- on_mouse_leave(next_widget: Optional[PyDuiWidget]) None ¶
- on_scroll_event(event: ScrollEvent) bool ¶
- parse_attrib(k: str, v: str)¶
Parse single attribute
- Parameters:
attrib (Dict[str, str]) – attributes dict key=value …
- remove_child(child: PyDuiWidget)¶
Remove child widget.
- Parameters:
widget (PyDuiWidget) – widget object
- remove_child_at(index: int)¶
Remove child widget at index
if the index overbound, do nothing.
- Parameters:
index (int) – widget index
- remove_child_by_id(widget_id: str)¶
Remove child widget by widget_id
- Parameters:
widget_id (str) – widget id
- scroll_to(dx: float, dy: float)¶
- class pydui.layout.PyDuiVLayout¶
Bases:
PyDuiLayoutWithPogaSupport
Vertical layout
- static build_name() str ¶
- estimate_size(parent_width: float, parent_height: float, constraint: PyDuiLayoutConstraint) Tuple[float, float] ¶
- layout(x: float, y: float, width: float, height: float, constraint: PyDuiLayoutConstraint)¶
- Parameters:
x (float) – x offset relative to parent
y (float) – y offset relative to parent
width (float) – widget width
height (float) – widget height
constraint (PyDuiLayoutConstraint) – layout constraint