.. 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

.. currentmodule:: wx.lib.pubsub.core.listenerbase

.. highlight:: python



.. _wx.lib.pubsub.core.listenerbase.ListenerBase:

==========================================================================================================================================
|phoenix_title|  **wx.lib.pubsub.core.listenerbase.ListenerBase**
==========================================================================================================================================

Base class for listeners, ie. callables subscribed to pubsub. 



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>ListenerBase</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.pubsub.core.listenerbase.ListenerBase_inheritance.png" alt="Inheritance diagram of ListenerBase" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.pubsub.core.listenerbase.ListenerBase.html" title="wx.lib.pubsub.core.listenerbase.ListenerBase" alt="" coords="5,5,321,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.pubsub.core.listenerimpl.Listener`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.__init__`                   Use callable_ as a listener of topicName. The argsInfo is the
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.getCallable`                Get the listener that was given at initialization. Note that
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.isDead`                     Return ``True`` if this listener died (has been garbage collected)
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.module`                     Get the module in which the callable was defined.
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.name`                       Return a human readable name for listener, based on the
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.typeName`                   Get a type name for the listener. This is a class name or
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.wantsAllMessageData`        True if this listener wants all message data: it has a **kwargs argument
:meth:`~wx.lib.pubsub.core.listenerbase.ListenerBase.wantsTopicObjOnCall`        True if this listener wants topic object: it has a arg=pub.AUTO_TOPIC
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: ListenerBase

   Base class for listeners, ie. callables subscribed to pubsub. 

   .. method:: __init__(self, callable_, argsInfo, onDead=None)

      Use callable_ as a listener of topicName. The argsInfo is the
      return value from a Validator, ie an instance of callables.CallArgsInfo.
      If given, the onDead will be called with self as parameter, if/when
      callable_ gets garbage collected (callable_ is held only by weak
      reference). 


   .. method:: getCallable(self)

      Get the listener that was given at initialization. Note that
      this could be None if it has been garbage collected (e.g. if it was 
      created as a wrapper of some other callable, and not stored 
      locally).


   .. method:: isDead(self)

      Return ``True`` if this listener died (has been garbage collected)


   .. method:: module(self)

      Get the module in which the callable was defined.


   .. method:: name(self)

      Return a human readable name for listener, based on the
      listener's type name and its id (as obtained from id(listener)). If 
      caller just needs name based on type info, specify instance=False. 
      Note that the listener's id() was saved at construction time (since 
      it may get garbage collected at any time) so the return value of 
      name() is not necessarily unique if the callable has died (because 
      id's can be re-used after garbage collection).


   .. method:: typeName(self)

      Get a type name for the listener. This is a class name or
      function name, as appropriate. 


   .. method:: wantsAllMessageData(self)

      True if this listener wants all message data: it has a **kwargs argument


   .. method:: wantsTopicObjOnCall(self)

      True if this listener wants topic object: it has a arg=pub.AUTO_TOPIC


