spinetoolbox.widgets.custom_qgraphicsviews¶
Classes for custom QGraphicsViews for the Design and Graph views.
| authors: |
|
|---|---|
| date: | 6.2.2018 |
Module Contents¶
Classes¶
CustomQGraphicsView |
Super class for Design and Entity QGraphicsViews. |
DesignQGraphicsView |
QGraphicsView for the Design View. |
-
class
spinetoolbox.widgets.custom_qgraphicsviews.CustomQGraphicsView(parent)[source]¶ Bases:
PySide2.QtWidgets.QGraphicsViewSuper class for Design and Entity QGraphicsViews.
-
parent¶ Parent widget
Type: QWidget
Init CustomQGraphicsView.
-
keyPressEvent(self, event)[source]¶ Overridden method. Enable zooming with plus and minus keys (comma resets zoom). Send event downstream to QGraphicsItems if pressed key is not handled here.
Parameters: event (QKeyEvent) – Pressed key
-
mousePressEvent(self, event)[source]¶ Set rubber band selection mode if Control pressed. Enable resetting the zoom factor from the middle mouse button.
-
resizeEvent(self, event)[source]¶ Updates zoom if needed when the view is resized.
Parameters: event (QResizeEvent) – a resize event
-
setScene(self, scene)[source]¶ Sets a new scene to this view.
Parameters: scene (ShrinkingScene) – a new scene
-
_update_zoom_limits(self)[source]¶ Updates the minimum zoom limit and the zoom level with which the view fits all the items in the scene.
-
_handle_zoom_time_line_advanced(self, pos)[source]¶ Performs zoom whenever the smooth zoom time line advances.
-
_handle_transformation_time_line_finished(self)[source]¶ Cleans up after the smooth transformation time line finishes.
-
gentle_zoom(self, factor, zoom_focus=None)[source]¶ Perform a zoom by a given factor.
Parameters: - factor (float) – a scaling factor relative to the current scene scaling
- zoom_focus (QPoint) – focus of the zoom, e.g. mouse pointer position
-
-
class
spinetoolbox.widgets.custom_qgraphicsviews.DesignQGraphicsView(parent)[source]¶ Bases:
spinetoolbox.widgets.custom_qgraphicsviews.CustomQGraphicsViewQGraphicsView for the Design View.
Parameters: parent (QWidget) – Graph View Form’s (QMainWindow) central widget (self.centralwidget) -
add_link(self, src_connector, dst_connector)[source]¶ Pushes an AddLinkCommand to the toolbox undo stack.
-
make_link(self, src_connector, dst_connector)[source]¶ Returns a Link between given connectors.
Parameters: - src_connector (ConnectorButton) – Source connector button
- dst_connector (ConnectorButton) – Destination connector button
Returns: Link
-
do_add_link(self, src_connector, dst_connector)[source]¶ Makes a Link between given source and destination connectors and adds it to the project.
Parameters: - src_connector (ConnectorButton) – Source connector button
- dst_connector (ConnectorButton) – Destination connector button
-
_add_link(self, link)[source]¶ Adds given Link to the project.
Parameters: link (Link) – the link to add
-
static
_remove_redundant_link(link)[source]¶ Checks if there’s a link with the same source and destination as the given one, wipes it out and returns it.
Parameters: link (Link) – a new link being added to the project. - Returns
- Link, NoneType
-
take_link(self, link)[source]¶ Remove link, then start drawing another one from the same source connector.
-
restore_links(self, connections)[source]¶ Creates Links from the given connections list.
- List of dicts is accepted, e.g.
Parameters: connections (list) – List of connections.
-
notify_destination_items(self, src_connector, dst_connector)[source]¶ Notify destination items that they have been connected to a source item.
-
_start_animation(self, item_name, direction)[source]¶ Starts item icon animation when executing forward.
-
_stop_animation(self, item_name, direction, _)[source]¶ Stops item icon animation when executing forward.
-