Skip to content

Notification

Adam Furman edited this page Mar 20, 2016 · 1 revision

###Notification class The Notification class provides a way to create a notification that appears in the notification menu. Each notification has a title, a text description, and an optional callback application and optional icon. If the callback application is provided, then clicking the notification will activate the app.

Notification ( str title, str text, **data )

A list of all current notifications is accessible via state.getNotificationQueue(). The notification menu GUI component is accessible via state.getFunctionBar().notificationMenu.

Data

  • source = ( Application or None ) The application from which the notification originated.
  • image = ( str or pygame.Surface or None ) The image to display. Either the path to the image, or the Surface, or the "unknown" icon if nothing is provided.
  • method onSelected An alternative to source. The method to call when the notification is clicked.
  • tuple onSelectedData The data to pass to onSelected when it is called.

Object Variables

  • str title The title of the notification.
  • str text The text of the notification.
  • bool active Whether the notification is active. Inactive notifications are cleared from the menu.
  • Application source The app that sent the notification. Can be None.
  • GUI.Image image The Image created from the data passed to the constructor.
  • onSelectedMethod The method to run when the user clicks the notification. Set to the activate method of source if source is provided and onSelected is not. Otherwise, this is the onSelected method (see Data).
  • tuple onSelectedData The data to pass to onSelected when it is run.

Methods

  • onSelected () Runs the onSelected method, passing onSelectedData. Also clears the notification.
  • clear () Deactivates the notification and sweeps it from the menu.
  • getContainer ( c_width=200, c_height=40 ) Creates the container for the notification with the specified height and width. Called by the NotificationMenu class.

Home

Getting Started

Documentation

Threads and Tasks

Applications and Notifications

The State Class and Variable

The GUI, Events, Resources, and Dialogs

The following classes are all under the GUI class, e.g. Font is actually accessed as GUI.Font.

  • Font class
  • Icons class
  • ColorPalette class
  • LongClickEvent class
  • IntermediateUpdateEvent class
  • EventQueue class
  • FunctionBar class
  • Keyboard class
  • Overlay class
  • Dialog class
    • OKDialog dialog
    • ErrorDialog dialog
    • WarningDialog dialog
    • YNDialog dialog
    • OKCancelDialog dialog
    • AskDialog dialog
    • CustomContentDialog dialog
  • NotificationMenu overlay
    • RecentAppSwitcher overlay
    • Selector overlay

GUI Components and Containers

  • Component class

The following classes are all Components, they inherit from that class.

  • Container component
  • AppContainer container
  • Button container
  • KeyboardButton container
  • TextEntryField container
  • PagedContainer container
    • GriddedPagedContainer container
    • ListedPagedContainer container
  • ButtonRow container
  • ScrollableContainer container
    • ListScrollableContainer container
    • TextScrollableContainer container
    • MultiLineTextEntryField container
  • Text component
  • MultiLineText component
  • ExpandingMultiLineText component
  • Image component
  • Slider component
  • Checkbox component
  • Switch component
  • Canvas component
  • ScrollIndicator component
Clone this wiki locally