spc-group / haven

Bluesky tools for beamlines managed by the spectroscopy group
https://haven-spc.readthedocs.io/en/latest/
Other
2 stars 6 forks source link

Refactor Firefly structure #229

Closed canismarko closed 3 months ago

canismarko commented 3 months ago

While trying to fix the fragile firefly tests, it became clear that part of the issue was the tight coupling between FireflyApplication and the individual displays. Each test needed a FireflyApplication object (and the accompanying event loop, etc) even if the code being tested didn't use it.

This PR removes FireflyApplication entirely, replacing it with a controller class. The process for loading windows has also been consolidated into a QAction subclass so we don't have to keep track of slots, etc. There shouldn't be any new features added.

On consequence of removing FireflyApplication is that display objects can't easily get the controller to retrieve the actions. Instead the actions need to get propagated down through methods, initiated by the controller, and signals get propagated up and connected to by the controller. This took some extra steps, but I think it's cleaner overall because the tight coupling is gone.

canismarko commented 3 months ago

Woopsy, found an issue with the way the component_selector is loaded. Will refactor that first.

canismarko commented 3 months ago

Okay, I re-factored the component selector. I now walks the Component objects themselves, rather than the resulting device and signal attributes. Makes it much faster, too, and also works with lazy components.