DanielSank / observed

Observer pattern in python
MIT License
33 stars 4 forks source link

emit directly from add_observer() #11

Open kubaraczkowski opened 9 years ago

kubaraczkowski commented 9 years ago

Hi,

Speaking about PyQt4, would it be possible to attach emitting a signal directly at a place where add_observer is called? like this in the view part:

self.model.set_state.add_observer(self._model_state_change_signal.emit)

considering that model.set_state has appropriate decorator and that the set_state method takes one argument which fits to the _model_state_change_signal type

DanielSank commented 9 years ago

I'm not entirely sure what you mean here. Any chance you could give an example of what you're trying to do?

kubaraczkowski commented 9 years ago

here's the gits of it: https://gist.github.com/kubaraczkowski/6ede45a45c0b842cc44a

On Wed, Feb 4, 2015 at 8:45 PM, Daniel Sank notifications@github.com wrote:

I'm not entirely sure what you mean here. Any chance you could give an example of what you're trying to do?

— Reply to this email directly or view it on GitHub https://github.com/DanielSank/observed/issues/11#issuecomment-72924403.

DanielSank commented 9 years ago

@kubaraczkowski I see the issue here now. This is definitely fixable. I just need to support making the weak referencing optional, which I planned to do anyway.

DanielSank commented 7 years ago

@kubaraczkowski Have you written a fix for this? Pull requests are always welcome.