Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

partial gui builder #1023

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/taipy/gui/partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from ._warnings import _warn
from .state import State

if t.TYPE_CHECKING:
from .page import Page


class Partial(_Page):
"""Re-usable Page content.
Expand Down Expand Up @@ -50,7 +53,7 @@ def __init__(self, route: t.Optional[str] = None):
else:
self._route = route

def update_content(self, state: State, content: str):
def update_content(self, state: State, content: str | "Page"):
"""Update partial content.

Arguments:
Expand All @@ -62,7 +65,12 @@ def update_content(self, state: State, content: str):
else:
_warn("'Partial.update_content()' must be called in the context of a callback.")

def __copy(self, content: str) -> Partial:
def __copy(self, content: str | "Page") -> Partial:
new_partial = Partial(self._route)
new_partial._renderer = type(self._renderer)(content=content) if self._renderer is not None else None
from .page import Page

if isinstance(content, Page):
new_partial._renderer = content
else:
new_partial._renderer = type(self._renderer)(content=content) if self._renderer is not None else None
return new_partial
Loading