Package _Framework :: Module SubjectSlot :: Class SubjectSlot
[hide private]
[frames] | no frames]

Class SubjectSlot

source code

                   object --+    
                            |    
Disconnectable.Disconnectable --+
                                |
                               SubjectSlot


This class maintains the relationship between a subject and a
listener callback. As soon as both are non-null, it connects the
listener the given 'event' of the subject and release the connection
when any of them change.

The finalizer of the object also cleans up both parameters and so
does the __exit__ override, being able to use it as a context
manager with the 'with' clause.

Note that 'event' is a string with canonical identifier for the
listener, i.e., the subject should provide the methods:

  add_[event]_listener
  remove_[event]_listener
  [event]_has_listener

Note that the connection can already be made manually before the
subject and listener are fed to the slot.

Instance Methods [hide private]
 
__init__(self, subject=None, listener=None, event=None, extra_kws=None, extra_args=None, *a, **k)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
disconnect(self)
Disconnects the slot clearing its members.
source code
 
_check_subject_interface(self, subject) source code
 
connect(self) source code
 
soft_disconnect(self)
Disconnects the listener from the subject keeping their values.
source code
 
is_connected(self) source code
 
_get_subject(self) source code
 
_set_subject(self, subject) source code
 
_get_listener(self) source code
 
_set_listener(self, listener) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _extra_kws = {}
  _extra_args = []
  subject = property(_get_subject, _set_subject)
  listener = property(_get_listener, _set_listener)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, subject=None, listener=None, event=None, extra_kws=None, extra_args=None, *a, **k)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

disconnect(self)

source code 

Disconnects the slot clearing its members.

Overrides: Disconnectable.Disconnectable.disconnect

is_connected(self)

source code 
Decorators:
  • @property