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

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

Validates listeners. It checks whether the listener given to 
validate() method complies with required and optional arguments
specified for topic. 



|

|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>ValidatorBase</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.ValidatorBase_inheritance.png" alt="Inheritance diagram of ValidatorBase" 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.ValidatorBase.html" title="wx.lib.pubsub.core.listenerbase.ValidatorBase" alt="" coords="5,5,328,35"/> </map> 
   </p>
   </div>

|


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

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

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.pubsub.core.listenerbase.ValidatorBase.__init__`                  topicArgs is a list of argument names that will be required when sending
:meth:`~wx.lib.pubsub.core.listenerbase.ValidatorBase.isValid`                   Return true only if listener can subscribe to messages where
:meth:`~wx.lib.pubsub.core.listenerbase.ValidatorBase.validate`                  Validate that listener satisfies the requirements of
================================================================================ ================================================================================


|


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


.. class:: ValidatorBase

   Validates listeners. It checks whether the listener given to 
   validate() method complies with required and optional arguments
   specified for topic. 

   .. method:: __init__(self, topicArgs, topicKwargs)

      topicArgs is a list of argument names that will be required when sending
      a message to listener. Hence order of items in topicArgs matters. The topicKwargs
      is a list of argument names that will be optional, ie given as keyword arguments
      when sending a message to listener. The list is unordered. 


   .. method:: isValid(self, listener)

      Return true only if listener can subscribe to messages where
      topic has kwargs keys topicKwargKeys. Just calls validate() in 
      a try-except clause.


   .. method:: validate(self, listener)

      Validate that listener satisfies the requirements of
      being a topic listener, if topic's kwargs keys are topicKwargKeys
      (so only the list of keyword arg names for topic are necessary). 
      Raises ListenerMismatchError if listener not usable for topic. 
      
      Otherwise, returns an CallArgsInfo object containing information about
      the listener's call arguments, such as whether listener wants topic
      name (signified by a kwarg value = AUTO_TOPIC in listener protocol).
      E.g. def fn1(msgTopic=Listener.AUTO_TOPIC) would 
      cause validate(fn1) to return True, whereas any other kwarg name or value 
      would cause a ``False`` to be returned. 


