DataExchange#

class ansys.scade.guitools.data.DataExchange#

Base class for accessing controls data.

Initialize the data exchange instance.

Overview#

ddx_control

Declare a property for automatic serialization.

get_control_accessors

Return the get and set accessors for a control, or None if not applicable.

Import detail#

from ansys.scade.guitools.data import DataExchange

Attribute detail#

DataExchange.properties: List[Tuple[Getter, Setter, str, Any, Any]] = []#

Method detail#

DataExchange.ddx_control(control: scade.tool.suite.gui.widgets.Widget, name: str, default: Any, empty: Any = None)#

Declare a property for automatic serialization.

When the page is displayed, the control is updated with the value read from the model. When the page is validated, the model is updated with the value read from the control.

Parameters#

controlWidget

Control associated to the property.

name :

Name of the property.

defaultAny

Default value of the property.

emptyAny | None

Value to display when it is empty, default default.

Examples#

# on_build_ex method of a page
self.tp = ToolPropDataExchange('MY_TOOL')
...
edit = self.add_edit(y)
self.tp.ddx_control(edit, name='MY_PROP', default='')
y += csts.DY
cb = self.add_check_button(y, 'Option')
self.tp.ddx_control(cb, name='MY_OPTION', default=False)
y += csts.DY
DataExchange.get_control_accessors(control: scade.tool.suite.gui.widgets.Widget) Tuple[Getter | None, Setter | None]#

Return the get and set accessors for a control, or None if not applicable.

Override this method in a derived class to define custom implementation for not supported controls.

Parameters#

controlWidget

Input control.

Returns#

tuple[Getter, Setter]