This commit is contained in:
2019-08-26 13:53:09 +02:00
parent c98c12f7e0
commit 2b84c7e1d0
2 changed files with 41 additions and 27 deletions

View File

@@ -17,33 +17,32 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace pref="503" max="32767" attributes="0"/>
<EmptySpace pref="582" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="edit_y_center_of_mass" min="-2" pref="124" max="-2" attributes="0"/>
<Component id="edit_x_center_of_mass" min="-2" pref="124" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="72" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="buttonRec" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="buttonStop" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="92" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="72" max="-2" attributes="0"/>
</Group>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="renderer" min="-2" pref="462" max="-2" attributes="0"/>
<EmptySpace pref="361" max="32767" attributes="0"/>
<EmptySpace pref="440" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
@@ -66,12 +65,12 @@
<Component id="buttonRec" min="-2" max="-2" attributes="0"/>
<Component id="buttonStop" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="151" max="32767" attributes="0"/>
<EmptySpace pref="190" max="32767" attributes="0"/>
</Group>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="renderer" pref="481" max="32767" attributes="0"/>
<Component id="renderer" pref="520" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>

View File

@@ -1,5 +1,6 @@
import ch.psi.pshell.bs.PipelineServer;
import ch.psi.pshell.bs.StreamValue;
import ch.psi.pshell.core.CommandSource;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceListener;
@@ -7,13 +8,17 @@ import ch.psi.pshell.imaging.ColormapSource;
import ch.psi.pshell.imaging.Overlay;
import ch.psi.pshell.imaging.Overlays;
import ch.psi.pshell.scan.MonitorScan;
import ch.psi.pshell.swing.DataPanel;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.Threading;
import ch.psi.utils.swing.MainFrame;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.HashMap;
@@ -199,16 +204,27 @@ public class AthosCameras extends Panel {
MonitorScan scan;
void startRecording() throws IOException, InterruptedException{
void startRecording() throws Exception{
System.out.println("startRecording");
getContext().startExecution(CommandSource.plugin, null, cameraName,null, false);
getContext().setExecutionPar("name", cameraName);
getContext().setExecutionPar("open", true);
scan= new MonitorScan(dataPipeline.getStream(), dataPipeline.getStream().getReadables().toArray(new ch.psi.pshell.device.Readable[0]), -1, -1);
Threading.getFuture(() ->scan.start());
DataPanel panel = DataPanel.create(new File(getContext().getExecutionPars().getPath()));
SwingUtils.showDialog(getTopLevel(), getContext().getExecutionPars().getPath(), new Dimension(800,600), panel);
}
void stopRecording() throws InterruptedException{
void stopRecording() throws Exception{
System.out.println("stopRecording");
scan.abort();
showMessage("Data recording", "Data saved to: " + getContext().getExecutionPars().getPath());
scan.abort();
//showMessage("Data recording", "Data saved to: " + getContext().getExecutionPars().getPath());
getContext().endExecution();
}
@@ -256,27 +272,26 @@ public class AthosCameras extends Panel {
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(503, Short.MAX_VALUE)
.addContainerGap(582, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addComponent(jLabel1)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(edit_y_center_of_mass, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(edit_x_center_of_mass, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(72, 72, 72))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(edit_x_center_of_mass, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(buttonRec)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonStop)
.addGap(92, 92, 92))))
.addGap(2, 2, 2)
.addComponent(buttonStop)))
.addGap(72, 72, 72))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(renderer, javax.swing.GroupLayout.PREFERRED_SIZE, 462, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(361, Short.MAX_VALUE)))
.addContainerGap(440, Short.MAX_VALUE)))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -293,11 +308,11 @@ public class AthosCameras extends Panel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(buttonRec)
.addComponent(buttonStop))
.addContainerGap(151, Short.MAX_VALUE))
.addContainerGap(190, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 481, Short.MAX_VALUE)
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
.addContainerGap()))
);
}// </editor-fold>//GEN-END:initComponents