Uranium
Application Framework
|
Application subclass that provides a Qt application object. More...
Public Member Functions | |
__init__ (self, tray_icon_name=None, **kwargs) | |
Init method. | |
recentFiles (self) | |
run (self) | |
Run the main event loop. | |
hideMessage (self, message) | |
showMessage (self, message) | |
showToastMessage (self, str title, str message) | |
setMainQml (self, path) | |
initializeEngine (self) | |
exec_ (self, *args, **kwargs) | |
reloadQML (self) | |
purgeWindows (self) | |
isShuttingDown (self) | |
registerObjects (self, engine) | |
getRenderer (self) | |
Return an application-specific Renderer object. | |
addCommandLineOptions (self, parser, parsed_command_line={}) | |
Can be overridden to add additional command line options to the parser. | |
getMainWindow (self) | |
getSplashScreen (self) | |
setMainWindow (self, window) | |
setVisible (self, visible) | |
isVisible (self) | |
getTheme (self) | |
functionEvent (self, event) | |
Post a function event onto the event loop. | |
event (self, event) | |
windowClosed (self) | |
checkWindowMinimizedState (self) | |
getBackend (self) | |
Get the backend of the application (the program that does the heavy lifting). | |
backend (self) | |
Property used to expose the backend It is made static as the backend is not supposed to change during runtime. | |
loadQtTranslation (self, file_name, language="default") | |
Load a Qt translation catalog. | |
createSplash (self) | |
showSplashMessage (self, message) | |
Display text on the splash screen. | |
closeSplash (self) | |
Close the splash screen after the application has started. | |
Optional["QObject"] | createQmlComponent (self, str qml_file_path, Dict[str, "QObject"] context_properties=None) |
Create a QML component from a qml file. | |
preventComputerFromSleeping (self, prevent) | |
![]() | |
__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) |
Public Attributes | |
assertID | |
![]() | |
setBackend | |
addExtension | |
default_theme | |
showMessage | |
hideMessage | |
Static Public Attributes | |
pluginsLoaded = Signal() | |
applicationRunning = Signal() | |
recentFilesChanged = pyqtSignal() | |
engineCreatedSignal = Signal() | |
mainWindowChanged = Signal() | |
![]() | |
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 | |
_onJobFinished (self, job) | |
_onMainWindowStateChanged (self, window_state) | |
_createSplashScreen (self) | |
_screenScaleFactor (self) | |
_getDefaultLanguage (self, file_name) | |
![]() | |
_loadPlugins (self) | |
Function that needs to be overridden by child classes with a list of plugin it needs. | |
Protected Attributes | |
_plugins_loaded | |
_main_qml | |
_engine | |
_renderer | |
_main_window | |
_theme | |
_shutting_down | |
_qml_import_paths | |
_parsed_command_line | |
_splash | |
_recent_files | |
_onJobFinished | |
_tray_icon | |
_tray_icon_widget | |
_application_name | |
_onMainWindowStateChanged | |
![]() | |
_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 | |
Additional Inherited Members | |
![]() | |
getInstallPrefix () | |
![]() | |
_instance = None | |
Application subclass that provides a Qt application object.
UM.Qt.QtApplication.QtApplication.__init__ | ( | self, | |
name = None , |
|||
** | version | ||
) |
Init method.
name | string The name of the application. |
version | string Version, formatted as major.minor.rev |
Reimplemented from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.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 from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.backend | ( | self | ) |
Optional["QObject"] UM.Qt.QtApplication.QtApplication.createQmlComponent | ( | self, | |
str | qml_file_path, | ||
Dict[str, "QObject"] | context_properties = None |
||
) |
Create a QML component from a qml file.
qml_file_path | The absolute file path to the root qml file. |
context_properties | Optional dictionary containing the properties that will be set on the context of the qml instance before creation. |
UM.Qt.QtApplication.QtApplication.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 from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.getBackend | ( | self | ) |
Get the backend of the application (the program that does the heavy lifting).
The backend is also a QObject, which can be used from qml.
Reimplemented from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.getRenderer | ( | self | ) |
Return an application-specific Renderer object.
NotImplementedError |
Reimplemented from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.hideMessage | ( | self, | |
message | |||
) |
Reimplemented from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.loadQtTranslation | ( | self, | |
file_name, | |||
language = "default" |
|||
) |
Load a Qt translation catalog.
This method will locate, load and install a Qt message catalog that can be used by Qt's translation system, like qsTr() in QML files.
file_name | The file name to load, without extension. It will be searched for in the i18nLocation Resources directory. If it can not be found a warning will be logged but no error will be thrown. |
language | The language to load translations for. This can be any valid language code or 'default' in which case the language is looked up based on system locale. If the specified language can not be found, this method will fall back to loading the english translations file. |
language
is default
, the language to load can be changed with the environment variable "LANGUAGE". UM.Qt.QtApplication.QtApplication.preventComputerFromSleeping | ( | self, | |
prevent | |||
) |
Function used to prevent the computer from going into sleep mode. :param prevent: True = Prevent the system from going to sleep from this point on. :param prevent: False = No longer prevent the system from going to sleep.
UM.Qt.QtApplication.QtApplication.run | ( | self | ) |
Run the main event loop.
This method should be re-implemented by subclasses to start the main event loop.
NotImplementedError |
Reimplemented from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.showMessage | ( | self, | |
message | |||
) |
Reimplemented from UM.Application.Application.
UM.Qt.QtApplication.QtApplication.showToastMessage | ( | self, | |
str | title, | ||
str | message | ||
) |
Reimplemented from UM.Application.Application.