Package muntjac :: Package ui :: Module window :: Class Notification
[hide private]
[frames] | no frames]

Class Notification

source code

object --+
         |
        Notification

A notification message, used to display temporary messages to the user - for example "Document saved", or "Save failed".

The notification message can consist of several parts: caption, description and icon. It is usually used with only caption - one should be wary of filling the notification with too much information.

The notification message tries to be as unobtrusive as possible, while still drawing needed attention. There are several basic types of messages that can be used in different situations:

In addition to the basic pre-configured types, a Notification can also be configured to show up in a custom position, for a specified time (or until clicked), and with a custom stylename. An icon can also be added.

Instance Methods [hide private]
 
__init__(self, *args)
Creates a notification message.
source code
 
setType(self, typ) source code
 
getCaption(self)
Gets the caption part of the notification message.
source code
 
setCaption(self, caption)
Sets the caption part of the notification message
source code
 
getMessage(self) source code
 
setMessage(self, description) source code
 
getDescription(self)
Gets the description part of the notification message.
source code
 
setDescription(self, description)
Sets the description part of the notification message.
source code
 
getPosition(self)
Gets the position of the notification message.
source code
 
setPosition(self, position)
Sets the position of the notification message.
source code
 
getIcon(self)
Gets the icon part of the notification message.
source code
 
setIcon(self, icon)
Sets the icon part of the notification message.
source code
 
getDelayMsec(self)
Gets the delay before the notification disappears.
source code
 
setDelayMsec(self, delayMsec)
Sets the delay before the notification disappears.
source code
 
setStyleName(self, styleName)
Sets the style name for the notification message.
source code
 
getStyleName(self)
Gets the style name for the notification message.
source code
 
setHtmlContentAllowed(self, htmlContentAllowed)
Sets whether html is allowed in the caption and description.
source code
 
isHtmlContentAllowed(self)
Checks whether caption and description are interpreted as html or plain text.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  TYPE_HUMANIZED_MESSAGE = 1
  TYPE_WARNING_MESSAGE = 2
  TYPE_ERROR_MESSAGE = 3
  TYPE_TRAY_NOTIFICATION = 4
  POSITION_CENTERED = 1
  POSITION_CENTERED_TOP = 2
  POSITION_CENTERED_BOTTOM = 3
  POSITION_TOP_LEFT = 4
  POSITION_TOP_RIGHT = 5
  POSITION_BOTTOM_LEFT = 6
  POSITION_BOTTOM_RIGHT = 7
  DELAY_FOREVER = -1
  DELAY_NONE = 0
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 

Creates a notification message.

Care should be taken to to avoid XSS vulnerabilities as the caption and description are by default rendered as html.

Parameters:
  • args - tuple of the form
    • (caption)
      1. The message to show
    • (caption, type)
      1. The message to show
      2. The type of message
    • (caption, description)
      1. The message caption
      2. The message description
    • (caption, description, type)
      1. The message caption
      2. The message description
      3. The type of message
    • (caption, description, type, htmlContentAllowed)
      1. The message caption
      2. The message description
      3. The type of message
      4. Whether html in the caption and description should be displayed as html or as plain text
Overrides: object.__init__

getCaption(self)

source code 

Gets the caption part of the notification message.

Returns:
The message caption

setCaption(self, caption)

source code 

Sets the caption part of the notification message

Parameters:
  • caption - The message caption

getMessage(self)

source code 

Deprecated: Use getDescription instead.

setMessage(self, description)

source code 

Deprecated: Use setDescription instead.

getDescription(self)

source code 

Gets the description part of the notification message.

Returns:
The message description.

getPosition(self)

source code 

Gets the position of the notification message.

Returns:
The position

setPosition(self, position)

source code 

Sets the position of the notification message.

Parameters:
  • position - The desired notification position

getIcon(self)

source code 

Gets the icon part of the notification message.

Returns:
The message icon

setIcon(self, icon)

source code 

Sets the icon part of the notification message.

Parameters:
  • icon - The desired message icon

getDelayMsec(self)

source code 

Gets the delay before the notification disappears.

Returns:
the delay in msec, -1 indicates the message has to be clicked.

setDelayMsec(self, delayMsec)

source code 

Sets the delay before the notification disappears.

Parameters:
  • delayMsec - the desired delay in msec, -1 to require the user to click the message

setStyleName(self, styleName)

source code 

Sets the style name for the notification message.

Parameters:
  • styleName - The desired style name.

setHtmlContentAllowed(self, htmlContentAllowed)

source code 

Sets whether html is allowed in the caption and description. If set to true, the texts are passed to the browser as html and the developer is responsible for ensuring no harmful html is used. If set to false, the texts are passed to the browser as plain text.

Parameters:
  • htmlContentAllowed - true if the texts are used as html, false if used as plain text

isHtmlContentAllowed(self)

source code 

Checks whether caption and description are interpreted as html or plain text.

Returns:
true if the texts are used as html, false if used as plain text