# `QTaurusBaseListener`

digraph inheritance66b50f9e1d { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "Logger" [URL="taurus-Logger.html#taurus.Logger",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="The taurus logger class. All taurus pertinent classes should inherit"]; "QTaurusBaseListener" [URL="#taurus.qt.qtcore.taurusqlistener.QTaurusBaseListener",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="Base class for QObjects listening to taurus events."]; "TaurusListener" -> "QTaurusBaseListener" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusListener" [URL="taurus.core.tauruslistener-TaurusListener.html#taurus.core.tauruslistener.TaurusListener",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="TaurusListener Interface"]; "Logger" -> "TaurusListener" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

class QTaurusBaseListener(name=None, parent=None)

  Base class for QObjects listening to taurus events.

  Note

  `getSignaller()` is now unused and deprecated. This is because taurusEvent is implemented using `baseSignal()`, that doesn’t require the class to inherit from QObject.

  Import from `taurus.qt.qtcore.taurusqlistener` as:

      from taurus.qt.qtcore.taurusqlistener import QTaurusBaseListener

  eventReceived(evt_src, evt_type, evt_value)

    The basic implementation of the event handling chain is as follows:

    > - eventReceived just calls `fireEvent()` which emits a “taurusEvent” PyQt signal that is connected (by `preAttach()`) to the `filterEvent()` method.

    > - After filtering, `handleEvent()` is invoked with the resulting filtered event

    Note

    in the earlier steps of the chain (i.e., in `eventReceived()`/`fireEvent()`), the code is executed in a Python thread, while from eventFilter ahead, the code is executed in a Qt thread. When writing widgets, one should normally work on the Qt thread (i.e. reimplementing `handleEvent()`)

    Parameters:

      - evt_src (object) – object that triggered the event

      - evt_type (taurus.core.taurusbasetypes.TaurusEventType) – type of event

      - evt_value (object) – event value

  filterEvent(evt_src=-1, evt_type=-1, evt_value=-1)

    The event is processed by each and all filters in strict order unless one of them returns None (in which case the event is discarded)

    Parameters:

      - evt_src (object) – object that triggered the event

      - evt_type (taurus.core.taurusbasetypes.TaurusEventType) – type of event

      - evt_value (object) – event value

  fireEvent(evt_src=None, evt_type=None, evt_value=None)

    Emits a “taurusEvent” signal.

    It is unlikely that you may need to reimplement this method in subclasses. Consider reimplementing `eventReceived()` or `handleEvent()` instead depending on whether you need to execute code in the python or Qt threads, respectively

    Parameters:

      - evt_src (object or None) – object that triggered the event

      - evt_type (taurus.core.taurusbasetypes.TaurusEventType or None) – type of event

      - evt_value (object or None) – event value

  getEventFilters()

    Returns the list of event filters for this widget

    Returns:

      the event filters

    Return type:

      sequence<callable>

  getSignaller(**kwargs)

    Deprecated since version 4.0.

  handleEvent(evt_src, evt_type, evt_value)

    Event handling. Default implementation does nothing. Reimplement as necessary

    Parameters:

      - evt_src (object or None) – object that triggered the event

      - evt_type (taurus.core.taurusbasetypes.TaurusEventType or None) – type of event

      - evt_value (object or None) – event value

  insertEventFilter(filter, index=-1)

    insert a filter in a given position

    Parameters:

      - filter (callable(evt_src, evt_type, evt_value)) – a filter

      - index (int) – index to place the filter (default = -1 meaning place at the end)

    See also: setEventFilters

  setEventFilters(filters=None)

    sets the taurus event filters list.

    The filters are run in order, using each output to feed the next filter. A filter must be a function that accepts 3 arguments `(evt_src, evt_type, evt_value)` If the event is to be ignored, the filter must return None. If the event is not to be ignored, filter must return a `(evt_src, evt_type, evt_value)` tuple which may (or not) differ from the input.

    For a library of common filters, see taurus/core/util/eventfilters.py

    Parameters:

      filters (sequence) – a sequence of filters

    See also: insertEventFilter

  property taurusEvent

    Base signal taurusEvent