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

Central object responsible for running the main event loop and creating other central objects. More...

Inheritance diagram for UM.Application.Application:
UM.Qt.QtApplication.QtApplication

Public Member Functions

 __init__ (self, str name, str version, str build_type="", is_debug_mode=False, parser=None, parsed_command_line={}, **kwargs)
 Init method.
 
 getContainerRegistry (self)
 
 setGlobalContainerStack (self, "ContainerStack" stack)
 
Optional["ContainerStack"] getGlobalContainerStack (self)
 
 hideMessage (self, message)
 
 showMessage (self, message)
 
 isExitAllowed (self)
 
 showToastMessage (self, str title, str message)
 
str getVersion (self)
 Get the version of the application.
 
 getStaticVersion (cls)
 
str getBuildType (self)
 Get the buildtype of the application.
 
bool getIsDebugMode (self)
 
 hideMessageById (self, message_id)
 Hide message by ID (as provided by built-in id function)
 
 getVisibleMessages (self)
 Get list of all visible messages.
 
 getCommandLineOption (self, name, default=None)
 
str getApplicationName (self)
 Get name of the application.
 
 getApplicationLanguage (self)
 Get the currently used IETF language tag.
 
 getRequiredPlugins (self)
 Application has a list of plugins that it must have.
 
 setRequiredPlugins (self, List[str] plugin_names)
 Set the plugins that the application must have in order to function.
 
 setBackend (self, "Backend" backend)
 Set the backend of the application (the program that does the heavy lifting).
 
"Backend" getBackend (self)
 Get the backend of the application (the program that does the heavy lifting).
 
PluginRegistry getPluginRegistry (self)
 Get the PluginRegistry of this application.
 
Controller getController (self)
 Get the Controller of this application.
 
MeshFileHandler getMeshFileHandler (self)
 Get the MeshFileHandler of this application.
 
WorkspaceFileHandler getWorkspaceFileHandler (self)
 
OperationStack getOperationStack (self)
 
OutputDeviceManager getOutputDeviceManager (self)
 
 preRun (self)
 Includes eg.
 
 run (self)
 Run the main event loop.
 
 getRenderer (self)
 Return an application-specific Renderer object.
 
 functionEvent (self, event)
 Post a function event onto the event loop.
 
 callLater (self, Callable[[Any], Any] func, *args, **kwargs)
 Call a function the next time the event loop runs.
 
 getMainThread (self)
 Get the application"s main thread.
 
"Application" getInstance (cls, **kwargs)
 Return the singleton instance of the application object.
 
 getCommandlineParser (self, with_help=False)
 
 parseCommandLine (self)
 
 addCommandLineOptions (cls, parser, parsed_command_line={})
 Can be overridden to add additional command line options to the parser.
 
 addExtension (self, "Extension" extension)
 
List["Extension"] getExtensions (self)
 

Static Public Member Functions

 getInstallPrefix ()
 

Public Attributes

 setBackend
 
 addExtension
 
 default_theme
 
 showMessage
 
 hideMessage
 

Static Public Attributes

 applicationShuttingDown = Signal()
 Emitted when the application window was closed and we need to shut down the application.
 
 showMessageSignal = Signal()
 
 hideMessageSignal = Signal()
 
 globalContainerStackChanged = Signal()
 
 workspaceLoaded = Signal()
 
 visibleMessageAdded = Signal()
 
 visibleMessageRemoved = Signal()
 

Protected Member Functions

 _loadPlugins (self)
 Function that needs to be overridden by child classes with a list of plugin it needs.
 

Protected Attributes

 _application_name
 
 _version
 
 _build_type
 
 _main_thread
 
 _renderer
 
 _controller
 
 _mesh_file_handler
 
 _workspace_file_handler
 
 _extensions
 
 _backend
 
 _output_device_manager
 
 _required_plugins
 
 _operation_stack
 
 _plugin_registry
 
 _command_line_parser
 
 _parsed_command_line
 
 _visible_messages
 
 _message_lock
 
 _global_container_stack
 

Static Protected Attributes

 _instance = None
 

Detailed Description

Central object responsible for running the main event loop and creating other central objects.

The Application object is a central object for accessing other important objects. It is also responsible for starting the main event loop. It is passed on to plugins so it can be easily used to access objects required for those plugins.

Constructor & Destructor Documentation

◆ __init__()

UM.Application.Application.__init__ (   self,
str  name,
str  version,
str   build_type = "",
  is_debug_mode = False,
  parser = None,
  parsed_command_line = {},
**  kwargs 
)

Init method.

Parameters
namestring The name of the application.
versionstring Version, formatted as major.minor.rev

Reimplemented in UM.Qt.QtApplication.QtApplication.

Member Function Documentation

◆ addCommandLineOptions()

UM.Application.Application.addCommandLineOptions (   cls,
  parser,
  parsed_command_line = {} 
)

Can be overridden to add additional command line options to the parser.

Parameters
parserargparse.ArgumentParser The parser that will parse the command line.

Reimplemented in UM.Qt.QtApplication.QtApplication.

◆ callLater()

UM.Application.Application.callLater (   self,
Callable[[Any], Any]  func,
args,
**  kwargs 
)

Call a function the next time the event loop runs.

Parameters
functionThe function to call.
argsThe positional arguments to pass to the function.
kwargsThe keyword arguments to pass to the function.

◆ functionEvent()

UM.Application.Application.functionEvent (   self,
  event 
)

Post a function event onto the event loop.

This takes a CallFunctionEvent object and puts it into the actual event loop.

Exceptions
NotImplementedError

Reimplemented in UM.Qt.QtApplication.QtApplication.

◆ getApplicationLanguage()

UM.Application.Application.getApplicationLanguage (   self)

Get the currently used IETF language tag.

The returned tag is during runtime used to translate strings.

Returns
language_tag string

◆ getApplicationName()

str UM.Application.Application.getApplicationName (   self)

Get name of the application.

Returns
application_name string

◆ getBackend()

"Backend" UM.Application.Application.getBackend (   self)

Get the backend of the application (the program that does the heavy lifting).

Returns
Backend Backend

Reimplemented in UM.Qt.QtApplication.QtApplication.

◆ getBuildType()

str UM.Application.Application.getBuildType (   self)

Get the buildtype of the application.

Returns
version string

◆ getController()

Controller UM.Application.Application.getController (   self)

Get the Controller of this application.

Returns
Controller Controller

◆ getMeshFileHandler()

MeshFileHandler UM.Application.Application.getMeshFileHandler (   self)

Get the MeshFileHandler of this application.

Returns
MeshFileHandler MeshFileHandler

◆ getPluginRegistry()

PluginRegistry UM.Application.Application.getPluginRegistry (   self)

Get the PluginRegistry of this application.

Returns
PluginRegistry PluginRegistry

◆ getRenderer()

UM.Application.Application.getRenderer (   self)

Return an application-specific Renderer object.

Exceptions
NotImplementedError

Reimplemented in UM.Qt.QtApplication.QtApplication.

◆ getRequiredPlugins()

UM.Application.Application.getRequiredPlugins (   self)

Application has a list of plugins that it must have.

If it does not have these, it cannot function. These plugins can not be disabled in any way.

Returns
required_plugins list

◆ getVersion()

str UM.Application.Application.getVersion (   self)

Get the version of the application.

Returns
version string

◆ getVisibleMessages()

UM.Application.Application.getVisibleMessages (   self)

Get list of all visible messages.

Returns
visible_messages list

◆ hideMessageById()

UM.Application.Application.hideMessageById (   self,
  message_id 
)

Hide message by ID (as provided by built-in id function)

Parameters
message_idlong

◆ preRun()

UM.Application.Application.preRun (   self)

Includes eg.

last checks before entering the main event loop.

Returns
None None

◆ run()

UM.Application.Application.run (   self)

Run the main event loop.

This method should be re-implemented by subclasses to start the main event loop.

Exceptions
NotImplementedError

Reimplemented in UM.Qt.QtApplication.QtApplication.

◆ setBackend()

UM.Application.Application.setBackend (   self,
"Backend"  backend 
)

Set the backend of the application (the program that does the heavy lifting).

Parameters
backendBackend

◆ setRequiredPlugins()

UM.Application.Application.setRequiredPlugins (   self,
List[str]  plugin_names 
)

Set the plugins that the application must have in order to function.

Parameters
plugin_nameslist List of strings with the names of the required plugins

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