node_chain_GUI¶
Module: run.gui.node_chain_GUI
¶
Graphical user interface to create a complete processing flow
This version uses PyQt4 and YAML, and was developed with Python 2.6.5
When started the GUI is checking for all existing nodes. It lists them and the corresponding parameters. Comments can also be inserted. They will appear at the beginning of the output file, which has the YAML format.
Author: | Sirko Straube (sirko.straube@dfki.de) |
---|---|
Created: | 2010/06 |
Inheritance diagram for pySPACE.run.gui.node_chain_GUI
:
Class Summary¶
ConfDialog (flow_directory) |
Central class of the gui |
NodeChainConfigurationWidget ([...]) |
class which sets up GUI |
Classes¶
ConfDialog
¶
-
class
pySPACE.run.gui.node_chain_GUI.
ConfDialog
(flow_directory)[source]¶ Bases:
object
Central class of the gui
Here all nodes are listed, the GUI is established and all necessary functions (within or behind the GUI) are defined. Therefore an instance of this class is a complete, fully functioning GUI.
The object is created in the class ConfiguratorDialog (see below).
Class Components Summary
deactivate_nodes
()Function that (i) uses yaml.dump to format dict according to YAML specifications and (ii) deactivates nodes by adding the comment symbol “#”. defaultParam
()the default value is not set here. instead, the parameter is deleted from the delNode
()delete node from current specifications. eval_user_defined
()Evaluate a user defined parameter, so that it can be managed properly. find_inactive_nodes
(rawdata)This function takes raw YAML data (i.e. formatNodeBox
()Format NodeBox according to type selection in TypeNodeBox formatParamBox
()Format ParamBox according to node selection in NodeBox. getPriority
()determine the priority of the selected node. getState
()determines if node is specified as active and sets check accordingly in GUI get_node_type
(node_str)Parse node string for the node type get_param_value
()Get the value of the current parameter (if given) in order to display it in the corresponding TextEdit (ParamValue). import_comment
(filename)this function loads the given filename and stores all lines starting with ‘#’ init_CommentUi
()setting up layout and connections of the comment dialog init_HelpUi
()setting up layout and connections of the help dialog insertImage
(icon, filename)insert image into label insertNode
()inserts a node in specifications according to where the user specified it loadYAMLFile
()load YAML file specified by user: makeConnections
()All other connections that are necessary to make the GUI work. note
(notestring)add notestring to current notes note_user_defined
()display a special note only for user defined parameters resetNoteConnections
()Each time something happens in the GUI, the notes are deleted. resetNotes
()reset text in Notes saveYAMLFile
()saves specs to specified file: selectFile
()Opens the SelectFile Dialog and inserts filename in FileEdit field. setParam
()insert parameter into current specifications setPriority
(priority)the given priority is displayed in the corresponding line edit setState
()set state in specs (internally) setupUi
(Dialog)This function does all the graphical stuff showSpecs
()show the complete specification text in YAML format show_CommentUi
()shows and updates comment ui show_HelpUi
()shows and updates help ui updateFileName
()new filename is stored internally update_comment
()writes content of commentUI-window into comment variable update_help
()updates text in help ui according to current node validateNodesandParams
(specs)This function checks the current specification for possible unspecified nodes. -
setupUi
(Dialog)[source]¶ This function does all the graphical stuff
The output is mainly modified from raw code created with QTDesigner. Here just the layout of the GUI is defined. The whole arrangement is mainly controlled by horizontal and vertical layouts objects and a grid layout for the whole window.
-
update_comment
()[source]¶ writes content of commentUI-window into comment variable and modifies appropriately with # symbol (if necessary)
-
get_node_type
(node_str)[source]¶ Parse node string for the node type
This function assigns the node string (2nd argument) to a type which is used for the type sorting in the GUI. The function takes the whole NODE_MAPPING string: The type is the string between “pySPACE.missions.nodes.” and the next ”.” and corresponds to the directory in pySPACE/missions/nodes/
Returns: node type string and a boolean reflecting the success of the assignment
-
formatParamBox
()[source]¶ Format ParamBox according to node selection in NodeBox. The parameter-list is derived from the parameters of the __init__ function of the current node. The parameters “self” and “args” are omitted, “kwargs” is translated into “user defined”
-
validateNodesandParams
(specs)[source]¶ This function checks the current specification for possible unspecified nodes. This is necessary when e.g. a file is loaded. The file is ignored, if a non-existing node is identified. When a parameter is not present a warning is printed in the notes section, since user defined parameters are allowed.
-
eval_user_defined
()[source]¶ Evaluate a user defined parameter, so that it can be managed properly. This function is executed whenever a user defined parameter is set. It decomposes the entry into <paramname>:<paramval> and returns both. If the format is wrong, nothing happens and a message is printed in the notes section.
-
get_param_value
()[source]¶ Get the value of the current parameter (if given) in order to display it in the corresponding TextEdit (ParamValue). If a user defined parameter is selected, the function looks for undefined parameters and displays <name>:<value> instead of <value>.
-
find_inactive_nodes
(rawdata)[source]¶ This function takes raw YAML data (i.e. text not loaded with YAML function) and looks for commented nodes. The index of all of these nodes is returned, so that these nodes later get the value False for node_is_active.
-
deactivate_nodes
()[source]¶ Function that (i) uses yaml.dump to format dict according to YAML specifications and (ii) deactivates nodes by adding the comment symbol “#”. Here, a deepcopy is used, because the specs dict is changed (i.e. the entry node_is_active is deleted). The function checks and dumps one node after the other: Due to a difference in formatting (by YAML) when dumping one in contrast to more than one node, additional spaces are also added here. Return value is the complete specification text in YAML format.
-
import_comment
(filename)[source]¶ this function loads the given filename and stores all lines starting with ‘#’ in the comment variable. These lines have to be at the beginning of the file and must not start with a node specification (in YAML format).
-
resetNoteConnections
()[source]¶ Each time something happens in the GUI, the notes are deleted. The current function establishes these connections
-
selectFile
()[source]¶ Opens the SelectFile Dialog and inserts filename in FileEdit field. If no file is selected, the filename is set to untitled.yaml
-
loadYAMLFile
()[source]¶ load YAML file specified by user: a dialog opens asking the user to specify a file then the file is decomposed into comment header, active and inactive nodes the results are written into the comment and the specs variable
-
saveYAMLFile
()[source]¶ saves specs to specified file: if there is a comment, it is written in the header all inactive nodes are marked correspondingly
-
getPriority
()[source]¶ determine the priority of the selected node. if the node is specified multiple times, the priority of the first node found is taken respective notes are displayed
-
insertNode
()[source]¶ inserts a node in specifications according to where the user specified it function is executed when user presses <insert> button when priority is not specified (or wrong), the node is appended at the end
-
delNode
()[source]¶ delete node from current specifications. delete is ignored if priority is not specified correct
-
setParam
()[source]¶ insert parameter into current specifications
this is only happening, if user specifies node and priority correctly if parameter is existing, the value is only changed, if not, a new entry is established in specs the user defined parameter case is also considered, given it is entered in the expected way: ‘param:value’
-
defaultParam
()[source]¶ the default value is not set here. instead, the parameter is deleted from the specifications, so that the default values are used. .. note:: this shortcoming should be improved in future versions
-
__weakref__
¶ list of weak references to the object (if defined)
-