controling signals and events #4
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
Here you have my changes. The main change is that the class SISignals is a singleton now, that is able to register the connected signals so it can mute and unmute the XSI events when necessary.
The class has four new methods: connect, disconnect, emit, reload. They are in the charge of process the qt signal and the xsi event.
Connect
Example:
from sisignals import signals
signals.connect('siActivate', foo)
Explanation:
A registry saying that the signal 'siActivate' and the slot 'foo' are connected will be created. And if the signal hasn't been already registered, its associated xsi QtEvents_Active' will be unmuted. And of course, the most import thing, the connection will be made.
Disconnect
Example:
from sisignals import signals
signals.disconnect('siActivate', foo)
Explanation:
The signal and the slot will be disconnected and if there aren't more registries related to this signal, its associated xsi event will be muted.
In this way, we can open the same dialog twice or have two different dialogs using the same signal/event.
Emit
Example:
from sisignals import signals
signals.emit('siActivate', True)
Explanation:
This just emit the signal as usual. I've made it just for treat all SISignals in the same way.
Reload
Example:
from signals import signals
signal.reload()
Explanation:
Sometimes you want to clean and restart your singleton. It cleans the registry and mute all events and it is used when the QtEvents is loaded.