pyworkflow.gui.form module
This modules implements the automatic creation of protocol form GUI from its params definition.
- class pyworkflow.gui.form.ComboVar(enum)[source]
Bases:
object
Create a variable that display strings (for combobox) but the values are integers (for the underlying EnumParam).
- class pyworkflow.gui.form.FormWindow(title, protocol, callback, master=None, position=None, **kwargs)[source]
Bases:
Window
This class will create the Protocol params GUI to fill in the parameters. The creation of input parameters will be based on the Protocol Form definition. This class will serve as a connection between the GUI variables (tk vars) and the Protocol variables.
- Layout:
There are 4 main blocks that goes each one in a different row1. 1. Header: will contain the logo, title and some link buttons. 2. Common: common execution parameters of each run. 3. Params: the expert level and tabs with the Protocol parameters. 4. Buttons: buttons at bottom for close, save and execute.
Constructor of the Form window. Params:
title: title string of the windows. protocol: protocol from which the form will be generated. callback: callback function to call when Save or Execute are press.
- takeScreenShot()[source]
Method to take a screenshot of itself. The idea is to, in the future, take a screenshot and collect parameter to either create a page of the protocol in rst or send it to the Scipion site and have there one page per protocol.
For now this is not used.
- class pyworkflow.gui.form.GroupWidget(row, paramName, param, window, parent)[source]
Bases:
ParamWidget
- class pyworkflow.gui.form.LineWidget(row, paramName, param, window, parent, value, callback=None, visualizeCallback=None, column=0, showButtons=True)[source]
Bases:
ParamWidget
- class pyworkflow.gui.form.MultiPointerTreeProvider(mapper)[source]
Bases:
TreeProvider
Store several pointers to objects to be used in a BoundTree and as storage from MultiPointerVar.
- getColumns()[source]
Return a list of tuples (c, w) where: c: is the column name and index w: is the column width
- getObjectInfo(obj)[source]
This function will be called by the Tree with each object that will be inserted. A dictionary should be returned with the possible following entries: ‘key’: the key value to insert in the Tree ‘text’: text of the object to be displayed
(if not passed the ‘key’ will be used)
‘image’: image path to be displayed as icon (optional) ‘parent’: the object’s parent in which insert this object (optional) ‘tags’: list of tags names (optional)
- class pyworkflow.gui.form.MultiPointerVar(provider, tree)[source]
Bases:
object
Wrapper around tk.StringVar to hold object pointers. This class is related with MultiPointerTreeProvider, which stores the list of pointed objects and have the logic to add and remove from the list.
- class pyworkflow.gui.form.ParamWidget(row, paramName, param, window, parent, value, callback=None, visualizeCallback=None, column=0, showButtons=True)[source]
Bases:
object
For each one in the Protocol parameters, there will be one of this in the Form GUI. It is mainly composed by: A Label: put in the left column A Frame(content): in the middle column and container
of the specific components for this parameter
A Frame(buttons): a container for available actions buttons It will also have a Variable that should be set when creating
the specific components
- class pyworkflow.gui.form.PointerVar(protocol)[source]
Bases:
object
Wrapper around tk.StringVar to hold object pointers.
- class pyworkflow.gui.form.ProtocolClassTreeProvider(protocolClassName)[source]
Bases:
TreeProvider
Will implement the methods to provide the object info of subclasses objects(of className) found by mapper
- getColumns()[source]
Return a list of tuples (c, w) where: c: is the column name and index w: is the column width
- getObjectInfo(obj)[source]
This function will be called by the Tree with each object that will be inserted. A dictionary should be returned with the possible following entries: ‘key’: the key value to insert in the Tree ‘text’: text of the object to be displayed
(if not passed the ‘key’ will be used)
‘image’: image path to be displayed as icon (optional) ‘parent’: the object’s parent in which insert this object (optional) ‘tags’: list of tags names (optional)
- class pyworkflow.gui.form.QueueDialog(window, queueDict)[source]
Bases:
Dialog
Dialog to entry the queue parameters.
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- apply()[source]
process the data This method is called automatically to process the data, after the dialog is destroyed. By default, it does nothing.
- class pyworkflow.gui.form.RelationsTreeProvider(protocol, relationParam, selected=None)[source]
Bases:
SubclassesTreeProvider
Will implement the methods to provide the object info of subclasses objects(of className) found by mapper
- class pyworkflow.gui.form.ScalarTreeProvider(protocol, scalarParam, selected=None)[source]
Bases:
TreeProvider
Will implement the methods to provide the object info of scalar outputs
- CREATION_COLUMN = 'Creation'
- INFO_COLUMN = 'Info'
- getColumns()[source]
Return a list of tuples (c, w) where: c: is the column name and index w: is the column width
- getObjectInfo(pobj)[source]
This function will be called by the Tree with each object that will be inserted. A dictionary should be returned with the possible following entries: ‘key’: the key value to insert in the Tree ‘text’: text of the object to be displayed
(if not passed the ‘key’ will be used)
‘image’: image path to be displayed as icon (optional) ‘parent’: the object’s parent in which insert this object (optional) ‘tags’: list of tags names (optional)
- class pyworkflow.gui.form.ScalarWithPointerVar(protocol, changeListener)[source]
Bases:
StringVar
tk.StringVar to hold object pointers and scalars.
Construct a string variable.
MASTER can be given as master widget. VALUE is an optional value (defaults to “”) NAME is an optional Tcl name (defaults to PY_VARnum).
If NAME matches an existing variable and VALUE is omitted then the existing value is retained.
- trace(mode, callback)[source]
Define a trace callback for the variable.
MODE is one of “r”, “w”, “u” for read, write, undefine. CALLBACK must be a function which is called when the variable is read, written or undefined.
Return the name of the callback.
This deprecated method wraps a deprecated Tcl method that will likely be removed in the future. Use trace_add() instead.
- class pyworkflow.gui.form.SectionFrame(master, label, callback=None, height=15, **args)[source]
Bases:
Frame
This class will be used to create a frame for the Section That will have a header with red color and a content frame with white background
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- class pyworkflow.gui.form.SectionWidget(form, master, section, height, callback=None, **args)[source]
Bases:
SectionFrame
This class will be used to create a section in FormWindow
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- class pyworkflow.gui.form.SubclassesTreeProvider(protocol, pointerParam, selected=None)[source]
Bases:
TreeProvider
Will implement the methods to provide the object info of subclasses objects(of className) found by mapper
- CREATION_COLUMN = 'Creation'
- ID_COLUMN = 'Protocol Id'
- INFO_COLUMN = 'Info'
- getColumns()[source]
Return a list of tuples (c, w) where: c: is the column name and index w: is the column width
- getObjectActions(pobj)[source]
Return a list of tuples (key, action) were keys are the string options that will be display in the context menu and the actions are the functions to call when the specific action is selected. The first action in the list will be taken as the default one when the element is double-clicked.
- getObjectInfo(pobj)[source]
This function will be called by the Tree with each object that will be inserted. A dictionary should be returned with the possible following entries: ‘key’: the key value to insert in the Tree ‘text’: text of the object to be displayed
(if not passed the ‘key’ will be used)
‘image’: image path to be displayed as icon (optional) ‘parent’: the object’s parent in which insert this object (optional) ‘tags’: list of tags names (optional)
- class pyworkflow.gui.form.TextVar(text, value='')[source]
Bases:
object
Wrapper around tk.StringVar to bind the value of a Text widget.
- Params:
text: Text widget associated with this variable. value: initial value for the widget.
- class pyworkflow.gui.form.VerticalScrolledFrame(parent, *args, **kw)[source]
Bases:
Frame
A pure Tkinter scrollable frame that actually works! * Use the ‘interior’ attribute to place widgets inside the scrollable frame * Construct and pack/place/grid normally * This frame only allows vertical scrolling
Construct a frame widget with the parent MASTER.
Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
- pyworkflow.gui.form.editObject(self, title, root, obj, mapper)[source]
Show a Text area to edit the protocol label and comment.