Handlers have to be constructed with optional parameters. Could be useful for example with MPD, to specify a host, port and password.
The issue with the current implementation is that there is one constructed object per Handler class, so it's not possible to change a handler object attributes as it would impact every widget subscribed to it.
New implementation proposal:
Change subscribe() in HooksPool to this prototype: subscribe(self, callback, event, *event_args, **event_kwargs)
If a widget wants to redefine a hook that already is in the hooks pool, HooksPool[MyHook] = [myhook1, myhook2]. Although, to avoid having 2 hook objects that are in fact the same, it would be nice to check if it's necessary to construct a new hook. So a hook should say if it's compatible with an other hook or not.
HooksPool.merge() should act differently, and take in consideration the actual constructed hooks on both sides instead of just callbacks.
Necessary to finish a correct implementation of MPDWidget.
Handlers have to be constructed with optional parameters. Could be useful for example with MPD, to specify a host, port and password.
The issue with the current implementation is that there is one constructed object per Handler class, so it's not possible to change a handler object attributes as it would impact every widget subscribed to it.
New implementation proposal:
subscribe()
inHooksPool
to this prototype:subscribe(self, callback, event, *event_args, **event_kwargs)
HooksPool[MyHook] = [myhook1, myhook2]
. Although, to avoid having 2 hook objects that are in fact the same, it would be nice to check if it's necessary to construct a new hook. So a hook should say if it's compatible with an other hook or not.HooksPool.merge()
should act differently, and take in consideration the actual constructed hooks on both sides instead of just callbacks.Necessary to finish a correct implementation of MPDWidget.