pyworkflow.gui.form module

This modules implements the automatic creation of protocol form GUI from its params definition.

class pyworkflow.gui.form.Binding(paramName, var, protocol, *callbacks)[source]
class pyworkflow.gui.form.BoolVar(value=None)[source]

Wrapper around tk.IntVar

get()[source]
set(value)[source]
class pyworkflow.gui.form.ComboVar(enum)[source]

Create a variable that display strings (for combobox) but the values are integers (for the underlying EnumParam).

get()[source]
set(value)[source]
class pyworkflow.gui.form.FormWindow(title, protocol, callback, master=None, hostList=['localhost'], **kwargs)[source]

Bases: pyworkflow.gui.gui.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 contains 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.
adjustSize()[source]
execute(e=None)[source]
getVarValue(varName)[source]

This method should retrieve a value from

getWidgetValue(protVar, param)[source]
resize(frame)[source]
save(e=None)[source]
schedule()[source]
setParamFromVar(paramName)[source]
setVar(paramName, value)[source]
setVarFromParam(paramName)[source]
updateLabelAndCommentVars()[source]

Read the label and comment first line to update the entry boxes in the form.

updateProtocolLabel()[source]
updateProtocolParams()[source]

This method is only used from WEB, since in Tk all params are updated when they are changed.

class pyworkflow.gui.form.GroupWidget(row, paramName, param, window, parent)[source]

Bases: pyworkflow.gui.form.ParamWidget

hide()[source]
show()[source]
class pyworkflow.gui.form.LineWidget(row, paramName, param, window, parent, value, callback=None, visualizeCallback=None, column=0, showButtons=True)[source]

Bases: pyworkflow.gui.form.ParamWidget

show()[source]
class pyworkflow.gui.form.MultiPointerTreeProvider(mapper)[source]

Bases: pyworkflow.gui.tree.TreeProvider

Store several pointers to objects to be used in a BoundTree and as storage from MultiPointerVar.

addObject(obj)[source]
getColumns()[source]
getObjectInfo(obj)[source]
getObjects()[source]
removeObject(obj)[source]
class pyworkflow.gui.form.MultiPointerVar(provider, tree)[source]

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.

get()[source]
getSelectedObjects()[source]
remove()[source]

Remove first element selected.

set(value)[source]
class pyworkflow.gui.form.ParamWidget(row, paramName, param, window, parent, value, callback=None, visualizeCallback=None, column=0, showButtons=True)[source]

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
static createBoolWidget(parent, **args)[source]

Return a BoolVar associated with a yes/no selection. **args: extra arguments passed to tk.Radiobutton and tk.Frame

constructors.
display(condition)[source]

show or hide depending on the condition.

get()[source]
hide()[source]
set(value)[source]
show()[source]

Grid the label and content in the specified row

class pyworkflow.gui.form.PointerVar(protocol)[source]

Wrapper around tk.StringVar to hold object pointers.

get()[source]
getPointer()[source]
remove()[source]
set(value)[source]
class pyworkflow.gui.form.ProtocolClassTreeProvider(protocolClassName)[source]

Bases: pyworkflow.gui.tree.TreeProvider

Will implement the methods to provide the object info of subclasses objects(of className) found by mapper

getColumns()[source]
getObjectInfo(obj)[source]
getObjects()[source]
class pyworkflow.gui.form.QueueDialog(window, queueDict)[source]

Bases: pyworkflow.gui.dialog.Dialog

Dialog to entry the queue parameters.

apply()[source]
body(bodyFrame)[source]
validate()[source]
class pyworkflow.gui.form.RelationsTreeProvider(protocol, relationParam, selected=None)[source]

Bases: pyworkflow.gui.form.SubclassesTreeProvider

Will implement the methods to provide the object info of subclasses objects(of className) found by mapper

getObjects()[source]
class pyworkflow.gui.form.ScalarTreeProvider(protocol, scalarParam, selected=None)[source]

Bases: pyworkflow.gui.tree.TreeProvider

Will implement the methods to provide the object info of scalar outputs

CREATION_COLUMN = 'Creation'
INFO_COLUMN = 'Info'
getColumns()[source]
getObjectInfo(pobj)[source]
getObjects()[source]
isSelected(obj)[source]

Check if an object is selected or not.

objectKey(pobj)[source]
class pyworkflow.gui.form.ScalarWithPointerVar(protocol, changeListener)[source]

Bases: Tkinter.StringVar

tk.StringVar to hold object pointers and scalars.

get()[source]
getPointer()[source]
hasPointer()[source]
set(value)[source]
trace(mode, callback)[source]
class pyworkflow.gui.form.SectionFrame(master, label, callback=None, height=15, **args)[source]

Bases: Tkinter.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

adjustContent()[source]
class pyworkflow.gui.form.SectionWidget(form, master, section, height, callback=None, **args)[source]

Bases: pyworkflow.gui.form.SectionFrame

This class will be used to create a section in FormWindow

get()[source]

Return boolean value if is selected

hide()[source]
set(value)[source]
show()[source]
class pyworkflow.gui.form.SubclassesTreeProvider(protocol, pointerParam, selected=None)[source]

Bases: pyworkflow.gui.tree.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]
getObjectActions(pobj)[source]
getObjectInfo(pobj)[source]
getObjects()[source]
isSelected(obj)[source]

Check if an object is selected or not.

objectKey(pobj)[source]
class pyworkflow.gui.form.TextVar(text, value='')[source]

Wrapper around tk.StringVar to bind the value of a Text widget.

get()[source]
set(value)[source]
class pyworkflow.gui.form.VerticalScrolledFrame(parent, *args, **kw)[source]

Bases: Tkinter.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

pyworkflow.gui.form.editObject(self, title, root, obj, mapper)[source]

Show a Text area to edit the protocol label and comment.

pyworkflow.gui.form.getObjectLabel(pobj, mapper)[source]

We will try to show in the list the string representation that is more readable for the user to pick the desired object.

pyworkflow.gui.form.getPointerLabelAndInfo(pobj, mapper)[source]

Return a string to represent selected objects that are stored by pointers. This function will be used from PointerVar and MultiPointerVar.