ducpy.builders.state_builders

Helper functions for creating DUC state-related objects with a user-friendly API. Follows the same hierarchical builder pattern as element_builders.py. Only types from types.rs / duc.sql are supported.

Classes

Functions

Module Contents

class ducpy.builders.state_builders.BaseStateParams
id: str | None = None
name: str = ''
description: str = ''
version: str = '1.0'
readonly: bool = False
class ducpy.builders.state_builders.StateBuilder
base
extra
with_id(id: str)
with_name(name: str)
with_description(description: str)
with_version(version: str)
with_readonly(readonly: bool)
with_extra(**kwargs)
build_global_state()
build_local_state()
build_group()
build_layer()
build_region()
build_version_graph()
build_checkpoint()
build_delta()
build_external_file()
build_stack_base()
class ducpy.builders.state_builders.StateSpecificBuilder(base: BaseStateParams, extra: dict)
base
extra
class ducpy.builders.state_builders.GlobalStateBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_name(name: str)
with_view_background_color(color: str)
with_main_scope(scope: str)
with_scope_exponent_threshold(threshold: int)
with_pruning_level(level: ducpy.enums.PRUNING_LEVEL)
build() ducpy.classes.DataStateClass.DucGlobalState
class ducpy.builders.state_builders.LocalStateBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_scope(scope: str)
with_scroll_x(scroll_x: float)
with_scroll_y(scroll_y: float)
with_zoom(zoom: float)
with_is_binding_enabled(enabled: bool)
with_pen_mode(pen_mode: bool)
with_view_mode_enabled(enabled: bool)
with_objects_snap_mode_enabled(enabled: bool)
with_grid_mode_enabled(enabled: bool)
with_outline_mode_enabled(enabled: bool)
with_manual_save_mode(enabled: bool)
with_decimal_places(places: int)
with_current_item_opacity(opacity: float)
with_current_item_font_family(font_family: str)
with_current_item_font_size(font_size: float)
with_current_item_text_align(text_align: ducpy.enums.TEXT_ALIGN)
with_current_item_roundness(roundness: float)
build() ducpy.classes.DataStateClass.DucLocalState
class ducpy.builders.state_builders.GroupBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_label(label: str)
with_is_collapsed(is_collapsed: bool)
with_is_plot(is_plot: bool)
with_is_visible(is_visible: bool)
with_locked(locked: bool)
with_opacity(opacity: float)
with_id(id: str)
build() ducpy.classes.ElementsClass.DucGroup
class ducpy.builders.state_builders.LayerBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_label(label: str)
with_readonly(readonly: bool)
with_is_collapsed(is_collapsed: bool)
with_is_plot(is_plot: bool)
with_is_visible(is_visible: bool)
with_locked(locked: bool)
with_opacity(opacity: float)
with_stroke_color(color: str)
with_background_color(color: str)
with_id(id: str)
build() ducpy.classes.ElementsClass.DucLayer
class ducpy.builders.state_builders.RegionBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_label(label: str)
with_boolean_operation(operation: ducpy.enums.BOOLEAN_OPERATION)
with_is_collapsed(is_collapsed: bool)
with_is_plot(is_plot: bool)
with_is_visible(is_visible: bool)
with_locked(locked: bool)
with_opacity(opacity: float)
with_id(id: str)
build() ducpy.classes.ElementsClass.DucRegion
class ducpy.builders.state_builders.VersionGraphBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_checkpoints(checkpoints: List[ducpy.classes.DataStateClass.Checkpoint])
with_deltas(deltas: List[ducpy.classes.DataStateClass.Delta])
with_user_checkpoint_version_id(version_id: str)
with_latest_version_id(version_id: str)
build() ducpy.classes.DataStateClass.VersionGraph
class ducpy.builders.state_builders.CheckpointBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_id(id: str)
with_parent_id(parent_id: str)
with_is_manual_save(is_manual: bool)
with_data(data: bytes)
with_description(description: str)
build() ducpy.classes.DataStateClass.Checkpoint
class ducpy.builders.state_builders.DeltaBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_id(id: str)
with_payload(payload: bytes)
with_parent_id(parent_id: str)
with_is_manual_save(is_manual: bool)
with_description(description: str)
build() ducpy.classes.DataStateClass.Delta
class ducpy.builders.state_builders.ExternalFileBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_key(key: str)
with_mime_type(mime_type: str)
with_data(data: bytes)
with_last_retrieved(last_retrieved: int)
build() ducpy.classes.DataStateClass.DucExternalFileEntry
class ducpy.builders.state_builders.StackBaseBuilder(base: BaseStateParams, extra: dict)

Bases: StateSpecificBuilder

with_label(label: str)
with_is_collapsed(is_collapsed: bool)
with_is_plot(is_plot: bool)
with_is_visible(is_visible: bool)
with_locked(locked: bool)
with_styles(styles: ducpy.classes.ElementsClass.DucStackLikeStyles)
build() ducpy.classes.ElementsClass.DucStackBase
ducpy.builders.state_builders.create_global_state_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.DucGlobalState
ducpy.builders.state_builders.create_local_state_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.DucLocalState
ducpy.builders.state_builders.create_group_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucGroup
ducpy.builders.state_builders.create_layer_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucLayer
ducpy.builders.state_builders.create_region_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucRegion
ducpy.builders.state_builders.create_version_graph_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.VersionGraph
ducpy.builders.state_builders.create_checkpoint_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.Checkpoint
ducpy.builders.state_builders.create_delta_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.Delta
ducpy.builders.state_builders.create_external_file_from_base(base: BaseStateParams, **kwargs) ducpy.classes.DataStateClass.DucExternalFileEntry
ducpy.builders.state_builders.create_stack_base_from_base(base: BaseStateParams, **kwargs) ducpy.classes.ElementsClass.DucStackBase
ducpy.builders.state_builders.create_block(id: str, label: str, elements: List[ducpy.classes.ElementsClass.ElementWrapper] | None = None, description: str | None = None) ducpy.classes.ElementsClass.DucBlock
ducpy.builders.state_builders.create_string_value_entry(key: str, value: str) ducpy.classes.ElementsClass.StringValueEntry