Uranium
Application Framework
UM.Controller.Controller Class Reference

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

Public Member Functions

None __init__ (self, "Application" application)
 
None addView (self, View view)
 Add a view by name if it"s not already added. More...
 
Optional[ViewgetView (self, str name)
 Request view by name. More...
 
Dict[str, ViewgetAllViews (self)
 Return all views. More...
 
Optional[ViewgetActiveView (self)
 Request active view. More...
 
None setActiveView (self, str name)
 Set the currently active view. More...
 
None addStage (self, Stage stage)
 Add a stage by name if it's not already added. More...
 
Optional[StagegetStage (self, str name)
 Request stage by name. More...
 
Dict[str, StagegetAllStages (self)
 Return all stages. More...
 
Optional[StagegetActiveStage (self)
 Request active stage. More...
 
None setActiveStage (self, str name)
 Set the currently active stage. More...
 
None addInputDevice (self, InputDevice device)
 Add an input device (e.g. More...
 
Optional[InputDevicegetInputDevice (self, str name)
 Request input device by name. More...
 
None removeInputDevice (self, str name)
 Remove an input device from the list of input devices. More...
 
str getFallbackTool (self)
 Request the current fallbacl tool. More...
 
None setFallbackTool (self, str tool)
 Set the current active tool. More...
 
Optional["Tool"] getTool (self, str name)
 Request tool by name. More...
 
Dict[str, "Tool"] getAllTools (self)
 Get all tools. More...
 
None addTool (self, "Tool" tool)
 Add a Tool (transform object, translate object) if its not already added. More...
 
bool isToolOperationActive (self)
 Gets whether a tool is currently in use. More...
 
Optional["Tool"] getActiveTool (self)
 Request active tool. More...
 
def setActiveTool (self, Optional[Union["Tool", str]] tool)
 Set the current active tool. More...
 
Scene getScene (self)
 Get the scene. More...
 
def event (self, Event event)
 Process an event. More...
 
def setCameraTool (self, Union["Tool", str] tool)
 Set the tool used for handling camera controls. More...
 
Optional["Tool"] getCameraTool (self)
 Get the camera tool (if any) More...
 
def setSelectionTool (self, Union[str, "Tool"] tool)
 Set the tool used for performing selections. More...
 
bool getToolsEnabled (self)
 
None setToolsEnabled (self, bool enabled)
 
None deleteAllNodesWithMeshData (self, bool only_selectable=True)
 
None setCameraRotation (self, str coordinate="x", int angle=0)
 
def setCameraOrigin (self, str coordinate="home")
 Changes the origin of the camera, i.e. More...
 

Static Public Attributes

 viewsChanged = Signal()
 Emitted when the list of views changes.
 
 activeViewChanged = Signal()
 Emitted when the active view changes.
 
 stagesChanged = Signal()
 Emitted when the list of stages changes.
 
 activeStageChanged = Signal()
 Emitted when the active stage changes.
 
 toolsChanged = Signal()
 Emitted when the list of tools changes.
 
 toolEnabledChanged = Signal()
 Emitted when a tool changes its enabled state.
 
 activeToolChanged = Signal()
 Emitted when the active tool changes.
 
 toolOperationStarted = Signal()
 Emitted whenever a tool starts a longer operation. More...
 
 toolOperationStopped = Signal()
 Emitted whenever a tool stops a longer operation. More...
 
 contextMenuRequested = Signal()
 

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.

See also
View
Tool
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.

Parameters
deviceThe input device to be added

◆ addStage()

None UM.Controller.Controller.addStage (   self,
Stage  stage 
)

Add a stage by name if it's not already added.

Parameters
namestring Unique identifier of stage (usually the plugin name)
stageStage 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.

Parameters
toolTool Tool to be added

◆ addView()

None UM.Controller.Controller.addView (   self,
View  view 
)

Add a view by name if it"s not already added.

Parameters
viewView The view to be added

◆ event()

def UM.Controller.Controller.event (   self,
Event  event 
)

Process an event.

Parameters
eventEvent event to be handle. 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.

◆ getActiveStage()

Optional[Stage] UM.Controller.Controller.getActiveStage (   self)

Request active stage.

Returns None if there is no active stage

Returns
stage 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

Returns
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

Returns
view View if an view is active, None otherwise.

◆ getAllStages()

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

Return all stages.

Returns
stages dict

◆ getAllTools()

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

Get all tools.

Returns
tools dict

◆ getAllViews()

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

Return all views.

Returns
views dict

◆ 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.

Returns
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.

Parameters
namestring Unique identifier of input device (usually the plugin name)
Returns
input InputDevice device if name was found, none otherwise.

◆ getScene()

Scene UM.Controller.Controller.getScene (   self)

Get the scene.

Returns
scene Scene

◆ getStage()

Optional[Stage] UM.Controller.Controller.getStage (   self,
str  name 
)

Request stage by name.

Returns None if no stage is found.

Parameters
namestring Unique identifier of stage (usually the plugin name)
Returns
Stage 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.

Parameters
namestring Unique identifier of tool (usually the plugin name)
Returns
tool 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.

Returns
View View if name was found, none otherwise.

◆ isToolOperationActive()

bool UM.Controller.Controller.isToolOperationActive (   self)

Gets whether a tool is currently in use.

Returns
bool 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.

Parameters
namestring The name of the device to remove.

◆ setActiveStage()

None UM.Controller.Controller.setActiveStage (   self,
str  name 
)

Set the currently active stage.

Parameters
namestring The name of the stage to set as active

◆ setActiveTool()

def 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.

Parameters
toolA tool object or the name of a tool.

◆ setActiveView()

None UM.Controller.Controller.setActiveView (   self,
str  name 
)

Set the currently active view.

Parameters
namestring The name of the view to set as active

◆ setCameraOrigin()

def UM.Controller.Controller.setCameraOrigin (   self,
str   coordinate = "home" 
)

Changes the origin of the camera, i.e.

where it looks at.

Parameters
coordinateOne 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()

def 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.

Parameters
toolTool or string
See also
setSelectionTool
setActiveTool

◆ setFallbackTool()

None UM.Controller.Controller.setFallbackTool (   self,
str  tool 
)

Set the current active tool.

The tool must be set by name.

Parameters
toolThe tools name which shall be used as fallback

◆ setSelectionTool()

def 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.

Parameters
toolTool or string
See also
setCameraTool
setActiveTool

Member Data Documentation

◆ toolOperationStarted

UM.Controller.Controller.toolOperationStarted = Signal()
static

Emitted whenever a tool starts a longer operation.

Parameters
toolThe tool that started the operation.
See also
Tool::startOperation

◆ toolOperationStopped

UM.Controller.Controller.toolOperationStopped = Signal()
static

Emitted whenever a tool stops a longer operation.

Parameters
toolThe tool that stopped the operation.
See also
Tool::stopOperation

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