BaseInteractor
Implementation of the interactor base class
BaseInteractor
Canonical path: BaseInteractor.BaseInteractor
Bases: ABC
base class for a PythonPart interactor
script_object_interactor
property
writable
script_object_interactor: BaseScriptObjectInteractor | None
get the script object interactor
Returns:
-
BaseScriptObjectInteractor | None
–script object interactor
InteractorInputMode
Canonical path: BaseInteractor.BaseInteractor.InteractorInputMode
Bases: IntEnum
definition of the interactor modes
__init__
abstractmethod
__init__(
coord_input: CoordinateInput,
pyp_path: str,
global_str_table_service: StringTableService,
build_ele_list: list[BuildingElement],
build_ele_composite: BuildingElementComposite,
control_props_list: list[BuildingElementControlProperties],
modify_uuid_list: list[str],
)
Constructor
Parameters:
-
coord_input
(CoordinateInput
) –coordinate input
-
pyp_path
(str
) –path of the pyp file
-
global_str_table_service
(StringTableService
) –global string table service for default strings
-
build_ele_list
(list[BuildingElement]
) –list with the building elements containing parameter properties
-
build_ele_composite
(BuildingElementComposite
) –building element composite
-
control_props_list
(list[BuildingElementControlProperties]
) –control properties list
-
modify_uuid_list
(list[str]
) –UUIDs of the existing elements in the modification mode
execute_load_favorite
Handles the execute load favorite event.
This event is triggered after pressing "Load favorite" button in the property palette and selecting the favorite file in the file dialog
Implementing this method is necessary only, when the load/save/restore favorite buttons are shown in the property palette, i.e. when the tag ShowFavoriteButtons in the .pyp file is set to True
Parameters:
-
_file_name
(str
) –full path and name of the selected favorite file
execute_save_favorite
Handles the execute save favorite event.
This event is triggered after pressing "Save as a favorite" button in the property palette and selecting the location of the favorite file in the file dialog.
Implementing this method is necessary only, when the load/save/restore favorite buttons are shown in the property palette, i.e. when the tag ShowFavoriteButtons in the .pyp file is set to True
Parameters:
-
_file_name
(str
) –full path and name of the selected favorite file
modify_element_property
abstractmethod
Handles the modify element property event.
This event is triggered with each modification of the element property done in the property palette or by using a handle.
Parameters:
-
page
(int
) –Page of the modified property
-
name
(str
) –Name of the modified property.
-
value
(Any
) –New value of the modified property.
on_cancel_by_menu_function
Handles the event of terminating the PythonPart by calling another function in Allplan UI.
Implement this method, when some actions must be introduced, before the PythonPart is eventually terminated.
on_cancel_function
abstractmethod
Handles the cancel function event
This event is triggered when the ESC button is hit during the runtime of the PythonPart.
Returns:
-
bool
–True when the PythonPart framework should terminate the PythonPart, False otherwise.
on_control_event
abstractmethod
Handles the on control event.
Called when an event is triggered by a palette control (ex. button).
Parameters:
-
event_id
(int
) –event id of the clicked button control
Returns:
-
bool
–palette update state
on_input_undo
Process the input undo event
This event is triggered, when during coordinate input the user hits the undo button in the dialog line.
Implementing this method is necessary only, when the undo button is shown to the user, i.e. the CoordinateInput.EnableUndoStep method was used.
Returns:
-
bool
–message was processed: True/False
on_mouse_leave
abstractmethod
Handles the mouse leave event.
This event is triggered, when the mouse leaves the viewport.
on_preview_draw
abstractmethod
Handles the preview draw event.
This event is triggered, when an input in the dialog line is done (e.g. input of a coordinate).
on_shortcut_control_input
Handles the input inside the shortcut control.
This event is triggered, when a shortcut is hit inside a shortcut input control in the dialog line. A shortcut input control is a control in the dialog line, where the user can hit only certain keys, like e.g. ROTATION_ANGLE_STEP where only + and - keys can be hit.
Implementing this method makes sense only, when this kind of input control is used!
Parameters:
-
_value
(int
) –value associated with the hit shortcut key
Returns:
-
bool
–True/False for success.
on_value_input_control_enter
abstractmethod
Handles the value input control enter event.
This event is triggered, when enter key is hit during the input inside the input control located in the dialog line.
Returns:
-
bool
–True/False for success.
process_mouse_msg
abstractmethod
process_mouse_msg(mouse_msg: int, pnt: Point2D, msg_info: Any) -> bool
Handles the process mouse message event.
This event is triggered with each message sent by the mouse, which can be a mouse move, mouse click, zoom out, etc. The message is sent only during mouse actions inside a viewport.
Parameters:
-
mouse_msg
(int
) –The mouse message.
-
pnt
(Point2D
) –The input point in view coordinates. The origin is the mid point of the viewport
-
msg_info
(Any
) –additional message info.
Returns:
-
bool
–True/False for success.
reset_param_values
reset_param_values(_build_ele_list: list[BuildingElement]) -> None
Handles the reset parameter values event.
This event is triggered after pressing "Restore basic setting" button in the property palette.
Implementing this method is necessary only, when the load/save/restore favorite buttons are shown in the property palette, i.e. when the tag ShowFavoriteButtons in the .pyp file is set to True
Parameters:
-
_build_ele_list
(list[BuildingElement]
) –list with building elements
set_active_palette_page_index
Handles the event of changing pages inside the property palette
Parameters:
-
_active_page_index
(int
) –index of the active page, starting from 0
start_next_input
start the next input
Overload this member function to execute the needed steps after the execution of a script object interactor (e. g. after an element selection)