qudi icon indicating copy to clipboard operation
qudi copied to clipboard

Fix fast real-time signal firing

Open kay-jahnke opened this issue 7 years ago • 1 comments

In the moment gui-signals are connected to to their respective slots and the functions directly. This means that it is possible, for large amounts of signals to be fired, even before heap of stored functions can be worked off.

This can be solved be introducing a SignalProxy in between slot and function, that puts a limit on the signals fired or a delay between firing the signal and working it off in the respective function.

Example from gui/poimanager/poimangui.py: proxy = pg.SignalProxy(self.roi_map_image.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved) self.roi_map_image.scene().sigMouseMoved.connect(self.mouseMoved)

There are several examples in the gui, where such a Proxy would be useful. Example from gui/confocal/confocalgui.py: self._mw.x_SliderWidget.sliderMoved.connect(self.update_from_slider_x)

If someone has time, we should sieve through the code and looks for places to introduce proxies.

@drogenlied: maybe there is a way to include the proxies in the base-classes, to make them apply to every function.

kay-jahnke avatar Feb 06 '17 21:02 kay-jahnke

Proxies only make sense in a few cases:

  • user interaction that causes a large rate (> 30/s) of signals (sliders, mouse moved, etc)
  • as a workaround for buttons/actions that fire before editingFinished of related input fields gets executed

Otherwise, they just delay signals, increase memory use and make a complex system even more complex.

drogenlied avatar Feb 09 '17 00:02 drogenlied