Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jchanvfx/NodeGraphQt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: polyxemus/NodeGraphQt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 34 files changed
  • 1 contributor

Commits on Dec 20, 2022

  1. updates for pyside6

    Jason Holmes committed Dec 20, 2022
    Copy the full SHA
    e3b28ba View commit details
Showing with 129 additions and 132 deletions.
  1. +23 −23 NodeGraphQt/base/commands.py
  2. +3 −3 NodeGraphQt/base/graph.py
  3. +2 −2 NodeGraphQt/base/menu.py
  4. +1 −1 NodeGraphQt/constants.py
  5. +5 −5 NodeGraphQt/custom_widgets/nodes_palette.py
  6. +2 −2 NodeGraphQt/custom_widgets/nodes_tree.py
  7. +2 −2 NodeGraphQt/custom_widgets/properties.py
  8. +3 −3 NodeGraphQt/custom_widgets/properties_bin.py
  9. +3 −2 NodeGraphQt/qgraphics/node_abstract.py
  10. +7 −7 NodeGraphQt/qgraphics/node_backdrop.py
  11. +9 −9 NodeGraphQt/qgraphics/node_base.py
  12. +1 −1 NodeGraphQt/qgraphics/node_group.py
  13. +2 −2 NodeGraphQt/qgraphics/node_overlay_disabled.py
  14. +1 −1 NodeGraphQt/qgraphics/node_port_in.py
  15. +1 −1 NodeGraphQt/qgraphics/node_port_out.py
  16. +1 −1 NodeGraphQt/qgraphics/node_text_item.py
  17. +4 −4 NodeGraphQt/qgraphics/pipe.py
  18. +4 −4 NodeGraphQt/qgraphics/port.py
  19. +1 −1 NodeGraphQt/qgraphics/slicer.py
  20. +2 −2 NodeGraphQt/widgets/actions.py
  21. +1 −1 NodeGraphQt/widgets/dialogs.py
  22. +1 −1 NodeGraphQt/widgets/node_graph.py
  23. +1 −1 NodeGraphQt/widgets/node_widgets.py
  24. +1 −1 NodeGraphQt/widgets/scene.py
  25. +1 −1 NodeGraphQt/widgets/tab_search.py
  26. +5 −9 NodeGraphQt/widgets/viewer.py
  27. +1 −1 NodeGraphQt/widgets/viewer_nav.py
  28. +3 −3 docs/examples/ex_node.rst
  29. +1 −1 docs/examples/ex_overview.rst
  30. +1 −1 docs/host_apps/ex_app_nuke.rst
  31. +1 −1 docs/host_apps/ex_app_silhouette.rst
  32. +4 −4 examples/basic_example.py
  33. +30 −30 examples/hotkeys/hotkeys.json
  34. +1 −1 examples/nodes/custom_ports_node.py
46 changes: 23 additions & 23 deletions NodeGraphQt/base/commands.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/python
from Qt import QtWidgets
from PySide6 import QtGui

from NodeGraphQt.constants import PortTypeEnum


class PropertyChangedCmd(QtWidgets.QUndoCommand):
class PropertyChangedCmd(QtGui.QUndoCommand):
"""
Node property changed command.
@@ -15,7 +15,7 @@ class PropertyChangedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, node, name, value):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
if name == 'name':
self.setText('renamed "{}" to "{}"'.format(node.name(), value))
else:
@@ -67,7 +67,7 @@ def redo(self):
graph.property_changed.emit(self.node, self.name, self.new_val)


class NodeMovedCmd(QtWidgets.QUndoCommand):
class NodeMovedCmd(QtGui.QUndoCommand):
"""
Node moved command.
@@ -78,7 +78,7 @@ class NodeMovedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, node, pos, prev_pos):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.node = node
self.pos = pos
self.prev_pos = prev_pos
@@ -94,7 +94,7 @@ def redo(self):
self.node.model.pos = self.pos


class NodeAddedCmd(QtWidgets.QUndoCommand):
class NodeAddedCmd(QtGui.QUndoCommand):
"""
Node added command.
@@ -105,7 +105,7 @@ class NodeAddedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, graph, node, pos=None):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.setText('added node')
self.viewer = graph.viewer()
self.model = graph.model
@@ -127,7 +127,7 @@ def redo(self):
self.node.model.height = self.node.view.height


class NodeRemovedCmd(QtWidgets.QUndoCommand):
class NodeRemovedCmd(QtGui.QUndoCommand):
"""
Node deleted command.
@@ -137,7 +137,7 @@ class NodeRemovedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, graph, node):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.setText('deleted node')
self.scene = graph.scene()
self.model = graph.model
@@ -152,7 +152,7 @@ def redo(self):
self.node.view.delete()


class NodeInputConnectedCmd(QtWidgets.QUndoCommand):
class NodeInputConnectedCmd(QtGui.QUndoCommand):
"""
"BaseNode.on_input_connected()" command.
@@ -162,7 +162,7 @@ class NodeInputConnectedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, src_port, trg_port):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
if src_port.type_() == PortTypeEnum.IN.value:
self.source = src_port
self.target = trg_port
@@ -179,7 +179,7 @@ def redo(self):
node.on_input_connected(self.source, self.target)


class NodeInputDisconnectedCmd(QtWidgets.QUndoCommand):
class NodeInputDisconnectedCmd(QtGui.QUndoCommand):
"""
Node "on_input_disconnected()" command.
@@ -189,7 +189,7 @@ class NodeInputDisconnectedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, src_port, trg_port):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
if src_port.type_() == PortTypeEnum.IN.value:
self.source = src_port
self.target = trg_port
@@ -206,7 +206,7 @@ def redo(self):
node.on_input_disconnected(self.source, self.target)


class PortConnectedCmd(QtWidgets.QUndoCommand):
class PortConnectedCmd(QtGui.QUndoCommand):
"""
Port connected command.
@@ -216,7 +216,7 @@ class PortConnectedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, src_port, trg_port):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.source = src_port
self.target = trg_port

@@ -252,7 +252,7 @@ def redo(self):
self.source.view.connect_to(self.target.view)


class PortDisconnectedCmd(QtWidgets.QUndoCommand):
class PortDisconnectedCmd(QtGui.QUndoCommand):
"""
Port disconnected command.
@@ -262,7 +262,7 @@ class PortDisconnectedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, src_port, trg_port):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.source = src_port
self.target = trg_port

@@ -298,7 +298,7 @@ def redo(self):
self.source.view.disconnect_from(self.target.view)


class PortLockedCmd(QtWidgets.QUndoCommand):
class PortLockedCmd(QtGui.QUndoCommand):
"""
Port locked command.
@@ -307,7 +307,7 @@ class PortLockedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, port):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.setText('lock port "{}"'.format(port.name()))
self.port = port

@@ -320,7 +320,7 @@ def redo(self):
self.port.view.locked = True


class PortUnlockedCmd(QtWidgets.QUndoCommand):
class PortUnlockedCmd(QtGui.QUndoCommand):
"""
Port unlocked command.
@@ -329,7 +329,7 @@ class PortUnlockedCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, port):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.setText('unlock port "{}"'.format(port.name()))
self.port = port

@@ -342,7 +342,7 @@ def redo(self):
self.port.view.locked = False


class PortVisibleCmd(QtWidgets.QUndoCommand):
class PortVisibleCmd(QtGui.QUndoCommand):
"""
Port visibility command.
@@ -351,7 +351,7 @@ class PortVisibleCmd(QtWidgets.QUndoCommand):
"""

def __init__(self, port):
QtWidgets.QUndoCommand.__init__(self)
QtGui.QUndoCommand.__init__(self)
self.port = port
self.visible = port.visible()

6 changes: 3 additions & 3 deletions NodeGraphQt/base/graph.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
import os
import re

from Qt import QtCore, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets

from NodeGraphQt.base.commands import (NodeAddedCmd,
NodeRemovedCmd,
@@ -149,7 +149,7 @@ def __init__(self, parent=None, **kwargs):

self._undo_view = None
self._undo_stack = (
kwargs.get('undo_stack') or QtWidgets.QUndoStack(self))
kwargs.get('undo_stack') or QtGui.QUndoStack(self))

self._widget = None

@@ -468,7 +468,7 @@ def widget(self):
self._widget.addTab(self._viewer, 'Node Graph')
# hide the close button on the first tab.
tab_bar = self._widget.tabBar()
for btn_flag in [tab_bar.RightSide, tab_bar.LeftSide]:
for btn_flag in [tab_bar.ButtonPosition.RightSide, tab_bar.ButtonPosition.LeftSide]:
tab_btn = tab_bar.tabButton(0, btn_flag)
if tab_btn:
tab_btn.deleteLater()
4 changes: 2 additions & 2 deletions NodeGraphQt/base/menu.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
import re
from distutils.version import LooseVersion

from Qt import QtGui, QtCore
from PySide6 import QtGui, QtCore

from NodeGraphQt.errors import NodeMenuError
from NodeGraphQt.widgets.actions import BaseMenu, GraphAction, NodeAction
@@ -132,7 +132,7 @@ def add_command(self, name, func=None, shortcut=None):
shortcut = getattr(QtGui.QKeySequence, search.group(1))
elif all([i in ['Alt', 'Enter'] for i in shortcut.split('+')]):
shortcut = QtGui.QKeySequence(
QtCore.Qt.ALT + QtCore.Qt.Key_Return
QtCore.Qt.ALT | QtCore.Qt.Key_Return
)
elif all([i in ['Return', 'Enter'] for i in shortcut.split('+')]):
shortcut = QtCore.Qt.Key_Return
2 changes: 1 addition & 1 deletion NodeGraphQt/constants.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import os

from Qt import QtWidgets
from PySide6 import QtWidgets
from enum import Enum

from .pkg_info import __version__ as _v
10 changes: 5 additions & 5 deletions NodeGraphQt/custom_widgets/nodes_palette.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from collections import defaultdict

from Qt import QtWidgets, QtCore, QtGui
from PySide6 import QtWidgets, QtCore, QtGui

from NodeGraphQt.constants import URN_SCHEME

@@ -134,11 +134,11 @@ class NodesGridView(QtWidgets.QListView):

def __init__(self, parent=None):
super(NodesGridView, self).__init__(parent)
self.setSelectionMode(self.ExtendedSelection)
self.setSelectionMode(self.SelectionMode.ExtendedSelection)
self.setUniformItemSizes(True)
self.setResizeMode(self.Adjust)
self.setViewMode(self.IconMode)
self.setDragDropMode(self.DragOnly)
self.setResizeMode(self.ResizeMode.Adjust)
self.setViewMode(self.ViewMode.IconMode)
self.setDragDropMode(self.DragDropMode.DragOnly)
self.setDragEnabled(True)
self.setMinimumSize(300, 100)
self.setSpacing(4)
4 changes: 2 additions & 2 deletions NodeGraphQt/custom_widgets/nodes_tree.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from Qt import QtWidgets, QtCore, QtGui
from PySide6 import QtWidgets, QtCore, QtGui

from NodeGraphQt.constants import URN_SCHEME

@@ -47,7 +47,7 @@ class NodesTreeWidget(QtWidgets.QTreeWidget):
def __init__(self, parent=None, node_graph=None):
super(NodesTreeWidget, self).__init__(parent)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragOnly)
self.setSelectionMode(self.ExtendedSelection)
self.setSelectionMode(self.SelectionMode.ExtendedSelection)
self.setHeaderHidden(True)
self.setWindowTitle('Nodes')

4 changes: 2 additions & 2 deletions NodeGraphQt/custom_widgets/properties.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python
from collections import defaultdict

from Qt import QtWidgets, QtCore, QtGui
from PySide6 import QtWidgets, QtCore, QtGui

from NodeGraphQt.constants import (NODE_PROP_QLABEL,
NODE_PROP_QLINEEDIT,
@@ -402,7 +402,7 @@ def set_steps(self, steps):
self._add_action(step)

def _add_action(self, step):
action = QtWidgets.QAction(str(step), self)
action = QtGui.QAction(str(step), self)
action.step = step
self.addAction(action)

6 changes: 3 additions & 3 deletions NodeGraphQt/custom_widgets/properties_bin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from Qt import QtWidgets, QtCore, QtGui, QtCompat
from PySide6 import QtWidgets, QtCore, QtGui

from NodeGraphQt.custom_widgets.properties import NodePropWidget

@@ -51,9 +51,9 @@ def __init__(self, parent=None):
self.verticalHeader().hide()
self.horizontalHeader().hide()

QtCompat.QHeaderView.setSectionResizeMode(
QtWidgets.QHeaderView.setSectionResizeMode(
self.verticalHeader(), QtWidgets.QHeaderView.ResizeToContents)
QtCompat.QHeaderView.setSectionResizeMode(
QtWidgets.QHeaderView.setSectionResizeMode(
self.horizontalHeader(), 0, QtWidgets.QHeaderView.Stretch)
self.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)

5 changes: 3 additions & 2 deletions NodeGraphQt/qgraphics/node_abstract.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python
from Qt import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets


from NodeGraphQt.constants import (
Z_VAL_NODE,
@@ -16,7 +17,7 @@ class AbstractNodeItem(QtWidgets.QGraphicsItem):

def __init__(self, name='node', parent=None):
super(AbstractNodeItem, self).__init__(parent)
self.setFlags(self.ItemIsSelectable | self.ItemIsMovable)
self.setFlags(self.GraphicsItemFlag.ItemIsSelectable | self.GraphicsItemFlag.ItemIsMovable)
self.setCacheMode(ITEM_CACHE_MODE)
self.setZValue(Z_VAL_NODE)
self._properties = {
14 changes: 7 additions & 7 deletions NodeGraphQt/qgraphics/node_backdrop.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from Qt import QtGui, QtCore, QtWidgets
from PySide6 import QtGui, QtCore, QtWidgets

from NodeGraphQt.constants import Z_VAL_PIPE, NodeEnum
from NodeGraphQt.qgraphics.node_abstract import AbstractNodeItem
@@ -18,9 +18,9 @@ class BackdropSizer(QtWidgets.QGraphicsItem):

def __init__(self, parent=None, size=6.0):
super(BackdropSizer, self).__init__(parent)
self.setFlag(self.ItemIsSelectable, True)
self.setFlag(self.ItemIsMovable, True)
self.setFlag(self.ItemSendsScenePositionChanges, True)
self.setFlag(self.GraphicsItemFlag.ItemIsSelectable, True)
self.setFlag(self.GraphicsItemFlag.ItemIsMovable, True)
self.setFlag(self.GraphicsItemFlag.ItemSendsScenePositionChanges, True)
self.setCursor(QtGui.QCursor(QtCore.Qt.SizeFDiagCursor))
self.setToolTip('double-click auto resize')
self._size = size
@@ -38,7 +38,7 @@ def boundingRect(self):
return QtCore.QRectF(0.5, 0.5, self._size, self._size)

def itemChange(self, change, value):
if change == self.ItemPositionChange:
if change == self.GraphicsItemChange.ItemPositionChange:
item = self.parentItem()
mx, my = item.minimum_size
x = mx if value.x() < mx else value.x()
@@ -139,7 +139,7 @@ def mousePressEvent(self, event):
item = self.scene().items(rect)[0]

if isinstance(item, (PortItem, PipeItem)):
self.setFlag(self.ItemIsMovable, False)
self.setFlag(self.GraphicsItemFlag.ItemIsMovable, False)
return
if self.selected:
return
@@ -152,7 +152,7 @@ def mousePressEvent(self, event):

def mouseReleaseEvent(self, event):
super(BackdropNodeItem, self).mouseReleaseEvent(event)
self.setFlag(self.ItemIsMovable, True)
self.setFlag(self.GraphicsItemFlag.ItemIsMovable, True)
[n.setSelected(True) for n in self._nodes]
self._nodes = [self]

Loading