Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Controller.Controller Class Reference

Public Member Functions

None __init__ (self, "Application" application)
 
None addView (self, View view)
 
Optional[ViewgetView (self, str name)
 
Dict[str, ViewgetAllViews (self)
 
Optional[ViewgetActiveView (self)
 
None setActiveView (self, str name)
 
None addStage (self, Stage stage)
 
Optional[StagegetStage (self, str name)
 
Dict[str, StagegetAllStages (self)
 
Optional[StagegetActiveStage (self)
 
None setActiveStage (self, str name)
 
None addInputDevice (self, InputDevice device)
 
Optional[InputDevicegetInputDevice (self, str name)
 
None removeInputDevice (self, str name)
 
str getFallbackTool (self)
 
None setFallbackTool (self, str tool)
 
Optional["Tool"] getTool (self, str name)
 
Dict[str, "Tool"] getAllTools (self)
 
None addTool (self, "Tool" tool)
 
bool isToolOperationActive (self)
 
Optional["Tool"] getActiveTool (self)
 
 setActiveTool (self, Optional[Union["Tool", str]] tool)
 
Scene getScene (self)
 
 event (self, Event event)
 
 setCameraTool (self, Union["Tool", str] tool)
 
Optional["Tool"] getCameraTool (self)
 
 setSelectionTool (self, Union[str, "Tool"] tool)
 
bool getToolsEnabled (self)
 
None setToolsEnabled (self, bool enabled)
 
None deleteAllNodesWithMeshData (self, bool only_selectable=True)
 
None setCameraRotation (self, str coordinate="x", int angle=0)
 
None setCameraPosition (self, int x_position=0, int y_position=0, int z_position=0)
 
None setLookAtPosition (self, int x_look_at_position=0, int y_look_at_position=0, int z_look_at_position=0)
 
None setCameraZoomFactor (self, float camera_zoom_factor=0)
 
 setCameraOrigin (self, str coordinate="home")
 

Public Attributes

 addStage
 
 addView
 
 addTool
 
 addInputDevice
 
 event = device
 

Static Public Attributes

 viewsChanged = Signal()
 
 activeViewChanged = Signal()
 
 stagesChanged = Signal()
 
 activeStageChanged = Signal()
 
 toolsChanged = Signal()
 
 toolEnabledChanged = Signal()
 
 activeToolChanged = Signal()
 
 toolOperationStarted = Signal()
 
 toolOperationStopped = Signal()
 
 contextMenuRequested = Signal()
 

Protected Member Functions

None _onToolOperationStarted (self, "Tool" tool)
 
None _onToolOperationStopped (self, "Tool" tool)
 

Protected Attributes

 _scene = Scene()
 
 _application = application
 
dict _active_view = None
 
dict _views = {}
 
dict _active_tool = None
 
str _fallback_tool = "TranslateTool"
 
bool _tool_operation_active = False
 
dict _tools = {}
 
Optional["Tool"] _camera_tool = None
 
Optional["Tool"] _selection_tool = None
 
bool _tools_enabled = True
 
dict _active_stage = None
 
dict _stages = {}
 
dict _input_devices = {}
 
 _onToolOperationStarted = tool
 
 _onToolOperationStopped
 

Detailed Description

Glue class that holds the scene, (active) view(s), (active) tool(s) and possible user inputs.

The different types of views / tools / inputs are defined by plugins.
:sa View
:sa Tool
:sa Scene

Member Function Documentation

◆ addInputDevice()

None UM.Controller.Controller.addInputDevice ( self,
InputDevice device )
Add an input device (e.g. mouse, keyboard, etc) if it's not already added.

:param device: The input device to be added

◆ addStage()

None UM.Controller.Controller.addStage ( self,
Stage stage )
Add a stage if it's not already added.

:param stage: The stage to be added

◆ addTool()

None UM.Controller.Controller.addTool ( self,
"Tool" tool )
Add a Tool (transform object, translate object) if its not already added.

:param tool: Tool to be added

◆ addView()

None UM.Controller.Controller.addView ( self,
View view )
Add a view by name if it"s not already added.

:param view: The view to be added

◆ event()

UM.Controller.Controller.event ( self,
Event event )
Process an event

The event is first passed to the selection tool, then the active tool and finally the camera tool.
If none of these events handle it (when they return something that does not evaluate to true)
a context menu signal is emitted.

:param event: event to be handle.

◆ getActiveStage()

Optional[Stage] UM.Controller.Controller.getActiveStage ( self)
Request active stage. Returns None if there is no active stage

:return: stage if an stage is active, None otherwise.

◆ getActiveTool()

Optional["Tool"] UM.Controller.Controller.getActiveTool ( self)
Request active tool. Returns None if there is no active tool

:return: Tool if a tool is active, None otherwise.

◆ getActiveView()

Optional[View] UM.Controller.Controller.getActiveView ( self)
Request active view. Returns None if there is no active view

:return: view if an view is active, None otherwise.

◆ getAllStages()

Dict[str, Stage] UM.Controller.Controller.getAllStages ( self)
Return all stages.

:return: stages

◆ getAllTools()

Dict[str, "Tool"] UM.Controller.Controller.getAllTools ( self)
Get all tools

:return: tools

◆ getAllViews()

Dict[str, View] UM.Controller.Controller.getAllViews ( self)
Return all views.

:return: views

◆ getCameraTool()

Optional["Tool"] UM.Controller.Controller.getCameraTool ( self)
Get the camera tool (if any)

:returns: camera tool (or none)

◆ getFallbackTool()

str UM.Controller.Controller.getFallbackTool ( self)
Request the current fallbacl tool.

:return: Id of the fallback tool

◆ getInputDevice()

Optional[InputDevice] UM.Controller.Controller.getInputDevice ( self,
str name )
Request input device by name. Returns None if no device is found.

:param name: Unique identifier of input device (usually the plugin name)
:return: input device if name was found, none otherwise.

◆ getScene()

Scene UM.Controller.Controller.getScene ( self)
Get the scene

:return: scene

◆ getStage()

Optional[Stage] UM.Controller.Controller.getStage ( self,
str name )
Request stage by name. Returns None if no stage is found.

:param name: Unique identifier of stage (usually the plugin name)
:return: Stage if name was found, None otherwise.

◆ getTool()

Optional["Tool"] UM.Controller.Controller.getTool ( self,
str name )
Request tool by name. Returns None if no tool is found.

:param name: Unique identifier of tool (usually the plugin name)
:return: tool if name was found, None otherwise.

◆ getView()

Optional[View] UM.Controller.Controller.getView ( self,
str name )
Request view by name. Returns None if no view is found.

:return: View  if name was found, none otherwise.

◆ isToolOperationActive()

bool UM.Controller.Controller.isToolOperationActive ( self)
Gets whether a tool is currently in use

:return: true if a tool current being used.

◆ removeInputDevice()

None UM.Controller.Controller.removeInputDevice ( self,
str name )
Remove an input device from the list of input devices.

Does nothing if the input device is not in the list.
:param name: The name of the device to remove.

◆ setActiveStage()

None UM.Controller.Controller.setActiveStage ( self,
str name )
Set the currently active stage.

:param name: The name of the stage to set as active

◆ setActiveTool()

UM.Controller.Controller.setActiveTool ( self,
Optional[Union["Tool", str]] tool )
Set the current active tool.

The tool can be set by name of the tool or directly passing the tool object.
:param tool: A tool object or the name of a tool.

◆ setActiveView()

None UM.Controller.Controller.setActiveView ( self,
str name )
Set the currently active view.

:param name:  The name of the view to set as active

◆ setCameraOrigin()

UM.Controller.Controller.setCameraOrigin ( self,
str coordinate = "home" )
Changes the origin of the camera, i.e. where it looks at.

:param coordinate: One of the following options:
- "home": The centre of the build plate.
- "3d": The centre of the build volume.
- "x", "y" and "z": Also the centre of the build plate. These are just
aliases for the setCameraRotation function.

◆ setCameraTool()

UM.Controller.Controller.setCameraTool ( self,
Union["Tool", str] tool )
Set the tool used for handling camera controls.

Camera tool is the first tool to receive events.
The tool can be set by name of the tool or directly passing the tool object.
:param tool:
:sa setSelectionTool
:sa setActiveTool

◆ setFallbackTool()

None UM.Controller.Controller.setFallbackTool ( self,
str tool )
Set the current active tool. The tool must be set by name.

:param tool: The tools name which shall be used as fallback

◆ setSelectionTool()

UM.Controller.Controller.setSelectionTool ( self,
Union[str, "Tool"] tool )
Set the tool used for performing selections.

Selection tool receives its events after camera tool and active tool.
The tool can be set by name of the tool or directly passing the tool object.
:param tool:
:sa setCameraTool
:sa setActiveTool

The documentation for this class was generated from the following file: