Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Message.Message Class Reference

Class for displaying messages to the user. More...

Inherits QObject.

Public Member Functions

 __init__ (self, text="", lifetime=30, dismissable=True, progress=None, title=None, parent=None, type=MessageType.Info)
 Class for displaying messages to the user.
 
 show (self)
 Show the message (if not already visible)
 
 isDismissable (self)
 Can the message be closed by user?
 
 setLifetimeTimer (self, timer)
 Set the lifetime timer of the message.
 
 setInactivityTimer (self, inactivity_timer)
 Set the inactivity timer of the message.
 
 addAction (self, action_id, name, icon, description, button_style=ActionButtonStyle.DEFAULT)
 Add an action to the message Actions are useful for making messages that require input from the user.
 
 getActions (self)
 Get the list of actions to display buttons for on the message.
 
 setText (self, str text)
 Changes the text on the message.
 
str getText (self)
 Returns the text in the message.
 
 getType (self)
 
 setMaxProgress (self, max_progress)
 Sets the maximum numerical value of the progress bar on the message.
 
 getMaxProgress (self)
 Gets the maximum value of the progress bar on the message.
 
 setProgress (self, progress)
 Changes the state of the progress bar.
 
 getProgress (self)
 Returns the current progress.
 
 setTitle (self, str title)
 Changes the message title.
 
str getTitle (self)
 Returns the message title.
 
 hide (self)
 Hides this message.
 

Public Attributes

 hide
 

Static Public Attributes

 inactivityTimerStop = pyqtSignal()
 
 inactivityTimerStart = pyqtSignal()
 
 actionTriggered = Signal()
 
 progressChanged = Signal()
 Signal that gets emitted whenever the state of the progress bar on this message changes.
 

Protected Member Functions

 _stopInactivityTimer (self)
 
 _startInactivityTimer (self)
 
 _onInactivityTriggered (self)
 

Protected Attributes

 _application
 
 _visible
 
 _text
 
 _progress
 
 _max_progress
 
 _lifetime
 
 _lifetime_timer
 
 _inactivity_timer
 
 _dismissable
 
 _actions
 
 _type
 
 _title
 
 _onInactivityTriggered
 
 _startInactivityTimer
 
 _stopInactivityTimer
 

Detailed Description

Class for displaying messages to the user.

Constructor & Destructor Documentation

◆ __init__()

UM.Message.Message.__init__ (   self,
  text = "",
  lifetime = 30,
  dismissable = True,
  progress = None,
  title = None,
  parent = None,
  type = MessageType.Info 
)

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.
    Parameters
    textText that needs to be displayed in the message
    lifetimeHow long should the message be displayed (in seconds). if lifetime is 0, it will never automatically be destroyed.
    dismissibleCan the user dismiss the message?
    titlePhrase that will be shown above the message \progress Is there nay progress to be displayed? if -1, it's seen as indeterminate

Member Function Documentation

◆ addAction()

UM.Message.Message.addAction (   self,
  action_id,
  name,
  icon,
  description,
  button_style = ActionButtonStyle.DEFAULT 
)

Add an action to the message Actions are useful for making messages that require input from the user.

Parameters
action_id
nameThe displayed name of the action
iconSource of the icon to be used
descriptionDescription of the item (used for mouse over, etc)

◆ getActions()

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.

Returns
A list of actions.

◆ getMaxProgress()

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!

Returns
The maximum value of the progress bar on the message.
See also
getProgress

◆ getProgress()

UM.Message.Message.getProgress (   self)

Returns the current progress.

This should be a value between 0 and the value of getMaxProgress().

◆ getText()

str UM.Message.Message.getText (   self)

Returns the text in the message.

Returns
The text in the message.

◆ getTitle()

str UM.Message.Message.getTitle (   self)

Returns the message title.

Returns
The message title.

◆ hide()

UM.Message.Message.hide (   self)

Hides this message.

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

◆ setInactivityTimer()

UM.Message.Message.setInactivityTimer (   self,
  inactivity_timer 
)

Set the inactivity timer of the message.

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

◆ setLifetimeTimer()

UM.Message.Message.setLifetimeTimer (   self,
  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()

UM.Message.Message.setMaxProgress (   self,
  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()

UM.Message.Message.setProgress (   self,
  progress 
)

Changes the state of the progress bar.

Parameters
progressThe new progress to display to the user. This should be between 0 and the value of getMaxProgress().

◆ setText()

UM.Message.Message.setText (   self,
str  text 
)

Changes the text on the message.

Parameters
textThe new text for the message. Please ensure that this text is internationalised.

◆ setTitle()

UM.Message.Message.setTitle (   self,
str  title 
)

Changes the message title.

Parameters
textThe new title for the message. Please ensure that this text is internationalised.

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