Uranium
Application Framework
|
Central object responsible for running the main event loop and creating other central objects. More...
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. | |
Static Protected Attributes | |
_instance = None | |
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.
UM.Application.Application.__init__ | ( | self, | |
str | name, | ||
str | version, | ||
str | build_type = "" , |
||
is_debug_mode = False , |
|||
parser = None , |
|||
parsed_command_line = {} , |
|||
** | kwargs | ||
) |
Init method.
name | string The name of the application. |
version | string Version, formatted as major.minor.rev |
Reimplemented in UM.Qt.QtApplication.QtApplication.
UM.Application.Application.addCommandLineOptions | ( | cls, | |
parser, | |||
parsed_command_line = {} |
|||
) |
Can be overridden to add additional command line options to the parser.
parser | argparse.ArgumentParser The parser that will parse the command line. |
Reimplemented in UM.Qt.QtApplication.QtApplication.
UM.Application.Application.callLater | ( | self, | |
Callable[[Any], Any] | func, | ||
* | args, | ||
** | kwargs | ||
) |
Call a function the next time the event loop runs.
function | The function to call. |
args | The positional arguments to pass to the function. |
kwargs | The keyword arguments to pass to the function. |
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.
NotImplementedError |
Reimplemented in UM.Qt.QtApplication.QtApplication.
UM.Application.Application.getApplicationLanguage | ( | self | ) |
Get the currently used IETF language tag.
The returned tag is during runtime used to translate strings.
str UM.Application.Application.getApplicationName | ( | self | ) |
Get name of the application.
"Backend" UM.Application.Application.getBackend | ( | self | ) |
Get the backend of the application (the program that does the heavy lifting).
Reimplemented in UM.Qt.QtApplication.QtApplication.
str UM.Application.Application.getBuildType | ( | self | ) |
Get the buildtype of the application.
Controller UM.Application.Application.getController | ( | self | ) |
Get the Controller of this application.
MeshFileHandler UM.Application.Application.getMeshFileHandler | ( | self | ) |
Get the MeshFileHandler of this application.
PluginRegistry UM.Application.Application.getPluginRegistry | ( | self | ) |
Get the PluginRegistry of this application.
UM.Application.Application.getRenderer | ( | self | ) |
Return an application-specific Renderer object.
NotImplementedError |
Reimplemented in UM.Qt.QtApplication.QtApplication.
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.
str UM.Application.Application.getVersion | ( | self | ) |
Get the version of the application.
UM.Application.Application.getVisibleMessages | ( | self | ) |
Get list of all visible messages.
UM.Application.Application.hideMessageById | ( | self, | |
message_id | |||
) |
Hide message by ID (as provided by built-in id function)
message_id | long |
UM.Application.Application.preRun | ( | self | ) |
Includes eg.
last checks before entering the main event loop.
UM.Application.Application.run | ( | self | ) |
Run the main event loop.
This method should be re-implemented by subclasses to start the main event loop.
NotImplementedError |
Reimplemented in UM.Qt.QtApplication.QtApplication.
UM.Application.Application.setBackend | ( | self, | |
"Backend" | backend | ||
) |
Set the backend of the application (the program that does the heavy lifting).
backend | Backend |
UM.Application.Application.setRequiredPlugins | ( | self, | |
List[str] | plugin_names | ||
) |
Set the plugins that the application must have in order to function.
plugin_names | list List of strings with the names of the required plugins |