Skip to content

GUI is disabled when opened programmaticallyΒ #112

@ianhi

Description

@ianhi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions