spinetoolbox.project_tree_item
¶
Project Tree items.
authors: |
|
---|---|
date: | 17.1.2020 |
Module Contents¶
-
class
spinetoolbox.project_tree_item.
BaseProjectTreeItem
(name, description)[source]¶ Bases:
spinetoolbox.metaobject.MetaObject
Base class for all project tree items.
Parameters: - name (str) – Object name
- description (str) – Object description
-
child
(self, row)[source]¶ Returns child BaseProjectTreeItem on given row.
Parameters: row (int) – Row of child to return Returns: item on given row or None if it does not exist Return type: BaseProjectTreeItem
-
remove_child
(self, row)[source]¶ Remove the child of this BaseProjectTreeItem from given row. Do not call this method directly. This method is called by LeafProjectItemTreeModel when items are removed.
Parameters: row (int) – Row of child to remove Returns: True if operation succeeded, False otherwise Return type: bool
Returns the context menu for this item. Implement in subclasses as needed. :param parent: The widget that is controlling the menu :type parent: QWidget :param pos: Position on screen :type pos: QPoint
Applies given action from context menu. Implement in subclasses as needed.
Parameters: - parent (QWidget) – The widget that is controlling the menu
- action (str) – The selected action
-
class
spinetoolbox.project_tree_item.
RootProjectTreeItem
[source]¶ Bases:
spinetoolbox.project_tree_item.BaseProjectTreeItem
Class for the root project tree item.
-
add_child
(self, child_item)[source]¶ Adds given category item as the child of this root project tree item. New item is added as the last item.
Parameters: child_item (CategoryProjectTreeItem) – Item to add Returns: True for success, False otherwise
See base class.
See base class.
-
-
class
spinetoolbox.project_tree_item.
CategoryProjectTreeItem
(name, description, item_maker, icon_maker, add_form_maker, properties_ui)[source]¶ Bases:
spinetoolbox.project_tree_item.BaseProjectTreeItem
Class for category project tree items.
Parameters: - name (str) – Category name
- description (str) – Category description
- item_maker (function) – A function for creating project items in this category
- icon_maker (function) – A function for creating icons (QGraphicsItems) for project items in this category
- add_form_maker (function) – A function for creating the form to add project items to this category
- properties_ui (object) – An object holding the Item Properties UI
-
add_child
(self, child_item)[source]¶ Adds given project tree item as the child of this category item. New item is added as the last item.
Parameters: - child_item (LeafProjectTreeTreeItem) – Item to add
- toolbox (ToolboxUI) – A toolbox instance
Returns: True for success, False otherwise
Returns the context menu for this item.
Parameters: - parent (QWidget) – The widget that is controlling the menu
- pos (QPoint) – Position on screen
Applies given action from context menu.
Parameters: - parent (QWidget) – The widget that is controlling the menu
- action (str) – The selected action
-
class
spinetoolbox.project_tree_item.
LeafProjectTreeItem
(project_item, toolbox)[source]¶ Bases:
spinetoolbox.project_tree_item.BaseProjectTreeItem
Class for leaf items in the project item tree.
Parameters: - project_item (ProjectItem) – the real project item this item represents
- toolbox (ToobloxUI) – a toolbox instance
Returns the context menu for this item.
Parameters: - parent (QWidget) – The widget that is controlling the menu
- pos (QPoint) – Position on screen
Applies given action from context menu.
Parameters: - parent (QWidget) – The widget that is controlling the menu
- action (str) – The selected action