.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. module:: wx.lib.pubsub.utils.notification

.. currentmodule:: wx.lib.pubsub.utils.notification

.. highlight:: python



.. _wx.lib.pubsub.utils.notification:

==========================================================================================================================================
|phoenix_title|  **wx.lib.pubsub.utils.notification**
==========================================================================================================================================

Provide an interface class for handling pubsub notification messages, 
and an example class (though very useful in practice) showing how to 
use it. 

Notification messages are generated by pubsub

- if a handler has been configured via pub.addNotificationHandler()
- when pubsub does certain tasks, such as when a listener subscribes to
  or unsubscribes from a topic
  
Derive from this class to handle notification events from 
various parts of pubsub. E.g. when a listener subscribes, 
unsubscribes, or dies, a notification handler, if you 
specified one via pub.addNotificationHandler(), is given the 
relevant information. 

:copyright: Copyright since 2006 by Oliver Schoenborn, all rights reserved.
:license: BSD, see LICENSE_BSD_Simple.txt for details.


|function_summary| Functions Summary
====================================

================================================================================ ================================================================================
:func:`~wx.lib.pubsub.utils.notification.useNotifyByPubsubMessage`               Will cause all of pubsub's notifications of pubsub "actions" (such as
:func:`~wx.lib.pubsub.utils.notification.useNotifyByWriteFile`                   Will cause all pubsub notifications of pubsub "actions" (such as
================================================================================ ================================================================================


|


|class_summary| Classes Summary
===============================

================================================================================ ================================================================================
:ref:`~wx.lib.pubsub.utils.notification.IgnoreNotificationsMixin`                Derive your Notifications handler from this class if your handler
:ref:`~wx.lib.pubsub.utils.notification.NotifyByPubsubMessage`                   Handle pubsub notification messages by generating
:ref:`~wx.lib.pubsub.utils.notification.NotifyByWriteFile`                       Print a message to stdout when a notification is received.
================================================================================ ================================================================================


|


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.lib.pubsub.utils.notification.IgnoreNotificationsMixin
   wx.lib.pubsub.utils.notification.NotifyByPubsubMessage
   wx.lib.pubsub.utils.notification.NotifyByWriteFile





Functions
------------

.. function:: useNotifyByPubsubMessage(publisher=None, all=True, \*\*kwargs)

   Will cause all of pubsub's notifications of pubsub "actions" (such as
   new topic created, message sent, listener subscribed, etc) to be sent
   out as messages. Topic will be 'pubsub' subtopics, such as
   'pubsub.newTopic', 'pubsub.delTopic', 'pubsub.sendMessage', etc.
   
   The 'all' and kwargs args are the same as pubsub's setNotificationFlags(), 
   except that 'all' defaults to True.
   
   The publisher is rarely needed:
   
   * The publisher must be specfied if pubsub is not installed
     on the system search path (ie from pubsub import ... would fail or
     import wrong pubsub -- such as if pubsub is within wxPython's
     wx.lib package). Then pbuModule is the pub module to use::
   
       from wx.lib.pubsub import pub
       from wx.lib.pubsub.utils import notification
       notification.useNotifyByPubsubMessage()


.. function:: useNotifyByWriteFile(fileObj=None, prefix=None, publisher=None, all=True, \*\*kwargs)

   Will cause all pubsub notifications of pubsub "actions" (such as
   new topic created, message sent, listener died etc) to be written to
   specified file (or stdout if none given). The fileObj need only
   provide a 'write(string)' method.
   
   The first two arguments are the same as those of NotifyByWriteFile
   constructor. The 'all' and kwargs arguments are those of pubsub's
   setNotificationFlags(), except that 'all' defaults to True.  See
   useNotifyByPubsubMessage() for an explanation of pubModule (typically
   only if pubsub inside wxPython's wx.lib)


