Uranium
Application Framework
UM.Message.Message Class Reference
Inheritance diagram for UM.Message.Message:
UM.ConfigurationErrorMessage.ConfigurationErrorMessage

Public Member Functions

None __init__ (self, str text="", int lifetime=30, bool dismissable=True, float progress=None, Optional[str] title=None, parent=None, bool use_inactivity_timer=True, str image_source="", str image_caption="", str option_text="", bool option_state=True)
 
None show (self)
 
bool visible (self)
 
bool isDismissable (self)
 
None setLifetimeTimer (self, QTimer timer)
 
None setInactivityTimer (self, QTimer inactivity_timer)
 
def addAction (self, str action_id, str name, str icon, str description, int button_style=ActionButtonStyle.DEFAULT, int button_align=ActionButtonAlignment.ALIGN_RIGHT)
 
List[Dict[str, Union[str, int]]] getActions (self)
 
str getOptionText (self)
 
bool getOptionState (self)
 
str getImageSource (self)
 
str getImageCaption (self)
 
None setText (self, str text)
 
str getText (self)
 
None setMaxProgress (self, float max_progress)
 
float getMaxProgress (self)
 
None setProgress (self, Optional[float] progress)
 
Optional[float] getProgress (self)
 
None setTitle (self, str title)
 
Optional[str] getTitle (self)
 
None hide (self, send_signal=True)
 

Static Public Attributes

 inactivityTimerStop = pyqtSignal()
 
 inactivityTimerStart = pyqtSignal()
 
 actionTriggered = Signal()
 
 optionToggled = Signal()
 
 titleChanged = Signal()
 
 textChanged = Signal()
 
 progressChanged = Signal()
 

Detailed Description

Class for displaying messages to the user.

Constructor & Destructor Documentation

◆ __init__()

None UM.Message.Message.__init__ (   self,
str   text = "",
int   lifetime = 30,
bool   dismissable = True,
float   progress = None,
Optional[str]   title = None,
  parent = None,
bool   use_inactivity_timer = True,
str   image_source = "",
str   image_caption = "",
str   option_text = "",
bool   option_state = True 
)
Class for displaying messages to the user.
Even though the lifetime can be set, in certain cases it can still have a lifetime if nothing happens with the
the message.
We define the following cases:

- A message is dismissible; No timeout (set by lifetime or inactivity)
- A message is set to not dismissible, without progress; We force the dismissible property to be true
- A message is set to not dismissible, with progress; After 30 seconds of no progress updates we hide the message.

:param text: Text that needs to be displayed in the message
:param lifetime: How long should the message be displayed (in seconds).
    if lifetime is 0, it will never automatically be destroyed.
:param dismissible: Can the user dismiss the message?
:param title: Phrase that will be shown above the message
:param image_source: an absolute path where an image can be found to be displayed (QUrl.toLocalFile()) can be used for that.
:param image_caption: Text to be displayed below the image (or anywhere really, it's up tot the QML to handle that)
:param progress: Is there nay progress to be displayed? if -1, it's seen as indeterminate

Member Function Documentation

◆ addAction()

def UM.Message.Message.addAction (   self,
str  action_id,
str  name,
str  icon,
str  description,
int   button_style = ActionButtonStyle.DEFAULT,
int   button_align = ActionButtonAlignment.ALIGN_RIGHT 
)
Add an action to the message

Actions are useful for making messages that require input from the user.
:param action_id:
:param name: The displayed name of the action
:param icon: Source of the icon to be used
:param button_style: Description the button style (used for Button and Link)
:param button_align: Define horizontal position of the action item

◆ getActions()

List[Dict[str, Union[str, int]]] UM.Message.Message.getActions (   self)
Get the list of actions to display buttons for on the message.

Each action is a dictionary with the elements provided in ``addAction``.

:return: A list of actions.

◆ getMaxProgress()

float UM.Message.Message.getMaxProgress (   self)
Gets the maximum value of the progress bar on the message.

Note that this is not the _current_ value of the progress bar!

:return: The maximum value of the progress bar on the message.

:see getProgress

◆ getProgress()

Optional[float] UM.Message.Message.getProgress (   self)
Returns the current progress.

This should be a value between 0 and the value of ``getMaxProgress()``.
If no progress is set (because the message doesn't have it) None is returned

◆ getText()

str UM.Message.Message.getText (   self)
Returns the text in the message.

:return: The text in the message.

◆ getTitle()

Optional[str] UM.Message.Message.getTitle (   self)
Returns the message title.

:return: The message title.

◆ hide()

None UM.Message.Message.hide (   self,
  send_signal = True 
)
Hides this message.

While the message object continues to exist in memory, it appears to the
user that it is gone.

◆ isDismissable()

bool UM.Message.Message.isDismissable (   self)
Can the message be closed by user?

◆ setInactivityTimer()

None UM.Message.Message.setInactivityTimer (   self,
QTimer  inactivity_timer 
)
Set the inactivity timer of the message.

This function is required as the QTimer needs to be created on a QThread.

◆ setLifetimeTimer()

None UM.Message.Message.setLifetimeTimer (   self,
QTimer  timer 
)
Set the lifetime timer of the message.

This is used by the QT application once the message is shown.
If the lifetime is set to 0, no timer is added.
This function is required as the QTimer needs to be created on a QThread.

◆ setMaxProgress()

None UM.Message.Message.setMaxProgress (   self,
float  max_progress 
)
Sets the maximum numerical value of the progress bar on the message.

If the reported progress hits this number, the bar will appear filled.

◆ setProgress()

None UM.Message.Message.setProgress (   self,
Optional[float]  progress 
)
Changes the state of the progress bar.

:param progress: The new progress to display to the user. This should be
between 0 and the value of `getMaxProgress()`. None to remove the progressbar

◆ setText()

None UM.Message.Message.setText (   self,
str  text 
)
Changes the text on the message.

:param text: The new text for the message. Please ensure that this text
    is internationalised.

◆ setTitle()

None UM.Message.Message.setTitle (   self,
str  title 
)
Changes the message title.

:param title: The new title for the message. Please ensure that this text
is internationalised.

◆ show()

None UM.Message.Message.show (   self)
Show the message (if not already visible)

◆ visible()

bool UM.Message.Message.visible (   self)
Returns a boolean indicating whether the message is currently visible.

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