widgets.custom_menus

Classes for custom context menus and pop-up menus.

author:
  1. Savolainen (VTT)
date:

9.1.2018

Module Contents

widgets.custom_menus.handle_plotting_failure(error)[source]

Reports a PlottingError exception to the user.

class widgets.custom_menus.CustomContextMenu(parent)[source]

Bases: PySide2.QtWidgets.QMenu

Context menu master class for several context menus.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
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 widgets.custom_menus.ProjectItemContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu for project items both in the QTreeView and in the QGraphicsView.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.LinkContextMenu(parent, position, index, parallel_link=None)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for connection links.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex

Link that is parallel to the one that requested the menu

Type:Link(QGraphicsPathItem)
class widgets.custom_menus.ToolTemplateContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for Tool templates.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.DcRefContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for references view in Data Connection properties.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.DcDataContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for data view in Data Connection properties.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.ToolPropertiesContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

Common context menu class for all Tool QTreeViews in Tool properties.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.ViewPropertiesContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for the references tree view of the View project item properties.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.DiFilesContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for source files view in Data Interface properties.

parent

Parent for menu widget (ToolboxUI)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.ObjectTreeContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

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

parent

Parent for menu widget (TreeViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.RelationshipTreeContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

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

parent

Parent for menu widget (TreeViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.ParameterContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

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

parent

Parent for menu widget (TreeViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.SimpleEditableParameterValueContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

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

parent

Parent for menu widget (TreeViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.EditableParameterValueContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

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

parent

Parent for menu widget (TreeViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.ParameterValueListContextMenu(parent, position, index)[source]

Bases: widgets.custom_menus.CustomContextMenu

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

parent

Parent for menu widget (TreeViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
index

Index of item that requested the context-menu

Type:QModelIndex
class widgets.custom_menus.GraphViewContextMenu(parent, position)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for qgraphics view in graph view.

parent

Parent for menu widget (GraphViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
class widgets.custom_menus.ObjectItemContextMenu(parent, position, graphics_item)[source]

Bases: widgets.custom_menus.CustomContextMenu

Context menu class for object graphic items in graph view.

parent

Parent for menu widget (GraphViewForm)

Type:QWidget
position

Position on screen

Type:QPoint
graphics_item

item that requested the menu

Type:ObjectItem (QGraphicsItem)
class widgets.custom_menus.CustomPopupMenu(parent)[source]

Bases: PySide2.QtWidgets.QMenu

Popup menu master class for several popup menus.

parent

Parent widget of this pop-up menu

Type:QWidget
add_action(self, text, slot, enabled=True)[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?
class widgets.custom_menus.AddToolTemplatePopupMenu(parent)[source]

Bases: widgets.custom_menus.CustomPopupMenu

Popup menu class for add Tool template button.

parent

parent widget (ToolboxUI)

Type:QWidget
class widgets.custom_menus.ToolTemplateOptionsPopupMenu(parent, tool)[source]

Bases: widgets.custom_menus.CustomPopupMenu

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

parent

Parent widget of this menu (ToolboxUI)

Type:QWidget
tool

Tool item that is associated with the pressed button

Type:Tool
class widgets.custom_menus.AddIncludesPopupMenu(parent)[source]

Bases: widgets.custom_menus.CustomPopupMenu

Popup menu class for add includes button in Tool Template widget.

parent

Parent widget (ToolTemplateWidget)

Type:QWidget
class widgets.custom_menus.CreateMainProgramPopupMenu(parent)[source]

Bases: widgets.custom_menus.CustomPopupMenu

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

parent

Parent widget (ToolTemplateWidget)

Type:QWidget
class widgets.custom_menus.FilterMenu(parent=None, show_empty=True)[source]

Bases: PySide2.QtWidgets.QMenu

Filter menu to use together with FilterWidget in TabularViewForm.

filterChanged[source]
add_items_to_filter_list(self, items)[source]
remove_items_from_filter_list(self, items)[source]
set_filter_list(self, data)[source]
_clear_filter(self)[source]
_check_filter(self)[source]
_cancel_filter(self)[source]
_change_filter(self)[source]
class widgets.custom_menus.PivotTableModelMenu(model, proxy_model, parent=None)[source]

Bases: PySide2.QtWidgets.QMenu

_find_selected_indexes(self, indexes)[source]

Find any selected index values

_find_selected_relationships(self, indexes)[source]

Find any selected tuple combinations in self.relationship_tuple_key

_get_selected_indexes(self)[source]

Find selected indexes of parent, map to source if proxy is given

delete_invalid_row(self)[source]
delete_invalid_col(self)[source]
insert_row(self)[source]
insert_col(self)[source]
delete_values(self)[source]

deletes selected indexes in pivot_table

restore_values(self)[source]

restores edited selected indexes in pivot_table

delete_index_values(self)[source]

finds selected index items and deletes

delete_relationship_values(self)[source]

finds selected relationships deletes

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.

class widgets.custom_menus.PivotTableHorizontalHeaderMenu(model, parent=None)[source]

Bases: PySide2.QtWidgets.QMenu

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

model

a model

Type:PivotTableModel
parent

a parent widget

Type:QWidget
_plot_column(self)[source]

Plots a single column not the selection.

request_menu(self, pos)[source]

Shows the context menu on the screen.

_set_x_flag(self)[source]

Sets the X flag for a column.