diff --git a/src/main/java/ch/psi/mxsc/BasePlateGraphics.java b/src/main/java/ch/psi/mxsc/BasePlateGraphics.java index 16775ef..a87f4bb 100644 --- a/src/main/java/ch/psi/mxsc/BasePlateGraphics.java +++ b/src/main/java/ch/psi/mxsc/BasePlateGraphics.java @@ -131,7 +131,7 @@ public class BasePlateGraphics { } if (img!=null){ if (detection!=null){ - int size=15; + int size=25; g.setColor(new Color(86, 193, 255)); g.setStroke(new BasicStroke(2f)); g.drawLine(center_x-size, center_y, center_x+size, center_y); diff --git a/src/main/java/ch/psi/mxsc/MainPanel.form b/src/main/java/ch/psi/mxsc/MainPanel.form index d853db2..3e0c572 100644 --- a/src/main/java/ch/psi/mxsc/MainPanel.form +++ b/src/main/java/ch/psi/mxsc/MainPanel.form @@ -94,13 +94,13 @@ - - + + - + - - + + @@ -165,7 +165,7 @@ - + @@ -273,7 +273,7 @@ - + @@ -282,42 +282,42 @@ - - - - + + + + - + - - - - - + + + + + - + - + - + - + - + - + @@ -326,7 +326,7 @@ - + @@ -343,7 +343,7 @@ - + @@ -355,7 +355,7 @@ - + @@ -369,7 +369,7 @@ - + @@ -388,10 +388,10 @@ - + - + @@ -416,12 +416,12 @@ - - - - + + + + - + @@ -454,7 +454,6 @@ - @@ -596,7 +595,7 @@ - + @@ -606,7 +605,7 @@ - + @@ -660,19 +659,17 @@ - - - - - - - - - - - - - + + + + + + + + + + + @@ -688,7 +685,7 @@ - + @@ -741,13 +738,13 @@ - + - + @@ -892,7 +889,7 @@ - + @@ -902,7 +899,7 @@ - + @@ -1070,8 +1067,8 @@ - - + + @@ -1079,10 +1076,10 @@ - + - + @@ -1100,18 +1097,13 @@ - - - - - - - - - - - - + + + + + + + @@ -1120,14 +1112,16 @@ - + - + - - - + + + + + @@ -1143,14 +1137,6 @@ - - - - - - - - @@ -1175,6 +1161,22 @@ + + + + + + + + + + + + + + + + diff --git a/src/main/java/ch/psi/mxsc/MainPanel.java b/src/main/java/ch/psi/mxsc/MainPanel.java index 47fce59..aecd83d 100644 --- a/src/main/java/ch/psi/mxsc/MainPanel.java +++ b/src/main/java/ch/psi/mxsc/MainPanel.java @@ -4,6 +4,7 @@ package ch.psi.mxsc; import ch.psi.mxsc.BasePlatePanel.SelectionMode; +import ch.psi.pshell.core.Context; import ch.psi.pshell.core.Plugin; import ch.psi.pshell.device.Device; import ch.psi.pshell.device.DeviceAdapter; @@ -39,11 +40,14 @@ import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; +import java.io.IOException; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.logging.Level; +import java.util.logging.Logger; +import javax.script.ScriptException; import javax.swing.GroupLayout; import javax.swing.ImageIcon; import javax.swing.JComponent; @@ -721,12 +725,13 @@ public class MainPanel extends Panel { boolean current = buttonExpertCommands.isVisible(); buttonExpertCommands.setVisible(expert); buttonRecovery.setVisible(expert); + buttonConfig.setVisible(expert); + buttonDetectionCalibrate.setVisible(expert); + buttonDetectionExposure.setVisible(expert); checkService.setVisible(expert); - buttonCalibrateCover.setVisible(expert); + devicesPanel.setActive(expert); //panelViewType.setVisible(expert); - panelDetection.setVisible(expert && !isRt()); - buttonConfig.setVisible(expert); Puck.setDisplayDetectionError(expert); if (checkExpert.isSelected() != expert) { @@ -983,7 +988,7 @@ public class MainPanel extends Panel { } } - DeviceListener cover_detection_listener = new DeviceAdapter() { + final DeviceListener cover_detection_listener = new DeviceAdapter() { @Override public void onCacheChanged(Device device, Object value, Object former, long timestamp, boolean valueChange) { Point mm = null; @@ -996,16 +1001,39 @@ public class MainPanel extends Panel { Point fmm = mm; Point fdet = det; SwingUtilities.invokeLater(()->{ + if ((value!=null) && (value instanceof String) && ((String)value).toLowerCase().startsWith("no cover")){ textCoverDet.setText("No Cover"); } else { textCoverDet.setText((fmm==null) ? "" :fmm.x + ", " + fmm.y); } + + String text; + try { + List cache = (List)eval("get_cover_location_cache()", true); + text = cache.get(0) + ", " +cache.get(1); + text= "Robot"; + } catch (Exception ex) { + text = ""; + try{ + Object use_target_cache = eval("use_target_cache", true); + if (Boolean.TRUE.equals(use_target_cache)){ + text= "Target"; + } + } catch (Exception e) { + } + } + textCoverCache.setText(text); + basePlatePanel.basePlateGraphics.setDetection(fdet); }); } }; + + void sampleTransfer(boolean load) throws Exception{ + + } /** * This method is called from within the constructor to initialize the form. @@ -1031,13 +1059,13 @@ public class MainPanel extends Panel { ledLidControlActive5 = new ch.psi.pshell.swing.Led(); jLabel23 = new javax.swing.JLabel(); panelDetection = new javax.swing.JPanel(); - buttonDetectionExposure = new javax.swing.JButton(); - buttonDetectionCalibrate = new javax.swing.JButton(); + buttonSampleLoad = new javax.swing.JButton(); + buttonSampleUnload = new javax.swing.JButton(); panelCover = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); textCoverDet = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); - textCoverMove = new javax.swing.JTextField(); + textCoverCache = new javax.swing.JTextField(); panelViewType = new javax.swing.JPanel(); buttonCamera = new javax.swing.JToggleButton(); buttonDrawing = new javax.swing.JToggleButton(); @@ -1088,10 +1116,11 @@ public class MainPanel extends Panel { devicesPanel = new ch.psi.mxsc.DevicesPanel(); panelExpert = new javax.swing.JPanel(); checkExpert = new javax.swing.JCheckBox(); - buttonCalibrateCover = new javax.swing.JButton(); buttonExpertCommands = new javax.swing.JButton(); buttonRecovery = new javax.swing.JButton(); buttonConfig = new javax.swing.JButton(); + buttonDetectionCalibrate = new javax.swing.JButton(); + buttonDetectionExposure = new javax.swing.JButton(); panelBottom = new javax.swing.JPanel(); panelSamples = new javax.swing.JPanel(); panelTableSamples = new javax.swing.JScrollPane(); @@ -1159,7 +1188,7 @@ public class MainPanel extends Panel { .addComponent(ledLidControlActive5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel23))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(30, Short.MAX_VALUE)) ); panelLegendLayout.setVerticalGroup( panelLegendLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1186,19 +1215,19 @@ public class MainPanel extends Panel { .addComponent(jLabel23))) ); - panelDetection.setBorder(javax.swing.BorderFactory.createTitledBorder("Detection")); + panelDetection.setBorder(javax.swing.BorderFactory.createTitledBorder("Sample Transfer")); - buttonDetectionExposure.setText("Detection"); - buttonDetectionExposure.addActionListener(new java.awt.event.ActionListener() { + buttonSampleLoad.setText("Load"); + buttonSampleLoad.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonDetectionExposureActionPerformed(evt); + buttonSampleLoadActionPerformed(evt); } }); - buttonDetectionCalibrate.setText("Calibrate"); - buttonDetectionCalibrate.addActionListener(new java.awt.event.ActionListener() { + buttonSampleUnload.setText("Unload"); + buttonSampleUnload.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonDetectionCalibrateActionPerformed(evt); + buttonSampleUnloadActionPerformed(evt); } }); @@ -1207,30 +1236,27 @@ public class MainPanel extends Panel { panelDetectionLayout.setHorizontalGroup( panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelDetectionLayout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(buttonDetectionCalibrate) - .addComponent(buttonDetectionExposure)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap() + .addGroup(panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(buttonSampleLoad, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE) + .addComponent(buttonSampleUnload, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) ); - - panelDetectionLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDetectionCalibrate, buttonDetectionExposure}); - panelDetectionLayout.setVerticalGroup( panelDetectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelDetectionLayout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonDetectionCalibrate) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(buttonDetectionExposure) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(panelDetectionLayout.createSequentialGroup() + .addContainerGap() + .addComponent(buttonSampleLoad) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonSampleUnload) + .addContainerGap()) ); - panelCover.setBorder(javax.swing.BorderFactory.createTitledBorder("Cover")); + panelCover.setBorder(javax.swing.BorderFactory.createTitledBorder("Cover Detection")); panelCover.setPreferredSize(new java.awt.Dimension(112, 153)); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - jLabel1.setText("Detection:"); + jLabel1.setText("Image:"); textCoverDet.setEditable(false); textCoverDet.setHorizontalAlignment(javax.swing.JTextField.CENTER); @@ -1243,12 +1269,12 @@ public class MainPanel extends Panel { }); jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - jLabel2.setText("Last Move:"); + jLabel2.setText("Cache"); - textCoverMove.setEditable(false); - textCoverMove.setHorizontalAlignment(javax.swing.JTextField.CENTER); - textCoverMove.setDisabledTextColor(new java.awt.Color(0, 0, 0)); - textCoverMove.setEnabled(false); + textCoverCache.setEditable(false); + textCoverCache.setHorizontalAlignment(javax.swing.JTextField.CENTER); + textCoverCache.setDisabledTextColor(new java.awt.Color(0, 0, 0)); + textCoverCache.setEnabled(false); javax.swing.GroupLayout panelCoverLayout = new javax.swing.GroupLayout(panelCover); panelCover.setLayout(panelCoverLayout); @@ -1260,7 +1286,7 @@ public class MainPanel extends Panel { .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(textCoverDet) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(textCoverMove, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)) + .addComponent(textCoverCache, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)) .addContainerGap()) ); panelCoverLayout.setVerticalGroup( @@ -1269,7 +1295,7 @@ public class MainPanel extends Panel { .addContainerGap(12, Short.MAX_VALUE) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(textCoverMove, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(textCoverCache, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 18, Short.MAX_VALUE) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -1288,7 +1314,6 @@ public class MainPanel extends Panel { }); buttonGroup1.add(buttonDrawing); - buttonDrawing.setSelected(true); buttonDrawing.setText("Design"); buttonDrawing.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -1301,15 +1326,12 @@ public class MainPanel extends Panel { panelViewTypeLayout.setHorizontalGroup( panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelViewTypeLayout.createSequentialGroup() - .addContainerGap(18, Short.MAX_VALUE) - .addGroup(panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(buttonDrawing) - .addComponent(buttonCamera)) - .addContainerGap(18, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(buttonCamera, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonDrawing, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - - panelViewTypeLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonCamera, buttonDrawing}); - panelViewTypeLayout.setVerticalGroup( panelViewTypeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelViewTypeLayout.createSequentialGroup() @@ -1329,12 +1351,15 @@ public class MainPanel extends Panel { .addGroup(basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(panelLegend, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelDetection, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 251, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 242, Short.MAX_VALUE) .addGroup(basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(panelCover, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelViewType, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); + + basePlatePanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {panelCover, panelDetection, panelLegend, panelViewType}); + basePlatePanelLayout.setVerticalGroup( basePlatePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, basePlatePanelLayout.createSequentialGroup() @@ -1421,7 +1446,7 @@ public class MainPanel extends Panel { panelBeamlineStatusLayout.setVerticalGroup( panelBeamlineStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelBeamlineStatusLayout.createSequentialGroup() - .addGap(0, 1, Short.MAX_VALUE) + .addGap(0, 0, Short.MAX_VALUE) .addGroup(panelBeamlineStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(led5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8)) @@ -1429,7 +1454,7 @@ public class MainPanel extends Panel { .addGroup(panelBeamlineStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(led6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9)) - .addContainerGap(7, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); panelSystemStatus.setBorder(javax.swing.BorderFactory.createTitledBorder("System Status")); @@ -1490,18 +1515,17 @@ public class MainPanel extends Panel { .addComponent(jLabel29) .addGap(18, 18, Short.MAX_VALUE) .addComponent(panelHeaterTemp, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(panelSystemStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel24) - .addComponent(jLabel25) - .addComponent(jLabel26) - .addComponent(jLabell21) - .addComponent(labelRoomTemperature) - .addComponent(labelManualMode) - .addComponent(jLabel27) - .addGroup(panelSystemStatusLayout.createSequentialGroup() - .addComponent(labelManualMode1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(checkService)))) + .addComponent(jLabel24) + .addComponent(jLabel25) + .addComponent(jLabel26) + .addComponent(jLabell21) + .addComponent(labelRoomTemperature) + .addComponent(labelManualMode) + .addComponent(jLabel27) + .addGroup(panelSystemStatusLayout.createSequentialGroup() + .addComponent(labelManualMode1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(checkService))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(panelSystemStatusLayout.createSequentialGroup() .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -1512,7 +1536,7 @@ public class MainPanel extends Panel { panelSystemStatusLayout.setVerticalGroup( panelSystemStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelSystemStatusLayout.createSequentialGroup() - .addGap(0, 6, Short.MAX_VALUE) + .addGap(0, 0, Short.MAX_VALUE) .addGroup(panelSystemStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ledManualMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelManualMode)) @@ -1553,12 +1577,12 @@ public class MainPanel extends Panel { .addGroup(panelSystemStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ledPsysSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabell21)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelSystemStatusLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelSystemStatusLayout.createSequentialGroup() .addComponent(buttonRelease) .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(filler1, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)) + .addComponent(filler1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(4, 4, 4)) ); @@ -1601,7 +1625,7 @@ public class MainPanel extends Panel { panelDatamatrixLayout.setVerticalGroup( panelDatamatrixLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelDatamatrixLayout.createSequentialGroup() - .addGap(0, 2, Short.MAX_VALUE) + .addGap(0, 0, Short.MAX_VALUE) .addGroup(panelDatamatrixLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11) .addComponent(textPuckDatamatrix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) @@ -1609,7 +1633,7 @@ public class MainPanel extends Panel { .addGroup(panelDatamatrixLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel13) .addComponent(textSampleDatamatrix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(0, 2, Short.MAX_VALUE)) + .addGap(0, 0, Short.MAX_VALUE)) ); javax.swing.GroupLayout panelStatusLayout = new javax.swing.GroupLayout(panelStatus); @@ -1699,13 +1723,6 @@ public class MainPanel extends Panel { } }); - buttonCalibrateCover.setText("Exposure"); - buttonCalibrateCover.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonCalibrateCoverActionPerformed(evt); - } - }); - buttonExpertCommands.setText("Commands"); buttonExpertCommands.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -1727,37 +1744,50 @@ public class MainPanel extends Panel { } }); + buttonDetectionCalibrate.setText("Calibrate"); + buttonDetectionCalibrate.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonDetectionCalibrateActionPerformed(evt); + } + }); + + buttonDetectionExposure.setText("Detection"); + buttonDetectionExposure.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonDetectionExposureActionPerformed(evt); + } + }); + javax.swing.GroupLayout panelExpertLayout = new javax.swing.GroupLayout(panelExpert); panelExpert.setLayout(panelExpertLayout); panelExpertLayout.setHorizontalGroup( panelExpertLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(panelExpertLayout.createSequentialGroup() - .addComponent(checkExpert, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(panelExpertLayout.createSequentialGroup() - .addGroup(panelExpertLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(buttonExpertCommands, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonRecovery, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonCalibrateCover, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonConfig, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(checkExpert, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(buttonExpertCommands, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(panelExpertLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(buttonRecovery, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonConfig, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE) + .addComponent(buttonDetectionCalibrate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonDetectionExposure, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)) ); - panelExpertLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonCalibrateCover, buttonConfig, buttonExpertCommands, buttonRecovery}); + panelExpertLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonConfig, buttonExpertCommands, buttonRecovery}); panelExpertLayout.setVerticalGroup( panelExpertLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelExpertLayout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(checkExpert) - .addGap(18, 18, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonExpertCommands) - .addGap(18, 18, 18) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(buttonRecovery) - .addGap(18, 18, 18) - .addComponent(buttonCalibrateCover) - .addGap(18, 18, 18) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(buttonConfig) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonDetectionCalibrate) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonDetectionExposure) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); @@ -1768,17 +1798,17 @@ public class MainPanel extends Panel { .addGroup(panelDevicesLayout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(devicesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE) - .addComponent(panelExpert, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE) + .addComponent(panelExpert, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(26, Short.MAX_VALUE)) ); panelDevicesLayout.setVerticalGroup( panelDevicesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelDevicesLayout.createSequentialGroup() - .addContainerGap(8, Short.MAX_VALUE) + .addContainerGap(10, Short.MAX_VALUE) .addGroup(panelDevicesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelExpert, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(devicesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)) + .addComponent(devicesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)) .addContainerGap(9, Short.MAX_VALUE)) ); @@ -2050,11 +2080,6 @@ public class MainPanel extends Panel { } }//GEN-LAST:event_buttonRecoveryActionPerformed - private void buttonCalibrateCoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCalibrateCoverActionPerformed - onExpertCommand(null); - execute("setup/CoverDetectionExposureScan.py", null, false, true); - }//GEN-LAST:event_buttonCalibrateCoverActionPerformed - private void buttonConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigActionPerformed onExpertCommand(null); @@ -2100,12 +2125,27 @@ public class MainPanel extends Panel { } }//GEN-LAST:event_checkServiceActionPerformed + private void buttonSampleUnloadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSampleUnloadActionPerformed + try { + sampleTransfer(true); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonSampleUnloadActionPerformed + + private void buttonSampleLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSampleLoadActionPerformed + try { + sampleTransfer(false); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_buttonSampleLoadActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables ch.psi.mxsc.BasePlatePanel basePlatePanel; private javax.swing.JToggleButton btViewDewar; private javax.swing.JToggleButton btViewRT; - private javax.swing.JButton buttonCalibrateCover; private javax.swing.JToggleButton buttonCamera; private javax.swing.JButton buttonConfig; private javax.swing.JButton buttonDetectionCalibrate; @@ -2115,6 +2155,8 @@ public class MainPanel extends Panel { private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton buttonRecovery; private javax.swing.JButton buttonRelease; + private javax.swing.JButton buttonSampleLoad; + private javax.swing.JButton buttonSampleUnload; private javax.swing.JCheckBox checkExpert; private javax.swing.JCheckBox checkService; private ch.psi.mxsc.DevicesPanel devicesPanel; @@ -2181,8 +2223,8 @@ public class MainPanel extends Panel { private javax.swing.JProgressBar progressLN2; private javax.swing.JTable tablePucks; private javax.swing.JTable tableSamples; + private javax.swing.JTextField textCoverCache; private javax.swing.JTextField textCoverDet; - private javax.swing.JTextField textCoverMove; private javax.swing.JTextField textPuckDatamatrix; private javax.swing.JTextField textSampleDatamatrix; // End of variables declaration//GEN-END:variables