diff --git a/plugins/TestingList.java b/plugins/TestingList.java index fc00927..ed4fe0a 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -54,9 +54,12 @@ public class TestingList extends Panel { switch(fileName){ case "power-supply": Object ret = eval("ret"); + boolean success = (boolean) eval("success"); + Object deviceName = eval("deviceName"); + Object testName = eval("testName"); if (ret != null) { //SwingUtils.showMessage(getComponent(), "", ret.toString() + " - " + ret.getClass().getName()); - testingList.showResult(ret.toString()); + testingList.showResult(deviceName.toString(), testName.toString(), ret.toString(), success); } break; } @@ -75,12 +78,39 @@ public class TestingList extends Panel { } @SuppressWarnings("unchecked") - - public void showResult(String res){ - txtOutput.setText(res); - jTable1.setValueAt(res, 1, 3); + public void showResult(String deviceName, String testName, String res, boolean success){ + + int COL_RESULT = 3; + int COL_SUCCESS = 4; + + txtOutput.setText(res); + boolean bDeviceFound = false, bTestFound = false; + int rowD, colT, colD; + //search for device name in table + for (rowD = 0; rowD <= jTable1.getRowCount() - 1; rowD++) { + + for (colD = 0; colD <= jTable1.getColumnCount() - 1; colD++) { + + if (deviceName.equals(jTable1.getValueAt(rowD, colD))) { + + bDeviceFound = true; + } + } + } + if (bDeviceFound){ + //search for test name in table + for (colT = 0; colT <= jTable1.getColumnCount() - 1; colT++) { + + if (testName.equals(jTable1.getValueAt(rowD, colT))) { + + bTestFound = true; + } + } + } + jTable1.setValueAt(res, rowD, COL_RESULT); + jTable1.setValueAt(success, rowD, COL_SUCCESS); } // //GEN-BEGIN:initComponents @@ -172,23 +202,7 @@ public class TestingList extends Panel { SwingUtils.showException(this, ex); } }//GEN-LAST:event_jButton1ActionPerformed - - public void onExecutedFile(String fileName) { - try { - switch(fileName){ - case "power-supply": - Object ret = eval("ret"); - if (ret != null) { - showResult(ret.toString()); - } - break; - } - } - catch (Exception ex) { - - } - } - + // Variables declaration - do not modify//GEN-BEGIN:variables private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel1; private javax.swing.JButton jButton1; diff --git a/script/power-supply.py b/script/power-supply.py index 15fe78b..76179be 100644 --- a/script/power-supply.py +++ b/script/power-supply.py @@ -1,5 +1,13 @@ #TODO: Set the diplay names of positioners and detectors #ManualScan(writables, readables, start = None, end = None, steps = None, relative = False) + +#testname +testName = "Calibrate" + +#device name +deviceName = "RS" + + scan = ManualScan(['time'], ['SetVA', 'ActualVA', 'ActualIA'] , [0.0], [20.0], [10]) scan.start() @@ -66,4 +74,5 @@ ActualIA.close() scan.end() -ret = 'pippo' \ No newline at end of file +ret = 'test completed' +success = True \ No newline at end of file