How to add an AppionLoop GUI page » History » Version 4
Amber Herold, 02/05/2014 05:41 PM
1 | 1 | Amber Herold | h1. How to add an AppionLoop GUI page |
---|---|---|---|
2 | |||
3 | See feature #2634 for more information on the code that supports these directions. |
||
4 | |||
5 | # *Add a wiki page to the [[Appion_Processing|Appion User Guide]] describing how to use this feature* |
||
6 | # *Add a publication reference for the package you are using* |
||
7 | |
||
8 | ## Edit /myami/myamiweb/processing/inc/publicationList.inc to include an entry for any references you need to add to your launch page. |
||
9 | |
||
10 | # *Create a new form class for your feature* |
||
11 | 2 | Amber Herold | |
12 | 1 | Amber Herold | ** Create a new file in myami/myamiweb/processing/inc/forms. Call it coolFeatureForm.inc. |
13 | ** Create a class in this file that extends the BasicLoopForm class like this: |
||
14 | <pre> |
||
15 | require_once "basicLoopForm.inc"; |
||
16 | |||
17 | class AutoMaskForm extends BasicLoopForm |
||
18 | { |
||
19 | ... |
||
20 | </pre> |
||
21 | ** Examples are available in autoMaskForm.inc and makeDDstackForm.inc |
||
22 | 2 | Amber Herold | |
23 | 4 | Amber Herold | # *Set parameters needed by the BasicLoopForm class in the constructor* |
24 | 1 | Amber Herold | |
25 | <pre> |
||
26 | //------ Set Parameters for the parent class, BasicLoopForm (general Appion params) -----// |
||
27 | |||
28 | // Set the publications to be references on the web pages |
||
29 | $pubList = array('appion'); // The publication reference key that you added to publicationList.inc |
||
30 | $this->setPublications( $pubList ); |
||
31 | |||
32 | // Job Type should be unique to Appion. Used in the database to determine the type of job being run. |
||
33 | $this->setJobType( 'maskmaker' ); |
||
34 | |||
35 | // The name of the folder that all runs of this job type will be stored in. |
||
36 | $this->setOutputDirectory( 'mask' ); |
||
37 | |||
38 | // A portion of the run name that will be common (by default) to all runs of this job type. A unique number is appended to individual run names. |
||
39 | $this->setBaseRunName( 'maskrun' ); |
||
40 | |||
41 | // The title on the web page for this feature. |
||
42 | $this->setTitle( 'Auto Masking Launcher' ); |
||
43 | |||
44 | // The Heading on the web page for this feature. |
||
45 | $this->setHeading( 'Automated Masking with EM Hole Finder' ); |
||
46 | |||
47 | // The name of the python executable file that this GUI corresponds to. It should be based on the AppionLoop class and located in the myami/appion/bin folder. |
||
48 | $this->setExeFile( 'automasker.py' ); |
||
49 | |||
50 | // A URL corresponding to a wiki page in the Appion User Guide with information on running this feature. |
||
51 | $this->setGuideURL( "http://emg.nysbc.org/projects/appion/wiki/Appion_Processing" ); |
||
52 | 2 | Amber Herold | |
53 | // True to activate "test single image" field of Appion Loop parameters. |
||
54 | $this->setTestable( True ); |
||
55 | |||
56 | // The output directory will be created in the Appion run directory rather than Leginon. |
||
57 | $this->setUseLegOutDir( False ); |
||
58 | |||
59 | // Flag to hide the description field of the run parameters. True enables the description field. |
||
60 | $this->setShowDesc( False ); |
||
61 | 1 | Amber Herold | </pre> |
62 | 3 | Amber Herold | |
63 | # *Take an inventory of the parameters that are specific to your new feature and are passed into your python executable file* |
||
64 | ** Make a list of all the parameters that your GUI needs to expose to the user. For each parameter decide on: |
||
65 | ### *id* I might also call it a parameter key or name. This should match the name of the parameter as it appears on the command line. So a flag in a command that looks like "--mycoolflag" should be named "mycoolflag" in this class. |
||
66 | ### *default value* |
||
67 | ### *label* This is the text that is actually shown to the user in the GUI next to the GUI element associated with it (check box, selection, text, etc) |
||
68 | ### *help text* A longer description of the parameter and tips for what a user should set it to. |
||
69 | ### *validations* Decide what should be considered valid values for this parameter. Is it required? Does it have to be a number or greater than zero? |
||
70 | |
||
71 | # *Add your parameters help text to myami/myamiweb/processing/js/help.js* |
||
72 | |
||
73 | ** Open myami/myamiweb/processing/js/help.js |
||
74 | ** Add a new namespace for your form, you can copy the 'simple' section. Don't forget any commas. |
||
75 | ** add a help string for each of the parameter keys in your form |
||
76 | |
||
77 | # *Add your parameters to your form class* |
||
78 | |
||
79 | ** Back in the class that you created to extend BasicLoopForm, add your parameters. |
||
80 | ** First set the help section using the namespace that you just added to help.js. |
||
81 | <pre> |
||
82 | // Get an instance of the form parameters associated with this class |
||
83 | $params = $this->getFormParams(); |
||
84 | |||
85 | // The help section corresponds to the array key for these parameters found in help.js for popup help. |
||
86 | $params->setHelpSection( "em_hole_finder" ); |
||
87 | </pre> |
||
88 | ** Add a line for each of the parameters in your form |
||
89 | <pre> |
||
90 | $params->addParam( "downsample", $downsample, "Downsample" ); |
||
91 | $params->addParam( "compsizethresh", $compsizethresh, "Component size thresholding" ); |
||
92 | </pre> |