Uranium
Application Framework
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

def __init__ (self, name, version, buildtype="", kwargs)
 Init method. More...
 
def getContainerRegistry (self)
 
def setGlobalContainerStack (self, stack)
 
def getGlobalContainerStack (self)
 
def hideMessage (self, message)
 
def showMessage (self, message)
 
def getVersion (self)
 Get the version of the application. More...
 
def getStaticVersion (cls)
 
def getBuildType (self)
 Get the buildtype of the application. More...
 
def hideMessageById (self, message_id)
 Remove a message from the visible message list so it will no longer be displayed. More...
 
def getVisibleMessages (self)
 Get list of all visible messages. More...
 
def getCommandLineOption (self, name, default=None)
 
def getApplicationName (self)
 Get name of the application. More...
 
def getApplicationLanguage (self)
 
def getRequiredPlugins (self)
 Application has a list of plugins that it must have. More...
 
def setRequiredPlugins (self, plugin_names)
 Set the plugins that the application must have in order to function. More...
 
def setBackend (self, backend)
 Set the backend of the application (the program that does the heavy lifting). More...
 
def getBackend (self)
 Get the backend of the application (the program that does the heavy lifting). More...
 
def getPluginRegistry (self)
 Get the PluginRegistry of this application. More...
 
def getController (self)
 Get the Controller of this application. More...
 
def getMeshFileHandler (self)
 Get the MeshFileHandler of this application. More...
 
def getWorkspaceFileHandler (self)
 
def getOperationStack (self)
 
def getOutputDeviceManager (self)
 
def run (self)
 Run the main event loop. More...
 
def getRenderer (self)
 Return an application-specific Renderer object. More...
 
def functionEvent (self, event)
 Post a function event onto the event loop. More...
 
def callLater (self, function, args, kwargs)
 Call a function the next time the event loop runs. More...
 
def getMainThread (self)
 Get the application"s main thread. More...
 
def getInstance (cls)
 Return the singleton instance of the application object.
 
def parseCommandLine (self)
 
def addCommandLineOptions (cls, parser)
 Can be overridden to add additional command line options to the parser. More...
 
def addExtension (self, extension)
 
def getExtensions (self)
 

Static Public Member Functions

def getInstallPrefix ()
 

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()
 
 visibleMessageAdded = Signal()
 Add a message to the visible message list so it will be displayed. More...
 
 visibleMessageRemoved = Signal()
 

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__()

def UM.Application.Application.__init__ (   self,
  name,
  version,
  buildtype = "",
  kwargs 
)

Init method.

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

Member Function Documentation

◆ addCommandLineOptions()

def UM.Application.Application.addCommandLineOptions (   cls,
  parser 
)

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

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

◆ callLater()

def UM.Application.Application.callLater (   self,
  function,
  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()

def 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

◆ getApplicationName()

def UM.Application.Application.getApplicationName (   self)

Get name of the application.

Returns
application_name string

◆ getBackend()

def UM.Application.Application.getBackend (   self)

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

Returns
Backend Backend

◆ getBuildType()

def UM.Application.Application.getBuildType (   self)

Get the buildtype of the application.

Returns
version string

◆ getController()

def UM.Application.Application.getController (   self)

Get the Controller of this application.

Returns
Controller Controller

◆ getMainThread()

def UM.Application.Application.getMainThread (   self)

Get the application"s main thread.

◆ getMeshFileHandler()

def UM.Application.Application.getMeshFileHandler (   self)

Get the MeshFileHandler of this application.

Returns
MeshFileHandler MeshFileHandler

◆ getPluginRegistry()

def UM.Application.Application.getPluginRegistry (   self)

Get the PluginRegistry of this application.

Returns
PluginRegistry PluginRegistry

◆ getRenderer()

def UM.Application.Application.getRenderer (   self)

Return an application-specific Renderer object.

Exceptions
NotImplementedError

◆ getRequiredPlugins()

def 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()

def UM.Application.Application.getVersion (   self)

Get the version of the application.

Returns
version string

◆ getVisibleMessages()

def UM.Application.Application.getVisibleMessages (   self)

Get list of all visible messages.

Returns
visible_messages list

◆ hideMessageById()

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

Remove a message from the visible message list so it will no longer be displayed.

This should only be called by message object itself. in principle, this should only be called by the message itself (hide)

Parameters
messageMessage message object
See also
Message::hide() def hideMessage(self, message): with self._message_lock: if message in self._visible_messages: self._visible_messages.remove(message) self.visibleMessageRemoved.emit(message) Hide message by ID (as provided by built-in id function)
Parameters
message_idlong

◆ run()

def 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

◆ setBackend()

def UM.Application.Application.setBackend (   self,
  backend 
)

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

Parameters
backendBackend

◆ setRequiredPlugins()

def UM.Application.Application.setRequiredPlugins (   self,
  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

Member Data Documentation

◆ visibleMessageAdded

UM.Application.Application.visibleMessageAdded = Signal()
static

Add a message to the visible message list so it will be displayed.

This should only be called by message object itself. To show a message, simply create it and call its .show() function.

Parameters
messageMessage message object
See also
Message::show() def showMessage(self, message): with self._message_lock: if message not in self._visible_messages: self._visible_messages.append(message) self.visibleMessageAdded.emit(message)

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