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

Application subclass that provides a Qt application object. More...

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

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)
 
- Public Member Functions inherited from UM.Application.Application
 __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
 
- Public Attributes inherited from UM.Application.Application
 setBackend
 
 addExtension
 
 default_theme
 
 showMessage
 
 hideMessage
 

Static Public Attributes

 pluginsLoaded = Signal()
 
 applicationRunning = Signal()
 
 recentFilesChanged = pyqtSignal()
 
 engineCreatedSignal = Signal()
 
 mainWindowChanged = Signal()
 
- Static Public Attributes inherited from UM.Application.Application
 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)
 
- Protected Member Functions inherited from UM.Application.Application
 _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
 
- Protected Attributes inherited from UM.Application.Application
 _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

- Static Public Member Functions inherited from UM.Application.Application
 getInstallPrefix ()
 
- Static Protected Attributes inherited from UM.Application.Application
 _instance = None
 

Detailed Description

Application subclass that provides a Qt application object.

Constructor & Destructor Documentation

◆ __init__()

UM.Qt.QtApplication.QtApplication.__init__ (   self,
  name = None,
**  version 
)

Init method.

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

Reimplemented from UM.Application.Application.

Member Function Documentation

◆ addCommandLineOptions()

UM.Qt.QtApplication.QtApplication.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 from UM.Application.Application.

◆ backend()

UM.Qt.QtApplication.QtApplication.backend (   self)

Property used to expose the backend It is made static as the backend is not supposed to change during runtime.

This makes the connection between backend and QML more reliable than the pyqtSlot above.

Returns
Backend Backend

◆ createQmlComponent()

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.

Parameters
qml_file_pathThe absolute file path to the root qml file.
context_propertiesOptional dictionary containing the properties that will be set on the context of the qml instance before creation.
Returns
None in case the creation failed (qml error), else it returns the qml instance.
Note
If the creation fails, this function will ensure any errors are logged to the logging service.

◆ functionEvent()

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.

Exceptions
NotImplementedError

Reimplemented from UM.Application.Application.

◆ getBackend()

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.

Returns
Backend Backend

Reimplemented from UM.Application.Application.

◆ getRenderer()

UM.Qt.QtApplication.QtApplication.getRenderer (   self)

Return an application-specific Renderer object.

Exceptions
NotImplementedError

Reimplemented from UM.Application.Application.

◆ hideMessage()

UM.Qt.QtApplication.QtApplication.hideMessage (   self,
  message 
)

Reimplemented from UM.Application.Application.

◆ loadQtTranslation()

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.

Parameters
file_nameThe 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.
languageThe 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.
Note
When language is default, the language to load can be changed with the environment variable "LANGUAGE".

◆ preventComputerFromSleeping()

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.

◆ run()

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.

Exceptions
NotImplementedError

Reimplemented from UM.Application.Application.

◆ showMessage()

UM.Qt.QtApplication.QtApplication.showMessage (   self,
  message 
)

Reimplemented from UM.Application.Application.

◆ showToastMessage()

UM.Qt.QtApplication.QtApplication.showToastMessage (   self,
str  title,
str  message 
)

Reimplemented from UM.Application.Application.


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