Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI is disabled when opened programmatically #112

Closed
ianhi opened this issue Feb 28, 2022 · 4 comments
Closed

GUI is disabled when opened programmatically #112

ianhi opened this issue Feb 28, 2022 · 4 comments

Comments

@ianhi
Copy link
Contributor

ianhi commented Feb 28, 2022

Due to the _set_enabled behavior if you modify the launch-dev script to have the config be loaded before creating the widget (a reasonable thing to do one when scripting)

from pymmcore_plus import CMMCorePlus
from pathlib import Path

import napari
from useq import MDASequence

core = CMMCorePlus.instance()
core.loadSystemConfiguration(str(Path(__file__).parent / "tests" / "test_config.cfg"))

v = napari.Viewer()
dw, main_window = v.window.add_plugin_dock_widget("napari-micromanager")


sequence = MDASequence(
    channels=["Cy5", {"config": "FITC", "exposure": 50}],
    time_plan={"interval": 2, "loops": 5},
    z_plan={"range": 4, "step": 0.5},
    axis_order="tpcz",
    stage_positions=[(222, 1, 1), (111, 0, 0)],
)

main_window.mda.set_state(sequence)

napari.run()

then the entire GUI is still disabled.

I think the solution is to remove the top level concept of enabled/disabled and push that down to a per widget basis. They should check for the relevant loaded devices at creation and then listen the appropriate signals to (de)activate themselves as approriate.

@tlambert03
Copy link
Member

thanks. agreed. let's take another close look at _set_enabled and try to do away with it entirely

@ianhi
Copy link
Contributor Author

ianhi commented Feb 28, 2022

My proposed fix will also involve new signals being added. Which also opens the (maybe thorny) question of where do those signals go. see micro-manager/mmCoreAndDevices#149

@ianhi
Copy link
Contributor Author

ianhi commented Feb 28, 2022

Relevant signals being added to core here: micro-manager/mmCoreAndDevices#163

@fdrgsp
Copy link
Contributor

fdrgsp commented Jul 28, 2023

Closing since this is not happening anymore. Still have an unrelated issue already mentioned in #255.

from pymmcore_plus import CMMCorePlus
from pathlib import Path

import napari
from useq import MDASequence

core = CMMCorePlus.instance()
core.loadSystemConfiguration(str(Path(__file__).parent / "tests" / "test_config.cfg"))

v = napari.Viewer()
dw, main_window = v.window.add_plugin_dock_widget("napari-micromanager")


sequence = MDASequence(
    channels=["Cy5", {"config": "FITC", "exposure": 50}],
    time_plan={"interval": 2, "loops": 5},
    z_plan={"range": 4, "step": 0.5},
    axis_order="tpcz",
    stage_positions=[(222, 1, 1), (111, 0, 0)],
)

main_window._show_dock_widget("MDA")
mda = v.window._dock_widgets.get("MDA").widget()
mda.set_state(sequence)

napari.run()

@fdrgsp fdrgsp closed this as completed Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants