diff --git a/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java b/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java index 0dbc3e2..173796d 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java +++ b/src/main/java/org/micromanager/lightsheetmanager/LightSheetManagerPlugin.java @@ -11,7 +11,7 @@ @Plugin(type = MenuPlugin.class) public class LightSheetManagerPlugin implements MenuPlugin, SciJavaPlugin { - public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022"; + public static final String copyright = "Applied Scientific Instrumentation (ASI), 2022-2023"; public static final String description = "A plugin to control various types of light sheet microscopes."; public static final String menuName = "Light Sheet Manager"; public static final String version = "0.1.0"; @@ -42,6 +42,7 @@ public void onPluginSelected() { model_ = new LightSheetManagerModel(studio_); final boolean isLoaded = model_.setup(); frame_ = new LightSheetManagerFrame(model_, isLoaded); + model_.acquisitions().setFrame(frame_); // TODO: remove later frame_.setVisible(true); frame_.toFront(); } catch (Exception e) { diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java b/src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java index 826dac3..bc38f04 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/LightSheetManagerFrame.java @@ -13,6 +13,7 @@ import org.micromanager.lightsheetmanager.gui.components.Label; import org.micromanager.lightsheetmanager.gui.data.Icons; import org.micromanager.lightsheetmanager.gui.tabs.TabPanel; +import org.micromanager.lightsheetmanager.gui.tabs.navigation.NavigationPanel; import org.micromanager.lightsheetmanager.gui.utils.WindowUtils; import org.micromanager.lightsheetmanager.model.LightSheetManagerModel; import org.micromanager.internal.utils.WindowPositioning; @@ -136,6 +137,11 @@ private void createUserInterface() { } + // TODO: remove when there is a better method to stop polling from acq engine + public NavigationPanel getNavigationPanel() { + return tabPanel_.getNavigationTab().getNavigationPanel(); + } + public Studio getStudio_() { return studio_; } diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/NavigationPanel.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/NavigationPanel.java index add0961..0cb89bc 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/NavigationPanel.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/NavigationPanel.java @@ -290,6 +290,10 @@ public void stopPolling() { positionUpdater_.stopPolling(); } + public boolean isPolling() { + return positionUpdater_.isPolling(); + } + public void haltAllDevices() { System.out.println("Halt pressed!"); for (ControlPanel controlPanel : controlPanels_) { diff --git a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/PositionUpdater.java b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/PositionUpdater.java index 6f318ef..51cbabe 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/PositionUpdater.java +++ b/src/main/java/org/micromanager/lightsheetmanager/gui/tabs/navigation/PositionUpdater.java @@ -59,4 +59,9 @@ public void startPolling() { public void stopPolling() { isPolling_.set(false); } + + public boolean isPolling() { + return isPolling_.get(); + } + } diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java index 5582524..9c05640 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/acquisitions/AcquisitionEngine.java @@ -1,5 +1,6 @@ package org.micromanager.lightsheetmanager.model.acquisitions; +import javafx.scene.effect.Light; import mmcorej.CMMCore; import mmcorej.StrVector; import mmcorej.org.json.JSONArray; @@ -30,6 +31,7 @@ import org.micromanager.lightsheetmanager.api.data.GeometryType; import org.micromanager.lightsheetmanager.api.internal.DefaultAcquisitionSettingsDISPIM; import org.micromanager.lightsheetmanager.api.internal.DefaultTimingSettings; +import org.micromanager.lightsheetmanager.gui.LightSheetManagerFrame; import org.micromanager.lightsheetmanager.model.autofocus.AutofocusRunner; import org.micromanager.lightsheetmanager.model.DataStorage; import org.micromanager.lightsheetmanager.model.LightSheetManagerModel; @@ -70,6 +72,10 @@ public class AcquisitionEngine implements AcquisitionManager, MMAcquistionContro private Pipeline curPipeline_; private long nextWakeTime_ = -1; + + // TODO: remove later, hacky method to stop position updater for now + private LightSheetManagerFrame frame_; + public AcquisitionEngine(final LightSheetManagerModel model) { model_ = Objects.requireNonNull(model); studio_ = model.studio(); @@ -83,6 +89,10 @@ public AcquisitionEngine(final LightSheetManagerModel model) { acqSettings_ = asb_.build(); } + public void setFrame(final LightSheetManagerFrame frame) { + frame_ = Objects.requireNonNull(frame); + } + /** * Sets the acquisition settings and populates the acquisition settings builder with its values. * @@ -179,6 +189,11 @@ public boolean isRunning() { private void runAcquisitionSCAPE() { // System.out.println(asb_); // System.out.println(asb_.build()); + final boolean isPolling = frame_.getNavigationPanel().isPolling(); + if (isPolling) { + System.out.println("stopped!"); + frame_.getNavigationPanel().stopPolling(); + } // TODO: remove this when acqSettings for SCAPE are implemented asb_.useAdvancedTiming(true); @@ -617,6 +632,11 @@ public void close() { // TODO: execute any end-acquisition runnables currentAcquisition_ = null; + + // start polling for navigation panel + if (isPolling) { + frame_.getNavigationPanel().startPolling(); + } } }