Skip to content

Commit 73d02c0

Browse files
committed
fix: RPC client docstring
1 parent 679987a commit 73d02c0

File tree

1 file changed

+140
-7
lines changed

1 file changed

+140
-7
lines changed

bec_widgets/cli/client.py

Lines changed: 140 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4787,23 +4787,156 @@ def screenshot(self, file_name: "str | None" = None):
47874787
"""
47884788

47894789

4790-
class ProcedureControl(RPCBase):
4790+
class ProcedurePanel(RPCBase):
47914791
@rpc_call
4792-
def remove(self):
4792+
def new(
4793+
self,
4794+
widget: "QWidget | str",
4795+
*,
4796+
closable: "bool" = True,
4797+
floatable: "bool" = True,
4798+
movable: "bool" = True,
4799+
start_floating: "bool" = False,
4800+
floating_state: "Mapping[str, object] | None" = None,
4801+
where: "Literal['left', 'right', 'top', 'bottom'] | None" = None,
4802+
on_close: "Callable[[CDockWidget, QWidget], None] | None" = None,
4803+
tab_with: "CDockWidget | QWidget | str | None" = None,
4804+
relative_to: "CDockWidget | QWidget | str | None" = None,
4805+
return_dock: "bool" = False,
4806+
show_title_bar: "bool | None" = None,
4807+
title_buttons: "Mapping[str, bool] | Sequence[str] | str | None" = None,
4808+
show_settings_action: "bool | None" = False,
4809+
promote_central: "bool" = False,
4810+
dock_icon: "QIcon | None" = None,
4811+
apply_widget_icon: "bool" = True,
4812+
**widget_kwargs,
4813+
) -> "QWidget | CDockWidget | BECWidget":
47934814
"""
4794-
Cleanup the BECConnector
4815+
Create a new widget (or reuse an instance) and add it as a dock.
4816+
4817+
Args:
4818+
widget(QWidget | str): Instance or registered widget type string.
4819+
closable(bool): Whether the dock is closable.
4820+
floatable(bool): Whether the dock is floatable.
4821+
movable(bool): Whether the dock is movable.
4822+
start_floating(bool): Whether to start the dock floating.
4823+
floating_state(Mapping | None): Optional floating geometry metadata to apply when floating.
4824+
where(Literal["left", "right", "top", "bottom"] | None): Dock placement hint relative to the dock area (ignored when
4825+
``relative_to`` is provided without an explicit value).
4826+
on_close(Callable[[CDockWidget, QWidget], None] | None): Optional custom close handler accepting (dock, widget).
4827+
tab_with(CDockWidget | QWidget | str | None): Existing dock (or widget/name) to tab the new dock alongside.
4828+
relative_to(CDockWidget | QWidget | str | None): Existing dock (or widget/name) used as the positional anchor.
4829+
When supplied and ``where`` is ``None``, the new dock inherits the
4830+
anchor's current dock area.
4831+
return_dock(bool): When True, return the created dock instead of the widget.
4832+
show_title_bar(bool | None): Explicitly show or hide the dock area's title bar.
4833+
title_buttons(Mapping[str, bool] | Sequence[str] | str | None): Mapping or iterable describing which title bar buttons should
4834+
remain visible. Provide a mapping of button names (``"float"``,
4835+
``"close"``, ``"menu"``, ``"auto_hide"``, ``"minimize"``) to booleans,
4836+
or a sequence of button names to hide.
4837+
show_settings_action(bool | None): Control whether a dock settings/property action should
4838+
be installed. Defaults to ``False`` for the basic dock area; subclasses
4839+
such as `AdvancedDockArea` override the default to ``True``.
4840+
promote_central(bool): When True, promote the created dock to be the dock manager's
4841+
central widget (useful for editor stacks or other root content).
4842+
dock_icon(QIcon | None): Optional icon applied to the dock via ``CDockWidget.setIcon``.
4843+
Provide a `QIcon` (e.g. from ``material_icon``). When ``None`` (default),
4844+
the widget's ``ICON_NAME`` attribute is used when available.
4845+
apply_widget_icon(bool): When False, skip automatically resolving the icon from
4846+
the widget's ``ICON_NAME`` (useful for callers who want no icon and do not pass one explicitly).
4847+
4848+
Returns:
4849+
The widget instance by default, or the created `CDockWidget` when `return_dock` is True.
47954850
"""
47964851

47974852
@rpc_call
4798-
def attach(self):
4853+
def dock_map(self) -> "dict[str, CDockWidget]":
47994854
"""
4800-
None
4855+
Return the dock widgets map as dictionary with names as keys.
48014856
"""
48024857

48034858
@rpc_call
4804-
def detach(self):
4859+
def dock_list(self) -> "list[CDockWidget]":
48054860
"""
4806-
Detach the widget from its parent dock widget (if widget is in the dock), making it a floating widget.
4861+
Return the list of dock widgets.
4862+
"""
4863+
4864+
@rpc_call
4865+
def widget_map(self) -> "dict[str, QWidget]":
4866+
"""
4867+
Return a dictionary mapping widget names to their corresponding widgets.
4868+
"""
4869+
4870+
@rpc_call
4871+
def widget_list(self) -> "list[QWidget]":
4872+
"""
4873+
Return a list of all widgets contained in the dock area.
4874+
"""
4875+
4876+
@rpc_call
4877+
def attach_all(self):
4878+
"""
4879+
Re-attach floating docks back into the dock manager.
4880+
"""
4881+
4882+
@rpc_call
4883+
def delete_all(self):
4884+
"""
4885+
Delete all docks and their associated widgets.
4886+
"""
4887+
4888+
@rpc_call
4889+
def set_layout_ratios(
4890+
self,
4891+
*,
4892+
horizontal: "Sequence[float] | Mapping[int | str, float] | None" = None,
4893+
vertical: "Sequence[float] | Mapping[int | str, float] | None" = None,
4894+
splitter_overrides: "Mapping[int | str | Sequence[int], Sequence[float] | Mapping[int | str, float]] | None" = None,
4895+
) -> "None":
4896+
"""
4897+
Adjust splitter ratios in the dock layout.
4898+
4899+
Args:
4900+
horizontal: Weights applied to every horizontal splitter encountered.
4901+
vertical: Weights applied to every vertical splitter encountered.
4902+
splitter_overrides: Optional overrides targeting specific splitters identified
4903+
by their index path (e.g. ``{0: [1, 2], (1, 0): [3, 5]}``). Paths are zero-based
4904+
indices following the splitter hierarchy, starting from the root splitter.
4905+
4906+
Example:
4907+
To build three columns with custom per-column ratios::
4908+
4909+
area.set_layout_ratios(
4910+
horizontal=[1, 2, 1], # column widths
4911+
splitter_overrides={
4912+
0: [1, 2], # column 0 (two rows)
4913+
1: [3, 2, 1], # column 1 (three rows)
4914+
2: [1], # column 2 (single row)
4915+
},
4916+
)
4917+
"""
4918+
4919+
@rpc_call
4920+
def describe_layout(self) -> "list[dict[str, Any]]":
4921+
"""
4922+
Return metadata describing splitter paths, orientations, and contained docks.
4923+
4924+
Useful for determining the keys to use in `set_layout_ratios(splitter_overrides=...)`.
4925+
"""
4926+
4927+
@rpc_call
4928+
def print_layout_structure(self) -> "None":
4929+
"""
4930+
Pretty-print the current splitter paths to stdout.
4931+
"""
4932+
4933+
@rpc_call
4934+
def set_central_dock(self, dock: "CDockWidget | QWidget | str") -> "None":
4935+
"""
4936+
Promote an existing dock to be the dock manager's central widget.
4937+
4938+
Args:
4939+
dock(CDockWidget | QWidget | str): Dock reference to promote.
48074940
"""
48084941

48094942

0 commit comments

Comments
 (0)