pyworkflow.gui.tree module¶
-
class
pyworkflow.gui.tree.
AttributesTreeProvider
(item)[source]¶ Bases:
pyworkflow.gui.tree.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:
pyworkflow.gui.tree.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
-
class
pyworkflow.gui.tree.
DbTreeProvider
(dbName, classesDict)[source]¶ Bases:
pyworkflow.gui.tree.ObjectTreeProvider
Retrieve the elements from the database
-
class
pyworkflow.gui.tree.
ListTreeProvider
(objList=None)[source]¶ Bases:
pyworkflow.gui.tree.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.
ListTreeProviderTemplate
(objList=None)[source]¶ Bases:
pyworkflow.gui.tree.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:
pyworkflow.gui.tree.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:
pyworkflow.gui.tree.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:
tkinter.ttk.Treeview
,pyworkflow.gui.widgets.Scrollable
This widget acts as a wrapper around the ttk.Treeview
-
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.
-