pyworkflow.gui.tree module
- class pyworkflow.gui.tree.AttributesTreeProvider(item)[source]
Bases:
ListTreeProviderString
- 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.tree.BoundTree(master, provider, frame=True, **opts)[source]
Bases:
Tree
This class is base on Tree but fetch the items from a TreeProvider, which provides columns values for each item and items info to insert into the Tree
Create a new Tree, if frame=True, a container frame will be created and a scrollbar will be added
- class pyworkflow.gui.tree.DbTreeProvider(dbName, classesDict)[source]
Bases:
ObjectTreeProvider
Retrieve the elements from the database
- class pyworkflow.gui.tree.ListTreeProvider(objList=None)[source]
Bases:
TreeProvider
Simple list tree provider.
- 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.tree.ListTreeProviderString(objList=None)[source]
Bases:
ListTreeProvider
- class pyworkflow.gui.tree.ListTreeProviderTemplate(objList=None)[source]
Bases:
ListTreeProviderString
- 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.tree.ObjectTreeProvider(objList=None)[source]
Bases:
TreeProvider
Populate Tree from Objects.
- getObjectActions(obj)[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(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.tree.ProjectRunsTreeProvider(project, **kwargs)[source]
Bases:
TreeProvider
Provide run list from a project to populate a tree.
- ID_COLUMN = 'Id'
- RUN_COLUMN = 'Run'
- STATE_COLUMN = 'State'
- TIME_COLUMN = 'Time'
- 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.tree.Tree(master, frame=True, **opts)[source]
Bases:
Treeview
,Scrollable
This widget acts as a wrapper around the ttk.Treeview
Create a new Tree, if frame=True, a container frame will be created and an scrollbar will be added
- search(initial, fromSelected=True)[source]
Search the first item starting with “start” Implemented for Flat tree like FileBrowser…TODO: consider a proper tree with branches and leaves..
- Parameters
initial (String - text to look for in the items. Usually the first initial letter)
fromSelected (Boolean, start looking from the selected item)
- sortByColumn(col, reverse, casting=<class 'str'>)[source]
Function to sort a treeview :param self: treview :param col: column to apply the sorting on :param reverse: sorting direction :param casting: optional - casting operation to apply on the column value: str is default. int, float are other options :return:
- class pyworkflow.gui.tree.TreeProvider(sortingColumnName=None, sortingAscending=True)[source]
Bases:
object
Class class will serve to separate the logic of feed data from the graphical Tree build. Subclasses should implement the abstract methods
- configureTags(tree)[source]
Configure the available tags in the tree that will be setup later for each item in the tree. :returns: * Nothing
Adds tags to the tree for customizing
- getColumns()[source]
Return a list of tuples (c, w) where: c: is the column name and index w: is the column width
- getObjectActions(obj)[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(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)
- getObjectPreview(obj)[source]
Should return a tuple (img, desc), where img is the preview image and desc the description string.