spinetoolbox.widgets.custom_menus

Classes for custom context menus and pop-up menus.

author:
  1. Savolainen (VTT)
date:

9.1.2018

Module Contents

class spinetoolbox.widgets.custom_menus.CustomContextMenu(parent, position)[source]

Bases: PySide2.QtWidgets.QMenu

Context menu master class for several context menus.

Parameters:
  • parent (QWidget) – Parent for menu widget (ToolboxUI)
  • position (QPoint) – Position on screen
add_action(self, text, icon=QIcon(), enabled=True)[source]

Adds an action to the context menu.

Parameters:
  • text (str) – Text description of the action
  • icon (QIcon) – Icon for menu item
  • enabled (bool) – Is action enabled?
set_action(self, option)[source]

Sets the action which was clicked.

Parameters:option (str) – string with the text description of the action
get_action(self)[source]

Returns the clicked action, a string with a description.

class spinetoolbox.widgets.custom_menus.CategoryProjectItemContextMenu(parent, position)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu for category project items in the QTreeView.

Parameters:
  • parent (QWidget) – Parent for menu widget (ToolboxUI)
  • position (QPoint) – Position on screen
class spinetoolbox.widgets.custom_menus.ProjectItemModelContextMenu(parent, position)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu for project item model in the QTreeView.

Parameters:
  • parent (QWidget) – Parent for menu widget (ToolboxUI)
  • position (QPoint) – Position on screen
class spinetoolbox.widgets.custom_menus.ProjectItemContextMenu(parent, position)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu for project items in the Project tree widget and in the Design View.

Parameters:
  • parent (QWidget) – Parent for menu widget (ToolboxUI)
  • position (QPoint) – Position on screen
class spinetoolbox.widgets.custom_menus.LinkContextMenu(parent, position, link)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for connection links.

Parameters:
  • parent (QWidget) – Parent for menu widget (ToolboxUI)
  • position (QPoint) – Position on screen
  • link (Link(QGraphicsPathItem)) – Link that requested the menu
class spinetoolbox.widgets.custom_menus.ToolSpecificationContextMenu(parent, position, index)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for Tool specifications.

Parameters:
  • parent (QWidget) – Parent for menu widget (ToolboxUI)
  • position (QPoint) – Position on screen
  • index (QModelIndex) – Index of item that requested the context-menu
class spinetoolbox.widgets.custom_menus.EntityTreeContextMenu(parent, position, index)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for object tree items in tree view form.

Parameters:
  • parent (QWidget) – Parent for menu widget
  • position (QPoint) – Position on screen
  • index (QModelIndex) – Index of item that requested the context-menu
class spinetoolbox.widgets.custom_menus.ObjectTreeContextMenu(parent, position, index)[source]

Bases: spinetoolbox.widgets.custom_menus.EntityTreeContextMenu

Context menu class for object tree items in tree view form.

Parameters:
  • parent (QWidget) – Parent for menu widget
  • position (QPoint) – Position on screen
  • index (QModelIndex) – Index of item that requested the context-menu
class spinetoolbox.widgets.custom_menus.RelationshipTreeContextMenu[source]

Bases: spinetoolbox.widgets.custom_menus.EntityTreeContextMenu

Context menu class for relationship tree items in tree view form.

class spinetoolbox.widgets.custom_menus.ParameterContextMenu(parent, position, index)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for object (relationship) parameter items in tree views.

Parameters:
  • parent (QWidget) – Parent for menu widget
  • position (QPoint) – Position on screen
  • index (QModelIndex) – Index of item that requested the context-menu
class spinetoolbox.widgets.custom_menus.EditableParameterValueContextMenu(parent, position, index)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for object (relationship) parameter value items in tree views.

Parameters:
  • parent (QWidget) – Parent for menu widget
  • position (QPoint) – Position on screen
  • index (QModelIndex) – Index of item that requested the context-menu
_plot_in_window(self, action)[source]

Sets the option attributes ready for plotting in an existing window.

class spinetoolbox.widgets.custom_menus.ParameterValueListContextMenu(parent, position, index)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for parameter enum view in tree view form.

Parameters:
  • parent (QWidget) – Parent for menu widget
  • position (QPoint) – Position on screen
  • index (QModelIndex) – Index of item that requested the context-menu
class spinetoolbox.widgets.custom_menus.GraphViewContextMenu(parent, position)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for qgraphics view in graph view.

Parameters:
  • parent (QWidget) – Parent for menu widget (GraphViewForm)
  • position (QPoint) – Position on screen
class spinetoolbox.widgets.custom_menus.EntityItemContextMenu(parent, position)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Context menu class for entity graphic items in graph view.

Parameters:
  • parent (QWidget) – Parent for menu widget (GraphViewForm)
  • position (QPoint) – Position on screen
class spinetoolbox.widgets.custom_menus.ObjectItemContextMenu(parent, position, graphics_item)[source]

Bases: spinetoolbox.widgets.custom_menus.EntityItemContextMenu

Parameters:
class spinetoolbox.widgets.custom_menus.RelationshipItemContextMenu(parent, position)[source]

Bases: spinetoolbox.widgets.custom_menus.EntityItemContextMenu

Parameters:
  • parent (QWidget) – Parent for menu widget (GraphViewForm)
  • position (QPoint) – Position on screen
class spinetoolbox.widgets.custom_menus.OpenProjectDialogComboBoxContextMenu(parent, position)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Parameters:
  • parent (QWidget) – Parent for menu widget
  • position (QPoint) – Position on screen
class spinetoolbox.widgets.custom_menus.CustomPopupMenu(parent)[source]

Bases: PySide2.QtWidgets.QMenu

Popup menu master class for several popup menus.

Parameters:parent (QWidget) – Parent widget of this pop-up menu
add_action(self, text, slot, enabled=True, tooltip=None)[source]

Adds an action to the popup menu.

Parameters:
  • text (str) – Text description of the action
  • slot (method) – Method to connect to action’s triggered signal
  • enabled (bool) – Is action enabled?
  • tooltip (str) – Tool tip for the action
class spinetoolbox.widgets.custom_menus.AddToolSpecificationPopupMenu(parent)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomPopupMenu

Popup menu class for add Tool specification button.

Parameters:parent (QWidget) – parent widget (ToolboxUI)
class spinetoolbox.widgets.custom_menus.ToolSpecificationOptionsPopupmenu(parent, tool)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomPopupMenu

Popup menu class for tool specification options button in Tool item.

Parameters:
  • parent (QWidget) – Parent widget of this menu (ToolboxUI)
  • tool (Tool) – Tool item that is associated with the pressed button
class spinetoolbox.widgets.custom_menus.AddIncludesPopupMenu(parent)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomPopupMenu

Popup menu class for add includes button in Tool specification editor widget.

Parameters:parent (QWidget) – Parent widget (ToolSpecificationWidget)
class spinetoolbox.widgets.custom_menus.CreateMainProgramPopupMenu(parent)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomPopupMenu

Popup menu class for add main program QToolButton in Tool specification editor widget.

Parameters:parent (QWidget) – Parent widget (ToolSpecificationWidget)
class spinetoolbox.widgets.custom_menus.RecentProjectsPopupMenu(parent)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomPopupMenu

Recent projects menu embedded to ‘File-Open recent’ QAction.

Parameters:parent (QWidget) – Parent widget of this menu (ToolboxUI)
add_recent_projects(self)[source]

Reads the previous project names and paths from QSettings. Adds them to the QMenu as QActions.

call_open_project(self, checked, p)[source]

Slot for catching the user selected action from the recent projects menu.

Parameters:
  • checked (bool) – Argument sent by triggered signal
  • p (str) – Full path to a project file
class spinetoolbox.widgets.custom_menus.FilterMenuBase(parent)[source]

Bases: PySide2.QtWidgets.QMenu

Filter menu.

Parameters:parent (QWidget) – a parent widget
connect_signals(self)[source]
set_filter_list(self, data)[source]
add_items_to_filter_list(self, items)[source]
remove_items_from_filter_list(self, items)[source]
_clear_filter(self)[source]
_check_filter(self)[source]
_change_filter(self)[source]
emit_filter_changed(self, valid_values)[source]
wipe_out(self)[source]
class spinetoolbox.widgets.custom_menus.SimpleFilterMenu(parent, show_empty=True)[source]

Bases: spinetoolbox.widgets.custom_menus.FilterMenuBase

Parameters:parent (DataStoreForm) –
filterChanged[source]
emit_filter_changed(self, valid_values)[source]
class spinetoolbox.widgets.custom_menus.ParameterViewFilterMenu(parent, source_model, show_empty=True)[source]

Bases: spinetoolbox.widgets.custom_menus.FilterMenuBase

Parameters:
filterChanged[source]
emit_filter_changed(self, valid_values)[source]
class spinetoolbox.widgets.custom_menus.TabularViewFilterMenu(parent, identifier, data_to_value, show_empty=True)[source]

Bases: spinetoolbox.widgets.custom_menus.FilterMenuBase

Filter menu to use together with FilterWidget in TabularViewMixin.

Parameters:
  • parent (DataStoreForm) –
  • identifier (int) – index identifier
  • data_to_value (method) – a method to translate item data to a value for display role
filterChanged[source]
emit_filter_changed(self, valid_values)[source]
event(self, event)[source]
class spinetoolbox.widgets.custom_menus.PivotTableModelMenu(parent)[source]

Bases: PySide2.QtWidgets.QMenu

Parameters:parent (TabularViewMixin) – a parent widget
_DELETE_OBJECT = Remove selected objects[source]
_DELETE_RELATIONSHIP = Remove selected relationships[source]
_DELETE_PARAMETER = Remove selected parameter definitions[source]
delete_values(self)[source]
delete_objects(self)[source]
delete_relationships(self)[source]
delete_parameters(self)[source]
open_value_editor(self)[source]

Opens the parameter value editor for the first selected cell.

plot(self)[source]

Plots the selected cells in the pivot table.

request_menu(self, QPos=None)[source]

Shows the context menu on the screen.

_find_selected_indexes(self)[source]
_update_actions_enable(self)[source]
_update_actions_text(self)[source]
_plot_in_window(self, action)[source]
class spinetoolbox.widgets.custom_menus.PivotTableHorizontalHeaderMenu(proxy_model, parent=None)[source]

Bases: PySide2.QtWidgets.QMenu

A context menu for the horizontal header of a pivot table.

Parameters:
request_menu(self, pos)[source]

Shows the context menu on the screen.

_add_column_to_plot(self, action)[source]

Adds a single column to existing plot window.

_plot_column(self)[source]

Plots a single column not the selection.

_set_x_flag(self)[source]

Sets the X flag for a column.

spinetoolbox.widgets.custom_menus._prepare_plot_in_window_menu(menu)[source]

Fills a given menu with available plot window names.