Skip to content

NodeGraph.center_on and NodeViewer.center_selection issues. #279

@Gaspounet

Description

@Gaspounet

Hello!

I just started using your NodeGraphQt (and so far, it's really cool and I think I'll try to build a project from it!)
Just found a few bugs with the NodeGraph.center_on and NodeViewer.center_selection method:

NodeGraph.center_on fails when nodes=None, as it's trying to iterate through None
Traceback (most recent call last): File "C:\Users\gaspa\PycharmProjects\nopipe\main.py", line 33, in <module> graph.center_on() File "C:\Users\gaspa\PycharmProjects\nopipe\venv\lib\site-packages\NodeGraphQt\base\graph.py", line 1020, in center_on self._viewer.center_selection([n.view for n in nodes]) TypeError: 'NoneType' object is not iterable

NodeViewer.center_selection fails when passing a single node as it's passing a node as argument to QGraphicsView.centerOn while it's expecting a point or 2 floats:
Traceback (most recent call last): File "C:\Users\gaspa\PycharmProjects\nopipe\main.py", line 33, in <module> viewer.center_selection([node_a]) File "C:\Users\gaspa\PycharmProjects\nopipe\venv\lib\site-packages\NodeGraphQt\widgets\viewer.py", line 1193, in center_selection self.centerOn(nodes[0]) TypeError: 'PySide2.QtWidgets.QGraphicsView.centerOn' called with wrong argument types: PySide2.QtWidgets.QGraphicsView.centerOn(MyNode) Supported signatures: PySide2.QtWidgets.QGraphicsView.centerOn(PySide2.QtWidgets.QGraphicsItem) PySide2.QtWidgets.QGraphicsView.centerOn(PySide2.QtCore.QPointF) PySide2.QtWidgets.QGraphicsView.centerOn(float, float)

Even with all this, once trying viewer.centerOn(node_a.x_pos(), node_a.y_pos()) , it isn't doing anything

Cheers
Gasp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions