pingo-io / pingo-py

Generic API for controlling boards with programmable IO pins
http://pingo.io
MIT License
258 stars 48 forks source link

Using a signal / slot pattern for parts ? #105

Open s-celles opened 8 years ago

s-celles commented 8 years ago

Hello,

I wonder if a signal / slot mechanism shouldn't be more "user friendly".

For example we could write:

    class MyApp(object):
        def __init__(self):
            ...
            self.switch.pressed.connect(self.do_it_when_pressed)

instead of

    class MyApp(object):
        def __init__(self):
            ...
            self.switch.set_callback_up(self.do_it_when_pressed)

Some signal / slot library are

https://pythonhosted.org/blinker/ https://github.com/circuits/circuits https://github.com/shaunduncan/smokesignal

An other pattern to consider may be Pub / sub http://pubsub.sourceforge.net/

This issue is related to https://github.com/pingo-io/pingo-py/issues/60

Kind regards