spinetoolbox.project_item.project_item_factory
¶
Contains base classes for project items and item factories.
- authors
Savolainen (VTT)
- date
4.10.2018
Module Contents¶
Classes¶
Class for project item factories. |
- class spinetoolbox.project_item.project_item_factory.ProjectItemFactory[source]¶
Class for project item factories.
- abstract static item_class()[source]¶
Returns the project item’s class.
- Returns
item’s class
- Return type
type
- abstract static icon_color()[source]¶
Returns the icon color.
- Returns
icon’s color
- Return type
QColor
- abstract static make_add_item_widget(toolbox, x, y, specification)[source]¶
Returns an appropriate Add project item widget.
- Parameters
toolbox (ToolboxUI) – the main window
x (int) – Icon coordinates
y (int) – Icon coordinates
specification (ProjectItemSpecification) – item’s specification
- Returns
QWidget
- abstract static make_icon(toolbox)[source]¶
Returns a ProjectItemIcon to use with given toolbox, for given project item.
- Parameters
toolbox (ToolboxUI) –
- Returns
item’s icon
- Return type
- abstract static make_item(name, item_dict, toolbox, project)[source]¶
Returns a project item constructed from the given
item_dict
.- Parameters
name (str) – item’s name
item_dict (dict) – serialized project item
toolbox (ToolboxUI) – Toolbox main window
project (SpineToolboxProject) – the project the item belongs to
- Returns
ProjectItem
- abstract static make_properties_widget(toolbox)[source]¶
Creates the item’s properties tab widget.
- Returns
item’s properties tab widget
- Return type
QWidget
Creates item specification’s context menu.
Subclasses that do not support specifications can still raise
NotImplementedError
.- Parameters
parent (QWidget) – menu’s parent widget
index (QModelIndex) – an index from specification model
- Returns
specification’s context menu
- Return type
- abstract static make_specification_editor(toolbox, specification=None, item=None, **kwargs)[source]¶
Creates the item’s specification widget.
Subclasses that do not support specifications can still raise
NotImplementedError
.- Parameters
toolbox (ToolboxUI) – Toolbox main window
specification (ProjectItemSpecification, optional) – a specification to show in the widget or None for a fresh start
item (ProjectItem, optional) – a project item. If the specification is accepted, it is also set for this item
**kwargs – parameters passed to the specification widget
- Returns
item’s specification widget
- Return type
QWidget
- static repair_specification(toolbox, specification)[source]¶
Called right after a spec is added to the project. Finds if there’s something wrong with the spec and proposes actions to fix it with help from toolbox.
- Parameters
toolbox (ToolboxUI) – Toolbox main window
specification (ProjectItemSpecification) – a specification to check