SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

python-pyjon-events rpm build for : OpenSuSE. For other distributions click python-pyjon-events.

Name : python-pyjon-events
Version : 1.2 Vendor : obs://build_opensuse_org/home:appleonkel
Release : 1.30 Date : 2018-10-30 21:13:35
Group : Development/Languages/Python Source RPM : python-pyjon-events-1.2-1.30.src.rpm
Size : 0.01 MB
Packager : (none)
Summary : PyjonEvents is an easy-to-use event dispatcher
Description :
What is it ?
============

Pyjon.Events is an easy-to-use event dispatcher metaclass for your objects :
Just add it to any of your class, and you can add event listeners and dispatch events.

You can define arguments passed to your listener when you add it.
You can also define argument passed to the listener when emiting an event.

Example
=======

For our example, we will define a person class.
Just import the module, and add it to your class (Python2 example)::

from pyjon.events import EventDispatcher

class Person(object):
__metaclass__ = EventDispatcher

def __init__(self, name):

self.name = name

def run(self, meters=1):
print \"I\'m running for %d meters !\" % meters
self.emit_event(\'ran\', meters)
self.emit_event(\'moved\', meters=meters)

def walk(self, meters=1):
print \"I\'m walking for %d meters !\" % meters
self.emit_event(\'walked\', meters)
self.emit_event(\'moved\', meters=meters)

def sleep(self):
print \"sleeping...\"
self.emit_event(\'sleeping\')
time.sleep(5)
self.emit_event(\'sleeped\')
print \"Wow... had a good night !\"

For Python3, just replace this::

class Person(object):
__metaclass__ = EventDispatcher

with this::

class Person(metaclass = EventDispatcher):

Now, let\'s instanciate our class and subscribe to events::

>>> henry = Person(\'henry\')

>>> def handle_movement(meters=None):
... print \"he moved for %d meters\" % meters

>>> def handle_person_movement(who, meters=None):
... print \"%s moved for %d meters\" % (who, meters)

>>> henry.add_listener(\'moved\', handle_movement)

>>> henry.add_listener(\'moved\', handle_person_movement, \"henry\")

>>> henry.walk(5)
I\'m walking for 5 meters !
he moved for 5 meters
henry moved for 5 meters

>>> def handle_advanced_movement(meters, who, movement_type):
... print \"%s %s for %d meters\" % (who, movement_type, meters)

>>> henry.add_listener(\'walked\', handle_advanced_movement, \"henry\", \"walked\")

>>> henry.add_listener(\'ran\', handle_advanced_movement, \"henry\", \"ran\")

>>> henry.walk(5)
I\'m walking for 5 meters !
henry walked for 5 meters
he moved for 5 meters
henry moved for 5 meters

>>> henry.run(5)
I\'m running for 5 meters !
henry ran for 5 meters
he moved for 5 meters
henry moved for 5 meters

That\'s simple isn\'t it ?


Changelog
=========

1.0 - Unreleased
----------------

* Initial release

1.1 - First public release
--------------------------

* Support of events with keyword arguments
* Added documentation

1.1.1 - Bugfix release
----------------------

* MANIFEST.in fix
* Docs fixes

1.2 - Python 3 compatible !
---------------------------

* Now works with Python 3 !

RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/home:/appleonkel:/python/openSUSE_Factory/noarch

Content of RPM  Provides Requires

Hmm ... It's impossible ;-) This RPM doesn't exist on any FTP server

Provides :
python-pyjon-events

Requires :
python(abi) = 2.7
python-setuptools
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


Content of RPM :
/usr/lib/python2.7/site-packages/pyjon
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7-nspkg.pth
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/PKG-INFO
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/SOURCES.txt
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/dependency_links.txt
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/entry_points.txt
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/namespace_packages.txt
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/not-zip-safe
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/requires.txt
/usr/lib/python2.7/site-packages/pyjon.events-1.2-py2.7.egg-info/top_level.txt
/usr/lib/python2.7/site-packages/pyjon/events
/usr/lib/python2.7/site-packages/pyjon/events/__init__.py
/usr/lib/python2.7/site-packages/pyjon/events/__init__.pyc
/usr/lib/python2.7/site-packages/pyjon/events/dispatcher.py
/usr/lib/python2.7/site-packages/pyjon/events/dispatcher.pyc
/usr/share/doc/packages/python-pyjon-events
/usr/share/doc/packages/python-pyjon-events/README.txt

 
ICM