Fix Queues

This commit is contained in:
gac-ISS
2023-01-11 10:39:12 +01:00
parent c2b9b275c7
commit 2fb24afec1
8 changed files with 572 additions and 394 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
i0=ch.psi.pshell.epics.ChannelDouble|X07DB-KEI10:READOUT|Read||true
capture=ch.psi.pshell.epics.ChannelInteger|NAPP-SCIENTA:HDF1:Capture|||true
energy=ch.psi.pshell.epics.Positioner|X07DB-OP-MONO:ENERGY X07DB-OP-MONO:ERBK|||true
$energy=ch.psi.pshell.epics.Positioner|X07DB-OP-MONO:ENERGY X07DB-OP-MONO:ERBK|||true
scienta=Scienta|NAPP-SCIENTA|||true
spectrum=ch.psi.pshell.imaging.CameraSource|scienta|||true
AcquisitionMode=ch.psi.pshell.epics.ChannelString|NAPP-SCIENTA:cam1:ACQ_MODE_RBV|||
@@ -11,5 +11,5 @@ PassEnergy=ch.psi.pshell.epics.ChannelString|NAPP-SCIENTA:cam1:PASS_ENERGY_RBV||
ElementSet=ch.psi.pshell.epics.ChannelString|NAPP-SCIENTA:cam1:ELEMENT_SET_RBV|||
StepSize=ch.psi.pshell.epics.ChannelDouble|NAPP-SCIENTA:cam1:STEP_SIZE_RBV|||
NumIterations=ch.psi.pshell.epics.ChannelDouble|NAPP-SCIENTA:cam1:NumExposures_RBV|||
EntranceSlit=ch.psi.pshell.epics.ChannelDouble|X07DB-OP-SH1:TR1|||
ExitSlit=ch.psi.pshell.epics.ChannelDouble|X07DB-OP-SH2:TR1|||
$EntranceSlit=ch.psi.pshell.epics.ChannelDouble|X07DB-OP-SH1:TR1|||
$ExitSlit=ch.psi.pshell.epics.ChannelDouble|X07DB-OP-SH2:TR1|||
+2 -1
View File
@@ -52,10 +52,11 @@
"noVariableEvaluationPropagation" : false,
"processingScripts" : [ ],
"asyncViewersUpdate" : false,
"asyncHistoryPlotsUpdate" : false,
"scanPlotDisabled" : false,
"scanTableDisabled" : false,
"cachedDataPanel" : false,
"dataExtensions" : "",
"dataExtensions" : "ens",
"dataSubFiles" : "",
"hideFileName" : false,
"showEmergencyStop" : false,
+4 -4
View File
@@ -1,4 +1,4 @@
#Thu Dec 15 00:41:53 CET 2022
LastRunDate=221215
FileSequentialNumber=73
DaySequentialNumber=2
#Wed Jan 11 10:35:51 CET 2023
LastRunDate=230111
FileSequentialNumber=99
DaySequentialNumber=6
+342 -293
View File
@@ -1,293 +1,342 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JEditorPane" name="jEditorPane1">
</Component>
</SubComponents>
</Container>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel2" alignment="1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="buttonStart" linkSize="3" min="-2" pref="150" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
<Component id="buttonAbort" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="checkAutoSaveArgs" linkSize="5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textFileId" linkSize="4" min="-2" pref="67" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonScienta" linkSize="5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonResetId" linkSize="4" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jPanel2" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="checkAutoSaveArgs" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textFileId" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonScienta" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonResetId" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="checkAutoSaveArgs">
<Properties>
<Property name="text" type="java.lang.String" value="Auto save parameters"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonScienta">
<Properties>
<Property name="text" type="java.lang.String" value="Scienta Panel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScientaActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Parameters"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textName" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonOpen" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonSave" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="textName" alignment="3" max="32767" attributes="0"/>
<Component id="buttonOpen" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonSave" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="textName">
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Regions"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonAdd" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonDelete" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="103" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonAdd" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDelete" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="table">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="3" rowCount="0">
<Column editable="true" title="Start" type="java.lang.Double"/>
<Column editable="true" title="End" type="java.lang.Double"/>
<Column editable="true" title="Step" type="java.lang.Double"/>
</Table>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="buttonAdd">
<Properties>
<Property name="text" type="java.lang.String" value="Add"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonDelete">
<Properties>
<Property name="text" type="java.lang.String" value="Delete"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDeleteActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonOpen">
<Properties>
<Property name="text" type="java.lang.String" value="Open"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOpenActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonSave">
<Properties>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSaveActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="File ID:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textFileId">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonResetId">
<Properties>
<Property name="text" type="java.lang.String" value="Reset"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonResetIdActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JEditorPane" name="jEditorPane1">
</Component>
</SubComponents>
</Container>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel2" alignment="1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="9" max="32767" attributes="0"/>
<Component id="buttonStart" linkSize="3" min="-2" pref="150" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
<Component id="buttonAbort" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="19" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="checkAutoSaveArgs" linkSize="5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textFileId" linkSize="4" min="-2" pref="67" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonScienta" linkSize="5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonResetId" linkSize="4" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jPanel2" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="checkAutoSaveArgs" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textFileId" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonScienta" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonResetId" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" pref="32" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="checkAutoSaveArgs">
<Properties>
<Property name="text" type="java.lang.String" value="Auto save parameters"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonScienta">
<Properties>
<Property name="text" type="java.lang.String" value="Scienta Panel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonScientaActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Parameters"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textName" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonClear" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonOpen" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonSave" linkSize="6" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerPasses" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAddToQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="textName" alignment="3" max="32767" attributes="0"/>
<Component id="buttonOpen" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonSave" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonClear" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonAddToQueue" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPasses" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="textName">
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Regions"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonAdd" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonDelete" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="82" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonAdd" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDelete" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="table">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="3" rowCount="0">
<Column editable="true" title="Start" type="java.lang.Double"/>
<Column editable="true" title="End" type="java.lang.Double"/>
<Column editable="true" title="Step" type="java.lang.Double"/>
</Table>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="buttonAdd">
<Properties>
<Property name="text" type="java.lang.String" value="Add"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonDelete">
<Properties>
<Property name="text" type="java.lang.String" value="Delete"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDeleteActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonOpen">
<Properties>
<Property name="text" type="java.lang.String" value="Open"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOpenActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonSave">
<Properties>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSaveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAddToQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Add To Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddToQueueActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Passes:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerPasses">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonClear">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonClearActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="File ID:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textFileId">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonResetId">
<Properties>
<Property name="text" type="java.lang.String" value="Reset"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonResetIdActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
+155 -70
View File
@@ -1,7 +1,6 @@
import ch.psi.pshell.core.JsonSerializer;
import ch.psi.pshell.epics.Positioner;
import ch.psi.pshell.ui.PanelProcessor;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.EncoderJson;
import ch.psi.utils.IO;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
@@ -12,6 +11,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
@@ -21,7 +21,7 @@ import javax.swing.table.DefaultTableModel;
/**
*
*/
public class EnergyScan extends PanelProcessor {
public class EnergyScan extends ScriptProcessor {
final DefaultTableModel model;
Positioner energy;
@@ -38,6 +38,11 @@ public class EnergyScan extends PanelProcessor {
return "Energy Scan";
}
@Override
public boolean canSave() {
return true;
}
@Override
public boolean createMenuNew() {
return true;
@@ -71,9 +76,10 @@ public class EnergyScan extends PanelProcessor {
@Override
public void onStateChange(State state, State former) {
buttonStart.setEnabled(state == State.Ready);
buttonAbort.setEnabled(state.isProcessing());
buttonStart.setEnabled(state == State.Ready);
buttonAbort.setEnabled((state == State.Busy) && isRunning());
buttonScienta.setEnabled(state.isInitialized());
buttonAddToQueue.setEnabled(buttonStart.isEnabled());
updateSeq();
}
@@ -104,9 +110,11 @@ public class EnergyScan extends PanelProcessor {
Double stop = (Double) model.getValueAt(i, 1);
Double step = (Double) model.getValueAt(i, 2);
if (Double.isNaN(start) || Double.isNaN(stop) || Double.isNaN(step)
|| (start >= stop) || (step < 0)
|| (step < 0)
|| (start < energy.getMinValue())
|| (stop > energy.getMaxValue())) {
|| (stop > energy.getMaxValue())
|| (start > energy.getMaxValue())
|| (stop < energy.getMinValue())) {
throw new IllegalArgumentException();
}
}
@@ -118,11 +126,66 @@ public class EnergyScan extends PanelProcessor {
}
@Override
public void execute() throws Exception {
checkValues();
String lastOutput = getContext().getDataManager().getLastOutput();
public void saveAs(String fileName) throws IOException {
currentFile = new File(fileName);
ArrayList data = new ArrayList();
data.add(new Object[][]{new Object[]{textName.getText()}});
data.add(model.getDataVector());
data.add(spinnerPasses.getValue());
String json = EncoderJson.encode(data, true);
Files.write(currentFile.toPath(), json.getBytes());
}
HashMap args = new HashMap();
@Override
public void open(String fileName) throws IOException {
if (fileName==null){
currentFile = null;
textName.setText("");
model.setRowCount(0);
spinnerPasses.setValue(1);
} else {
Path path = Paths.get(fileName);
String json = new String(Files.readAllBytes(path));
currentFile = path.toFile();
Object[][][] vector = (Object[][][]) EncoderJson.decode(json, Object[][][].class);
textName.setText(String.valueOf(vector[0][0][0]));
model.setDataVector(vector[1], SwingUtils.getTableColumnNames(table));
spinnerPasses.setValue((vector.length>2) ? (Integer)vector[2][0][0] : 1);
}
}
String lastOutput;
@Override
protected void onStartingExecution(Map<String, Object> args){
getLogger().warning(this.getFileName());
lastOutput = getContext().getDataManager().getLastOutput();
}
@Override
protected void onFinishedExecution(Map<String, Object> args, Object ret, Throwable t){
if (checkAutoSaveArgs.isSelected()) {
//Save scan attributes
String output = getContext().getDataManager().getLastOutput();
if ((output != null) && !output.isEmpty() && !output.equals(lastOutput)) {
try {
saveAs(output + "." + FILE_EXTENSION);
} catch (IOException e) {
Logger.getLogger(EnergyScan.class.getName()).log(Level.WARNING, null, e);
}
}
}
}
@Override
public String getScript() {
return "templates/EnergyScan";
}
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
checkValues();
ArrayList regions = new ArrayList();
for (int i = 0; i < model.getRowCount(); i++) {
ArrayList region = new ArrayList();
@@ -133,51 +196,11 @@ public class EnergyScan extends PanelProcessor {
}
args.put("FILE", null);
args.put("NAME", getScanName());
args.put("REGIONS", regions);
this.runAsync("templates/EnergyScan", args).handle((ret, ex) -> {
if (ex != null) {
}
if (checkAutoSaveArgs.isSelected()) {
//Save scan attributes
String output = getContext().getDataManager().getLastOutput();
if ((output != null) && !output.isEmpty() && !output.equals(lastOutput)) {
try {
saveAs(output + "." + FILE_EXTENSION);
} catch (IOException e) {
Logger.getLogger(EnergyScan.class.getName()).log(Level.WARNING, null, e);
}
}
}
return ret;
});
args.put("REGIONS", regions);
args.put("PASSES", spinnerPasses.getValue());
return args;
}
@Override
public void saveAs(String fileName) throws IOException {
currentFile = new File(fileName);
ArrayList data = new ArrayList();
data.add(new Object[][]{new Object[]{textName.getText()}});
data.add(model.getDataVector());
String json = JsonSerializer.encode(data, true);
Files.write(currentFile.toPath(), json.getBytes());
}
@Override
public void open(String fileName) throws IOException {
if (fileName==null){
currentFile = null;
textName.setText("");
model.setRowCount(0);
} else {
Path path = Paths.get(fileName);
String json = new String(Files.readAllBytes(path));
currentFile = path.toFile();
Object[][][] vector = (Object[][][]) JsonSerializer.decode(json, Object[][][].class);
textName.setText(String.valueOf(vector[0][0][0]));
model.setDataVector(vector[1], SwingUtils.getTableColumnNames(table));
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -198,6 +221,10 @@ public class EnergyScan extends PanelProcessor {
jLabel1 = new javax.swing.JLabel();
buttonOpen = new javax.swing.JButton();
buttonSave = new javax.swing.JButton();
buttonAddToQueue = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
spinnerPasses = new javax.swing.JSpinner();
buttonClear = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
textFileId = new javax.swing.JTextField();
buttonResetId = new javax.swing.JButton();
@@ -285,7 +312,7 @@ public class EnergyScan extends PanelProcessor {
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAdd)
@@ -309,6 +336,24 @@ public class EnergyScan extends PanelProcessor {
}
});
buttonAddToQueue.setText("Add To Queue");
buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAddToQueueActionPerformed(evt);
}
});
jLabel3.setText("Passes:");
spinnerPasses.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));
buttonClear.setText("Clear");
buttonClear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonClearActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
@@ -316,17 +361,31 @@ public class EnergyScan extends PanelProcessor {
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textName)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonClear)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonOpen)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonSave)))
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textName)
.addGap(18, 18, 18)
.addComponent(buttonOpen)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonSave)))
.addContainerGap())
.addComponent(spinnerPasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAddToQueue)
.addGap(26, 26, 26))))
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonClear, buttonOpen, buttonSave});
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
@@ -335,10 +394,16 @@ public class EnergyScan extends PanelProcessor {
.addComponent(textName)
.addComponent(buttonOpen)
.addComponent(buttonSave)
.addComponent(jLabel1))
.addComponent(jLabel1)
.addComponent(buttonClear))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(12, 12, 12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonAddToQueue)
.addComponent(jLabel3)
.addComponent(spinnerPasses, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
jLabel2.setText("File ID:");
@@ -362,11 +427,11 @@ public class EnergyScan extends PanelProcessor {
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGap(0, 9, Short.MAX_VALUE)
.addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(buttonAbort)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(19, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
@@ -401,7 +466,7 @@ public class EnergyScan extends PanelProcessor {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonScienta)
.addComponent(buttonResetId))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 32, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonStart)
.addComponent(buttonAbort))
@@ -497,9 +562,27 @@ public class EnergyScan extends PanelProcessor {
}
}//GEN-LAST:event_buttonResetIdActionPerformed
private void buttonAddToQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddToQueueActionPerformed
try {
queue(); //TODO: Data/file
} catch (Exception ex) {
showException( ex);
}
}//GEN-LAST:event_buttonAddToQueueActionPerformed
private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed
try {
open(null);
} catch (Exception ex) {
showException( ex);
}
}//GEN-LAST:event_buttonClearActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonAdd;
private javax.swing.JButton buttonAddToQueue;
private javax.swing.JButton buttonClear;
private javax.swing.JButton buttonDelete;
private javax.swing.JButton buttonOpen;
private javax.swing.JButton buttonResetId;
@@ -510,10 +593,12 @@ public class EnergyScan extends PanelProcessor {
private javax.swing.JEditorPane jEditorPane1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JSpinner spinnerPasses;
private javax.swing.JTable table;
private javax.swing.JTextField textFileId;
private javax.swing.JTextField textName;
+16 -1
View File
@@ -147,6 +147,11 @@
</Group>
<EmptySpace min="14" pref="14" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAddToQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@@ -164,7 +169,9 @@
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerScans" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="100" max="32767" attributes="0"/>
<EmptySpace pref="66" max="32767" attributes="0"/>
<Component id="buttonAddToQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -205,6 +212,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSaveActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAddToQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Add To Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddToQueueActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel2">
+46 -21
View File
@@ -1,7 +1,7 @@
import ch.psi.pshell.core.JsonSerializer;
import ch.psi.pshell.scan.Scan;
import ch.psi.pshell.ui.PanelProcessor;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.EncoderJson;
import ch.psi.utils.IO;
import ch.psi.utils.State;
import java.io.File;
@@ -11,18 +11,17 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.CompletableFuture;
import java.util.Map;
import java.util.logging.Level;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
*
*/
public class TimeResolved extends PanelProcessor {
public class TimeResolved extends ScriptProcessor {
File currentFile;
public static final String FILE_EXTENSION = "tmr";
CompletableFuture taskFuture;
public TimeResolved() {
initComponents();
@@ -33,6 +32,11 @@ public class TimeResolved extends PanelProcessor {
return "Time Resolved";
}
@Override
public boolean canSave() {
return true;
}
@Override
public boolean createMenuNew() {
return true;
@@ -67,15 +71,16 @@ public class TimeResolved extends PanelProcessor {
@Override
public void onStateChange(State state, State former) {
buttonStart.setEnabled(state == State.Ready);
buttonAbort.setEnabled(state.isProcessing());
buttonAbort.setEnabled((state == State.Busy) && isRunning());
buttonScienta.setEnabled(state.isInitialized());
buttonAddToQueue.setEnabled(buttonStart.isEnabled());
updateSeq();
}
@Override
public void onTimer() {
try{
if (taskFuture!=null){
if (isRunning()){
Scan scan = getContext().getExecutionPars().getCurrentScan();
if (scan!=null){
int index = scan.getRecordIndex();
@@ -112,29 +117,26 @@ public class TimeResolved extends PanelProcessor {
}
@Override
public void execute() throws Exception {
String lastOutput = getContext().getDataManager().getLastOutput();
public String getScript() {
return "templates/TimeResolved";
}
HashMap args = new HashMap();
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
args.put("FILE", null);
args.put("NAME", getScanName());
args.put("SCANS", spinnerScans.getValue());
taskFuture = runAsync("templates/TimeResolved", args);
taskFuture.handle((ret, ex) -> {
if (ex != null) {
}
taskFuture = null;
return ret;
});
return args;
}
@Override
public void saveAs(String fileName) throws IOException {
currentFile = new File(fileName);
ArrayList data = new ArrayList();
data.add(textName.getText());
data.add(spinnerScans.getValue());
String json = JsonSerializer.encode(data, true);
String json = EncoderJson.encode(data, true);
Files.write(currentFile.toPath(), json.getBytes());
}
@@ -148,7 +150,7 @@ public class TimeResolved extends PanelProcessor {
Path path = Paths.get(fileName);
String json = new String(Files.readAllBytes(path));
currentFile = path.toFile();
Object[] vector = (Object[]) JsonSerializer.decode(json, Object[].class);
Object[] vector = (Object[]) EncoderJson.decode(json, Object[].class);
textName.setText(String.valueOf(vector[0]));
spinnerScans.setValue(vector[1]);
}
@@ -170,6 +172,7 @@ public class TimeResolved extends PanelProcessor {
textName = new javax.swing.JTextField();
buttonOpen = new javax.swing.JButton();
buttonSave = new javax.swing.JButton();
buttonAddToQueue = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
textFileId = new javax.swing.JTextField();
buttonResetId = new javax.swing.JButton();
@@ -221,6 +224,13 @@ public class TimeResolved extends PanelProcessor {
}
});
buttonAddToQueue.setText("Add To Queue");
buttonAddToQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAddToQueueActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
@@ -241,6 +251,10 @@ public class TimeResolved extends PanelProcessor {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonSave)))
.addGap(14, 14, 14))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAddToQueue)
.addContainerGap())
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel3});
@@ -258,7 +272,9 @@ public class TimeResolved extends PanelProcessor {
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(spinnerScans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(100, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
.addComponent(buttonAddToQueue)
.addContainerGap())
);
jLabel2.setText("File ID:");
@@ -404,8 +420,17 @@ public class TimeResolved extends PanelProcessor {
}
}//GEN-LAST:event_buttonSaveActionPerformed
private void buttonAddToQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddToQueueActionPerformed
try {
queue(); //TODO: Data/file
} catch (Exception ex) {
showException( ex);
}
}//GEN-LAST:event_buttonAddToQueueActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonAddToQueue;
private javax.swing.JButton buttonOpen;
private javax.swing.JButton buttonResetId;
private javax.swing.JButton buttonSave;
+4 -1
View File
@@ -1,6 +1,7 @@
if get_exec_pars().debug:
print "Setting debug parameters"
REGIONS = [[523.0, 527.0, 2.0], [527.0, 535.0, 4.0], [535.0, 558.0, 2.0]]
PASSES = 1
NAME = None
FILE = None
@@ -10,9 +11,11 @@ if FILE:
with open(FILE) as json_file:
cfg = json.load(json_file)
NAME , REGIONS= cfg[0][0][0], cfg[1]
PASSES = 1 if len(cfg<3) else cfg[2]
print "FILE: ", FILE
print "NAME: ", NAME
print "REGIONS: ", REGIONS
print "PASSES: ", PASSES
IOC_AUTO_SAVE = False
DUMMY_TRIGGER = True
@@ -34,7 +37,7 @@ if IOC_AUTO_SAVE:
capture.write(1)
try:
rscan(energy, sensors, REGIONS, latency = 0.0, before_read=before_read, after_read=after_readout, name = NAME)
rscan(energy, sensors, REGIONS, latency = 0.0, passes=PASSES, split=True, before_read=before_read, after_read=after_readout, name = NAME)
finally:
if IOC_AUTO_SAVE:
capture.write(0)