Closedown

This commit is contained in:
boccioli_m
2015-09-03 15:12:36 +02:00
parent 7e9eea8d92
commit 20605f08c3
4 changed files with 82 additions and 36 deletions
BIN
View File
Binary file not shown.
+8
View File
@@ -50,6 +50,14 @@
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator2">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItemEditScript">
<Properties>
<Property name="text" type="java.lang.String" value="Edit selected test"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItemEditScriptActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="jMenuItemOpenLog">
<Properties>
<Property name="text" type="java.lang.String" value="Open Log"/>
+36
View File
@@ -3,8 +3,12 @@
*/
//<editor-fold defaultstate="collapsed" desc="import">
import ch.psi.pshell.core.Controller;
import ch.psi.pshell.security.AccessLevel;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.Plugin;
import ch.psi.pshell.ui.View;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.wsaf.Task;
import java.awt.Point;
@@ -347,6 +351,7 @@ public class TestingList extends Panel {
jMenuItemNewTest = new javax.swing.JMenuItem();
jMenuItemNewDevice = new javax.swing.JMenuItem();
jSeparator2 = new javax.swing.JPopupMenu.Separator();
jMenuItemEditScript = new javax.swing.JMenuItem();
jMenuItemOpenLog = new javax.swing.JMenuItem();
jPopupMenuConfigs = new javax.swing.JPopupMenu();
jPopupMenuTable = new javax.swing.JPopupMenu();
@@ -410,6 +415,14 @@ public class TestingList extends Panel {
jMenuAdvanced.add(jMenuItemNewDevice);
jMenuAdvanced.add(jSeparator2);
jMenuItemEditScript.setText("Edit selected test");
jMenuItemEditScript.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemEditScriptActionPerformed(evt);
}
});
jMenuAdvanced.add(jMenuItemEditScript);
jMenuItemOpenLog.setText("Open Log");
jMenuItemOpenLog.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -767,6 +780,10 @@ public class TestingList extends Panel {
}//GEN-LAST:event_jButtonSaveActionPerformed
private void jButtonOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOptionsActionPerformed
//enable some menu items only for administrator access control level
this.jMenuItemEditScript.setEnabled(Controller.getInstance().getLevel()==AccessLevel.administrator);
this.jMenuItemNewTest.setEnabled(Controller.getInstance().getLevel()==AccessLevel.administrator);
this.jMenuItemNewDevice.setEnabled(Controller.getInstance().getLevel()==AccessLevel.administrator);
jPopupMenuOptions.show(jButtonOptions, 0, jButtonOptions.getHeight());
}//GEN-LAST:event_jButtonOptionsActionPerformed
@@ -860,6 +877,20 @@ public class TestingList extends Panel {
enableSelection(false);
}//GEN-LAST:event_jMenuItemDeselectSelectionActionPerformed
private void jMenuItemEditScriptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemEditScriptActionPerformed
// TODO add your handling code here:
int rows[] = jTable1.getSelectedRows();
for(int row=0 ; row<rows.length ; row++){
try {
String sTestPath = String.valueOf(jTable1.getValueAt(rows[row], COL.TESTPATH.ordinal()));
System.out.println(sTestPath);
((View)App.getInstance().getMainFrame()).openScript(sTestPath);
} catch (IOException ex) {
Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_jMenuItemEditScriptActionPerformed
//<editor-fold defaultstate="collapsed" desc="Witget Variables declaration">
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonMoveDown;
@@ -873,6 +904,7 @@ public class TestingList extends Panel {
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuShowSelectedTests1;
private javax.swing.JMenu jMenuAdvanced;
private javax.swing.JMenuItem jMenuItemDeselectSelection;
private javax.swing.JMenuItem jMenuItemEditScript;
private javax.swing.JMenuItem jMenuItemNewDevice;
private javax.swing.JMenuItem jMenuItemNewTest;
private javax.swing.JMenuItem jMenuItemOpenLog;
@@ -1733,6 +1765,10 @@ public class TestingList extends Panel {
}
}
}
//if not administrator, then show only enabled tests
boolean bShow = Controller.getInstance().getLevel()==AccessLevel.administrator;
showSelectedTestsOnly(bShow);
jCheckBoxMenuShowSelectedTests1.setState(bShow);
logger.log(Level.INFO, iCounter + " tests loaded.");
}
+38 -36
View File
@@ -20,48 +20,50 @@ def startTest(testName, DEVICE, params):
######### WRITE YOUR CODE HERE BELOW #############
#All the code in this section ## ..YOUR CODE.. ## can be modified/deleted.
#It must be indented at the same level as this comment
#-----------------------------------
# GETTING INPUTS:
#If needed, the following variables are available:
#testPath string, path of this test file
#testName string, name of this test
#DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
#-----------------------------------
# GETTING TEST PARAMETERS:
#if you need to get parameters for the test, use (casting may be necessary):
#myParamValue = test.getParam('myParamName')
#see the test config for the list of parameters specific to the test.
#-----------------------------------
# SETTING OUTPUTS:
#ret string, a text summarizing the result of the test. It must be set before the end of your code.
#success bool, True = test successful. It must be set before the end of your code.
#test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application.
#Examples:
#
#whenever the code must quit (i.e. after an error), you must end with:
#ret = 'here is some info on what failed on the test'
#success = false
#test.sendFeedback(ret, success)
#
#whenever the code is finished successfully, you must end with:
#ret = 'here is some info on the success of the test'
#success = true
#test.sendFeedback(ret, success)
#-----------------------------------
# LOG INFO:
#when some information must be shown on the log, use:
#test.log('test to log')
"""
All the code in this section ###..YOUR CODE..### can be modified/deleted.
It must be indented to the same level as this comment
-----------------------------------
GETTING INPUTS:
If needed, the following variables are available:
testPath string, path of this test file
testName string, name of this test
DEVICE string, device for which the test must run (typically it is the beginning of a process variable name)
-----------------------------------
GETTING TEST PARAMETERS:
if you need to get parameters for the test, use (casting may be necessary):
myParamValue = test.getParam('myParamName')
see the test config for the list of parameters specific to the test.
-----------------------------------
SETTING OUTPUTS:
ret string, a text summarizing the result of the test. It must be set before the end of your code.
success bool, True = test successful. It must be set before the end of your code.
test.sendFeedback(ret,success) method that ends the testing script and gives the report to the calling application.
Examples:
whenever the code must quit (i.e. after an error), you must end with:
ret = 'here is some info on what failed on the test'
success = false
test.sendFeedback(ret, success)
whenever the code is finished successfully, you must end with:
ret = 'here is some info on the success of the test'
success = true
test.sendFeedback(ret, success)
-----------------------------------
LOG INFO:
when some information must be shown on the log, use:
test.log('test to log')
"""
########## Example (can be removed) ######
#print the list of parameters passed. If any error, stop and send feedback
test.log("Example - Test name: "+testName):
test.log("Example - Device name: "+DEVICE):
test.log("Example - Test name: "+testName)
test.log("Example - Device name: "+DEVICE)
try:
test.log("Running test Initialise with the following parameters:")
test.log(params )
#If present, use the parameters here below for your test script
#If present, use the parameters here below for your test script. You might need to change the casting
#$testParameters
except:
ret = 'Could not retrieve testing parameters - ' + traceback.format_exc()