diff --git a/config/settings.properties b/config/settings.properties index c96d8e3..4768eb5 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,4 +1,4 @@ -#Thu Jan 26 14:35:28 CET 2023 +#Thu Jan 26 15:36:34 CET 2023 HARMONIC_ID_1=1 RSYNC_USER= CFF=2.25 diff --git a/config/variables.properties b/config/variables.properties index c84caa6..0e8fa39 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Thu Dec 22 17:00:25 CET 2022 -LastRunDate=221222 -FileSequentialNumber=18358 -DaySequentialNumber=43 +#Thu Jan 26 15:42:52 CET 2023 +LastRunDate=230126 +FileSequentialNumber=18359 +DaySequentialNumber=1 diff --git a/plugins/DataAcquisition.java b/plugins/DataAcquisition.java index b1bd036..13eb145 100755 --- a/plugins/DataAcquisition.java +++ b/plugins/DataAcquisition.java @@ -13,9 +13,11 @@ import ch.psi.utils.Serializer; import ch.psi.utils.State; import ch.psi.utils.Str; import ch.psi.utils.swing.SwingUtils; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; @@ -140,6 +142,12 @@ public class DataAcquisition extends Panel { modelRois = (DefaultTableModel) tableRoi.getModel(); new File(ABSORTION_SPECTRUM_PATH).mkdirs(); new File(ROIS_PATH).mkdirs(); + imagingRoiOverlay = new Rect(new Pen(Color.GREEN.darker(),0)); + imagingRoiOverlay.setSelectable(false); + imagingRoiOverlay.setMovable(false); + imagingRoiOverlay.setSolid(false); + rendererRoi.addOverlay(imagingRoiOverlay); + } //Overridable callbacks @@ -157,7 +165,8 @@ public class DataAcquisition extends Panel { textOutliersMask.setText(String.valueOf(getSetting("OUTLIERS_MASK_FILE"))); } catch (IOException ex) { showException(ex); - } } + } + } @Override public void onStateChange(State state, State former) { @@ -182,6 +191,20 @@ public class DataAcquisition extends Panel { textFOV.setText(label); }); }).start(); + + Rectangle imagingRoi = getImagingRoi(); + if (imagingRoi==null){ + imagingRoiOverlay.setVisible(false); + } else { + imagingRoiOverlay.setPosition(imagingRoi.getLocation()); + imagingRoiOverlay.setSize(imagingRoi.getSize()); + imagingRoiOverlay.setVisible(true); + } + } + Rect imagingRoiOverlay; + + Rectangle getImagingRoi(){ + return (Rectangle) getGlobalVar("IMAGING_ROI"); } //Callback to perform update - in event thread diff --git a/plugins/XPEEM_Settings.form b/plugins/XPEEM_Settings.form index f5a329d..ae559b5 100644 --- a/plugins/XPEEM_Settings.form +++ b/plugins/XPEEM_Settings.form @@ -19,11 +19,6 @@ - - - - - @@ -48,6 +43,14 @@ + + + + + + + + @@ -91,7 +94,9 @@ - + + + @@ -168,5 +173,13 @@ + + + + + + + + diff --git a/plugins/XPEEM_Settings.java b/plugins/XPEEM_Settings.java index c7b6b62..8e9238b 100644 --- a/plugins/XPEEM_Settings.java +++ b/plugins/XPEEM_Settings.java @@ -1,8 +1,12 @@ +import ch.psi.pshell.core.CommandSource; +import ch.psi.pshell.core.Context; import ch.psi.pshell.ui.Panel; import ch.psi.utils.State; import ch.psi.utils.swing.SwingUtils; import java.awt.Component; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.JButton; /** @@ -49,7 +53,7 @@ public class XPEEM_Settings extends Panel { @Override protected void doUpdate() { } - + @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -65,6 +69,7 @@ public class XPEEM_Settings extends Panel { label5 = new java.awt.Label(); label6 = new java.awt.Label(); label7 = new java.awt.Label(); + buttonRunSelected = new javax.swing.JButton(); ButtonDefaultXrays.setText("X-rays (Standard)"); ButtonDefaultXrays.addActionListener(new java.awt.event.ActionListener() { @@ -109,6 +114,13 @@ public class XPEEM_Settings extends Panel { label7.setText("x,y = 0.0, tilt = 0.0"); + buttonRunSelected.setText("Run Selected"); + buttonRunSelected.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonRunSelectedActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -116,10 +128,6 @@ public class XPEEM_Settings extends Panel { .addGroup(layout.createSequentialGroup() .addGap(79, 79, 79) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(ButtonNeutralizePosition) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(ButtonDefaultOptics10kV) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -137,7 +145,13 @@ public class XPEEM_Settings extends Panel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(buttonRunSelected, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(ButtonNeutralizePosition, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(68, Short.MAX_VALUE)) ); @@ -173,7 +187,9 @@ public class XPEEM_Settings extends Panel { .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(83, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE) + .addComponent(buttonRunSelected) + .addGap(16, 16, 16)) ); label1.getAccessibleContext().setAccessibleName("ID2 only, lin. hor., G3, 800 eV, energy slit = 300,"); @@ -231,11 +247,45 @@ public class XPEEM_Settings extends Panel { } }//GEN-LAST:event_ButtonNeutralizePositionActionPerformed + private void buttonRunSelectedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRunSelectedActionPerformed + try { + getContext().startExecution(CommandSource.plugin, null, null,null, false); + new Thread(()->{ + try{ + if (true){ + this.eval("peem_optics_default_15kV()", true); + } + if (true){ + this.eval("peem_optics_default_10kV()", true); + } + if (true){ + this.eval("xrays_default()", true); + } + if (true){ + this.eval("neutralize_position()", true); + } + + } catch (Exception ex){ + getLogger().log(Level.WARNING, null, ex); + } finally{ + try { + getContext().endExecution(); + } catch (Context.ContextStateException ex) { + getLogger().log(Level.SEVERE, null, ex); + } + } + }).start(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonRunSelectedActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton ButtonDefaultOptics10kV; private javax.swing.JButton ButtonDefaultOptics15kV; private javax.swing.JButton ButtonDefaultXrays; private javax.swing.JButton ButtonNeutralizePosition; + private javax.swing.JButton buttonRunSelected; private java.awt.Label label1; private java.awt.Label label2; private java.awt.Label label3;