From 400baf3269987bdb85f52db254ebd418620e071a Mon Sep 17 00:00:00 2001 From: jchanvfx Date: Mon, 25 Mar 2019 21:56:49 +1300 Subject: [PATCH 1/4] wip and cleanup. --- NodeGraphQt/__init__.py | 2 +- NodeGraphQt/base/graph.py | 1 + NodeGraphQt/widgets/node_base.py | 2 -- NodeGraphQt/widgets/node_widgets.py | 4 ++-- NodeGraphQt/widgets/nodes_list.py | 12 ++++++++++++ NodeGraphQt/widgets/stylesheet.py | 4 +++- 6 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 NodeGraphQt/widgets/nodes_list.py diff --git a/NodeGraphQt/__init__.py b/NodeGraphQt/__init__.py index 369d39a6..767b1e91 100644 --- a/NodeGraphQt/__init__.py +++ b/NodeGraphQt/__init__.py @@ -30,7 +30,7 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -__version__ = '0.0.1' +__version__ = '0.0.2.b1' __status__ = 'Work in Progress' __license__ = 'MIT' diff --git a/NodeGraphQt/base/graph.py b/NodeGraphQt/base/graph.py index 77743559..9210da31 100644 --- a/NodeGraphQt/base/graph.py +++ b/NodeGraphQt/base/graph.py @@ -65,6 +65,7 @@ def _wire_signals(self): self._viewer.node_selected.connect(self._on_node_selected) self._viewer.data_dropped.connect(self._on_node_data_dropped) + # wire up properties bin widget. self._properties_bin.property_changed.connect( self._on_property_changed) diff --git a/NodeGraphQt/widgets/node_base.py b/NodeGraphQt/widgets/node_base.py index c3493088..15ba3f5e 100644 --- a/NodeGraphQt/widgets/node_base.py +++ b/NodeGraphQt/widgets/node_base.py @@ -157,8 +157,6 @@ def paint(self, painter, option, widget): path = QtGui.QPainterPath() path.addRoundedRect(rect, radius, radius) - painter.setPen(QtGui.QPen(border_color.darker(200), 1.5)) - painter.drawPath(path) rect = self.boundingRect() bg_color = QtGui.QColor(*self.color) diff --git a/NodeGraphQt/widgets/node_widgets.py b/NodeGraphQt/widgets/node_widgets.py index 62d01f5e..95747559 100644 --- a/NodeGraphQt/widgets/node_widgets.py +++ b/NodeGraphQt/widgets/node_widgets.py @@ -15,7 +15,6 @@ def __init__(self, label, parent=None): margin = (0, 2, 0, 0) padding_top = '2px' style = STYLE_QGROUPBOX.replace('$PADDING_TOP', padding_top) - self.setMaximumSize(120, 50) self.setTitle(label) self.setStyleSheet(style) @@ -97,10 +96,10 @@ def __init__(self, parent=None, name='', label='', items=None): list_view.setStyleSheet(STYLE_QLISTVIEW) self._combo.setView(list_view) self._combo.clearFocus() + self.add_items(items) group = _NodeGroupBox(label) group.add_node_widget(self._combo) self.setWidget(group) - self.add_items(items) @property def type_(self): @@ -153,6 +152,7 @@ def __init__(self, parent=None, name='', label='', text=''): self._ledit.clearFocus() group = _NodeGroupBox(label) group.add_node_widget(self._ledit) + group.setMaximumWidth(120) self.setWidget(group) self.text = text diff --git a/NodeGraphQt/widgets/nodes_list.py b/NodeGraphQt/widgets/nodes_list.py new file mode 100644 index 00000000..5e4ab4fc --- /dev/null +++ b/NodeGraphQt/widgets/nodes_list.py @@ -0,0 +1,12 @@ +#!/usr/bin/python + +from NodeGraphQt import QtWidgets, QtCore + + +class NodesListWidget(QtWidgets.QTreeWidget): + + def __init__(self, parent=None): + self.setColumnCount(1) + + def add_category(self, name, label): + return diff --git a/NodeGraphQt/widgets/stylesheet.py b/NodeGraphQt/widgets/stylesheet.py index 887556e4..13b7fc7d 100644 --- a/NodeGraphQt/widgets/stylesheet.py +++ b/NodeGraphQt/widgets/stylesheet.py @@ -15,8 +15,10 @@ background-color: rgba(0, 0, 0, 0); border: 0px solid rgba(0, 0, 0, 0); margin-top: 1px; - padding: 2px; padding-top: $PADDING_TOP; + padding-bottom: 2px; + padding-left: 1px; + padding-right: 1px; font-size: 10pt; } QGroupBox::title { From a5bc6d4f6c4b94de1fe00049e4a8a83bfc3a70af Mon Sep 17 00:00:00 2001 From: jchanvfx Date: Mon, 22 Apr 2019 21:23:47 +1200 Subject: [PATCH 2/4] pipe clean up & tab search update. --- NodeGraphQt/base/factory.py | 12 +++++------- NodeGraphQt/constants.py | 3 ++- NodeGraphQt/widgets/nodes_list.py | 12 ------------ NodeGraphQt/widgets/pipe.py | 10 ++++++---- NodeGraphQt/widgets/tab_search.py | 8 +++++++- 5 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 NodeGraphQt/widgets/nodes_list.py diff --git a/NodeGraphQt/base/factory.py b/NodeGraphQt/base/factory.py index 457af411..e1f3af19 100644 --- a/NodeGraphQt/base/factory.py +++ b/NodeGraphQt/base/factory.py @@ -49,7 +49,7 @@ def register_node(self, node, alias=None): Args: node (Node): node item - alias (str): custom alias for the node (optional). + alias (str): custom alias for the node identifier (optional). """ if node is None: return @@ -64,12 +64,10 @@ def register_node(self, node, alias=None): .format(node_type)) self.__nodes[node_type] = node - if self.__names.get(node_type): - raise NodeRegistrationError( - 'Node Name: {} already exists!' - 'Please specify a new node name for node: {}' - .format(name, node_type)) - self.__names[name] = node_type + if self.__names.get(name): + self.__names[name].append(node_type) + else: + self.__names[name] = [node_type] if alias: if self.__aliases.get(alias): diff --git a/NodeGraphQt/constants.py b/NodeGraphQt/constants.py index c9ebbb6b..5664c5c0 100644 --- a/NodeGraphQt/constants.py +++ b/NodeGraphQt/constants.py @@ -9,7 +9,8 @@ PIPE_STYLE_DEFAULT = 'line' PIPE_STYLE_DASHED = 'dashed' PIPE_STYLE_DOTTED = 'dotted' -PIPE_DEFAULT_COLOR = (146, 69, 39, 255) +PIPE_DEFAULT_COLOR = (150, 80, 40, 255) +PIPE_DISABLED_COLOR = (190, 20, 20, 255) PIPE_ACTIVE_COLOR = (70, 255, 220, 255) PIPE_HIGHLIGHT_COLOR = (232, 184, 13, 255) #: The draw the connection pipes as straight lines. diff --git a/NodeGraphQt/widgets/nodes_list.py b/NodeGraphQt/widgets/nodes_list.py deleted file mode 100644 index 5e4ab4fc..00000000 --- a/NodeGraphQt/widgets/nodes_list.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/python - -from NodeGraphQt import QtWidgets, QtCore - - -class NodesListWidget(QtWidgets.QTreeWidget): - - def __init__(self, parent=None): - self.setColumnCount(1) - - def add_category(self, name, label): - return diff --git a/NodeGraphQt/widgets/pipe.py b/NodeGraphQt/widgets/pipe.py index 4c7f1cdb..1c2d2a1a 100644 --- a/NodeGraphQt/widgets/pipe.py +++ b/NodeGraphQt/widgets/pipe.py @@ -4,6 +4,7 @@ from NodeGraphQt import QtCore, QtGui, QtWidgets from NodeGraphQt.constants import ( PIPE_DEFAULT_COLOR, PIPE_ACTIVE_COLOR, PIPE_HIGHLIGHT_COLOR, + PIPE_DISABLED_COLOR, PIPE_STYLE_DASHED, PIPE_STYLE_DEFAULT, PIPE_STYLE_DOTTED, PIPE_LAYOUT_STRAIGHT, PIPE_WIDTH, IN_PORT, OUT_PORT, Z_VAL_PIPE ) @@ -31,10 +32,10 @@ def __init__(self, input_port=None, output_port=None): self._highlight = False self._input_port = input_port self._output_port = output_port - size = 5.0 + size = 6.0 self._arrow = QtGui.QPolygonF() self._arrow.append(QtCore.QPointF(-size, size)) - self._arrow.append(QtCore.QPointF(0.0, -size * 2)) + self._arrow.append(QtCore.QPointF(0.0, -size * 1.5)) self._arrow.append(QtCore.QPointF(size, size)) def __repr__(self): @@ -77,7 +78,8 @@ def paint(self, painter, option, widget): pen_style = PIPE_STYLES.get(PIPE_STYLE_DEFAULT) if self.disabled(): - color.setAlpha(200) + if not self._active: + color = QtGui.QColor(*PIPE_DISABLED_COLOR) pen_width += 0.2 pen_style = PIPE_STYLES.get(PIPE_STYLE_DOTTED) @@ -108,7 +110,7 @@ def paint(self, painter, option, widget): elif self._active or self.disabled(): painter.setBrush(QtGui.QBrush(color.darker(200))) else: - painter.setBrush(QtGui.QBrush(color)) + painter.setBrush(QtGui.QBrush(color.darker(130))) pen_width = 0.6 if dist < 1.0: diff --git a/NodeGraphQt/widgets/tab_search.py b/NodeGraphQt/widgets/tab_search.py index 2433e484..4011124e 100644 --- a/NodeGraphQt/widgets/tab_search.py +++ b/NodeGraphQt/widgets/tab_search.py @@ -91,7 +91,13 @@ def mousePressEvent(self, event): self.completer().complete() def set_nodes(self, node_dict=None): - self._node_dict = node_dict or {} + self._node_dict = {} + for name, node_types in node_dict.items(): + if len(node_types) == 1: + self._node_dict[name] = node_types[0] + continue + for node_id in node_types: + self._node_dict['{} ({})'.format(name, node_id)] = node_id node_names = sorted(self._node_dict.keys()) self._model.setStringList(node_names) self._completer.setModel(self._model) From 3e34fc16ded01f4dc0c7bc658db0d781172fa266 Mon Sep 17 00:00:00 2001 From: jchanvfx Date: Thu, 25 Apr 2019 00:07:50 +1200 Subject: [PATCH 3/4] restructure graphics items and clean up. --- NodeGraphQt/base/model.py | 1 + NodeGraphQt/base/node.py | 30 ++++++++++------ NodeGraphQt/items/__init__.py | 0 .../{widgets => items}/node_abstract.py | 2 +- .../{widgets => items}/node_backdrop.py | 6 ++-- NodeGraphQt/{widgets => items}/node_base.py | 34 +++---------------- NodeGraphQt/{widgets => items}/pipe.py | 15 ++++---- NodeGraphQt/{widgets => items}/port.py | 0 .../{node_widgets.py => node_property.py} | 0 NodeGraphQt/widgets/properties.py | 1 - NodeGraphQt/widgets/properties_bin.py | 2 +- NodeGraphQt/widgets/stylesheet.py | 8 ++--- NodeGraphQt/widgets/viewer.py | 8 ++--- 13 files changed, 45 insertions(+), 62 deletions(-) create mode 100644 NodeGraphQt/items/__init__.py rename NodeGraphQt/{widgets => items}/node_abstract.py (99%) rename NodeGraphQt/{widgets => items}/node_backdrop.py (98%) rename NodeGraphQt/{widgets => items}/node_base.py (94%) rename NodeGraphQt/{widgets => items}/pipe.py (96%) rename NodeGraphQt/{widgets => items}/port.py (100%) rename NodeGraphQt/widgets/{node_widgets.py => node_property.py} (100%) diff --git a/NodeGraphQt/base/model.py b/NodeGraphQt/base/model.py index 018265aa..7ca2451e 100644 --- a/NodeGraphQt/base/model.py +++ b/NodeGraphQt/base/model.py @@ -70,6 +70,7 @@ def __init__(self): # store the property attributes. # (deleted when node is added to the graph) self._TEMP_property_attrs = {} + # temp store the property widget types. # (deleted when node is added to the graph) self._TEMP_property_widget_types = { diff --git a/NodeGraphQt/base/node.py b/NodeGraphQt/base/node.py index b9fe1a07..0e87913a 100644 --- a/NodeGraphQt/base/node.py +++ b/NodeGraphQt/base/node.py @@ -8,8 +8,11 @@ NODE_PROP_QCHECKBOX, IN_PORT, OUT_PORT) from NodeGraphQt.errors import PortRegistrationError -from NodeGraphQt.widgets.node_backdrop import BackdropNodeItem -from NodeGraphQt.widgets.node_base import NodeItem +from NodeGraphQt.items.node_backdrop import BackdropNodeItem +from NodeGraphQt.items.node_base import NodeItem +from NodeGraphQt.widgets.node_property import (NodeComboBox, + NodeLineEdit, + NodeCheckBox) class classproperty(object): @@ -392,7 +395,8 @@ def icon(self): def add_combo_menu(self, name='', label='', items=None, tab=None): """ - Embed a :class:`PySide2.QtWidgets.QComboBox` widget into the node. + Create a custom property and embed a + :class:`PySide2.QtWidgets.QComboBox` widget into the node. Args: name (str): name for the custom property. @@ -403,12 +407,15 @@ def add_combo_menu(self, name='', label='', items=None, tab=None): items = items or [] self.create_property( name, items[0], items=items, widget_type=NODE_PROP_QCOMBO, tab=tab) - widget = self.view.add_combo_menu(name, label, items) + + widget = NodeComboBox(self.view, name, label, items) widget.value_changed.connect(lambda k, v: self.set_property(k, v)) + self.view.add_widget(widget) def add_text_input(self, name='', label='', text='', tab=None): """ - Embed a :class:`PySide2.QtWidgets.QLineEdit` widget into the node. + Create a custom property and embed a + :class:`PySide2.QtWidgets.QLineEdit` widget into the node. Args: name (str): name for the custom property. @@ -418,12 +425,14 @@ def add_text_input(self, name='', label='', text='', tab=None): """ self.create_property( name, text, widget_type=NODE_PROP_QLINEEDIT, tab=tab) - widget = self.view.add_text_input(name, label, text) + widget = NodeLineEdit(self.view, name, label, text) widget.value_changed.connect(lambda k, v: self.set_property(k, v)) + self.view.add_widget(widget) def add_checkbox(self, name='', label='', text='', state=False, tab=None): """ - Embed a :class:`PySide2.QtWidgets.QCheckBox` widget into the node. + Create a custom property and embed a + :class:`PySide2.QtWidgets.QCheckBox` widget into the node. Args: name (str): name for the custom property. @@ -434,8 +443,9 @@ def add_checkbox(self, name='', label='', text='', state=False, tab=None): """ self.create_property( name, state, widget_type=NODE_PROP_QCHECKBOX, tab=tab) - widget = self.view.add_checkbox(name, label, text, state) + widget = NodeCheckBox(self.view, name, label, text, state) widget.value_changed.connect(lambda k, v: self.set_property(k, v)) + self.view.add_widget(widget) def add_input(self, name='input', multi_input=False, display_name=True): """ @@ -451,7 +461,7 @@ def add_input(self, name='input', multi_input=False, display_name=True): """ if name in self.inputs().keys(): raise PortRegistrationError( - 'port name "{}" already taken.'.format(name)) + 'port name "{}" already registered.'.format(name)) view = self.view.add_input(name, multi_input, display_name) port = Port(self, view) port.model.type_ = IN_PORT @@ -476,7 +486,7 @@ def add_output(self, name='output', multi_output=True, display_name=True): """ if name in self.outputs().keys(): raise PortRegistrationError( - 'port name "{}" already taken.'.format(name)) + 'port name "{}" already registered.'.format(name)) view = self.view.add_output(name, multi_output, display_name) port = Port(self, view) port.model.type_ = OUT_PORT diff --git a/NodeGraphQt/items/__init__.py b/NodeGraphQt/items/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/NodeGraphQt/widgets/node_abstract.py b/NodeGraphQt/items/node_abstract.py similarity index 99% rename from NodeGraphQt/widgets/node_abstract.py rename to NodeGraphQt/items/node_abstract.py index 480fc5db..da51f021 100644 --- a/NodeGraphQt/widgets/node_abstract.py +++ b/NodeGraphQt/items/node_abstract.py @@ -6,7 +6,7 @@ class AbstractNodeItem(QtWidgets.QGraphicsItem): """ - The abstract base class of a node item. + The base class of all node qgraphics item. """ def __init__(self, name='node', parent=None): diff --git a/NodeGraphQt/widgets/node_backdrop.py b/NodeGraphQt/items/node_backdrop.py similarity index 98% rename from NodeGraphQt/widgets/node_backdrop.py rename to NodeGraphQt/items/node_backdrop.py index cba7999a..79ab0296 100644 --- a/NodeGraphQt/widgets/node_backdrop.py +++ b/NodeGraphQt/items/node_backdrop.py @@ -4,9 +4,9 @@ from NodeGraphQt.constants import (Z_VAL_PIPE, NODE_SEL_COLOR, NODE_SEL_BORDER_COLOR) -from NodeGraphQt.widgets.node_abstract import AbstractNodeItem -from NodeGraphQt.widgets.pipe import Pipe -from NodeGraphQt.widgets.port import PortItem +from NodeGraphQt.items.node_abstract import AbstractNodeItem +from NodeGraphQt.items.pipe import Pipe +from NodeGraphQt.items.port import PortItem class BackdropSizer(QtWidgets.QGraphicsItem): diff --git a/NodeGraphQt/widgets/node_base.py b/NodeGraphQt/items/node_base.py similarity index 94% rename from NodeGraphQt/widgets/node_base.py rename to NodeGraphQt/items/node_base.py index 15ba3f5e..79715ca1 100644 --- a/NodeGraphQt/widgets/node_base.py +++ b/NodeGraphQt/items/node_base.py @@ -7,12 +7,8 @@ NODE_SEL_COLOR, NODE_SEL_BORDER_COLOR, Z_VAL_NODE, Z_VAL_NODE_WIDGET) from NodeGraphQt.errors import NodeWidgetError -from NodeGraphQt.widgets.node_abstract import AbstractNodeItem -from NodeGraphQt.widgets.node_widgets import (NodeBaseWidget, - NodeComboBox, - NodeLineEdit, - NodeCheckBox) -from NodeGraphQt.widgets.port import PortItem +from NodeGraphQt.items.node_abstract import AbstractNodeItem +from NodeGraphQt.items.port import PortItem class XDisabledItem(QtWidgets.QGraphicsItem): @@ -663,32 +659,10 @@ def get_output_text_item(self, port_item): @property def widgets(self): - return dict(self._widgets) - - def add_combo_menu(self, name='', label='', items=None, tooltip=''): - items = items or [] - widget = NodeComboBox(self, name, label, items) - widget.setToolTip(tooltip) - self.add_widget(widget) - return widget - - def add_text_input(self, name='', label='', text='', tooltip=''): - widget = NodeLineEdit(self, name, label, text) - widget.setToolTip(tooltip) - self.add_widget(widget) - return widget - - def add_checkbox(self, name='', label='', text='', state=False, tooltip=''): - widget = NodeCheckBox(self, name, label, text, state) - widget.setToolTip(tooltip) - self.add_widget(widget) - return widget + return self._widgets.copy() def add_widget(self, widget): - if isinstance(widget, NodeBaseWidget): - self._widgets[widget.name] = widget - else: - raise NodeWidgetError('{} is not an instance of a node widget.') + self._widgets[widget.name] = widget def get_widget(self, name): widget = self._widgets.get(name) diff --git a/NodeGraphQt/widgets/pipe.py b/NodeGraphQt/items/pipe.py similarity index 96% rename from NodeGraphQt/widgets/pipe.py rename to NodeGraphQt/items/pipe.py index 1c2d2a1a..a093c93d 100644 --- a/NodeGraphQt/widgets/pipe.py +++ b/NodeGraphQt/items/pipe.py @@ -3,12 +3,12 @@ from NodeGraphQt import QtCore, QtGui, QtWidgets from NodeGraphQt.constants import ( - PIPE_DEFAULT_COLOR, PIPE_ACTIVE_COLOR, PIPE_HIGHLIGHT_COLOR, - PIPE_DISABLED_COLOR, + PIPE_DEFAULT_COLOR, PIPE_ACTIVE_COLOR, + PIPE_HIGHLIGHT_COLOR, PIPE_DISABLED_COLOR, PIPE_STYLE_DASHED, PIPE_STYLE_DEFAULT, PIPE_STYLE_DOTTED, PIPE_LAYOUT_STRAIGHT, PIPE_WIDTH, IN_PORT, OUT_PORT, Z_VAL_PIPE ) -from NodeGraphQt.widgets.port import PortItem +from NodeGraphQt.items.port import PortItem PIPE_STYLES = { PIPE_STYLE_DEFAULT: QtCore.Qt.SolidLine, @@ -49,10 +49,11 @@ def hoverEnterEvent(self, event): def hoverLeaveEvent(self, event): self.reset() - if self.input_port.node.selected: - self.highlight() - elif self.output_port.node.selected: - self.highlight() + if self.input_port and self.output_port: + if self.input_port.node.selected: + self.highlight() + elif self.output_port.node.selected: + self.highlight() def paint(self, painter, option, widget): """ diff --git a/NodeGraphQt/widgets/port.py b/NodeGraphQt/items/port.py similarity index 100% rename from NodeGraphQt/widgets/port.py rename to NodeGraphQt/items/port.py diff --git a/NodeGraphQt/widgets/node_widgets.py b/NodeGraphQt/widgets/node_property.py similarity index 100% rename from NodeGraphQt/widgets/node_widgets.py rename to NodeGraphQt/widgets/node_property.py diff --git a/NodeGraphQt/widgets/properties.py b/NodeGraphQt/widgets/properties.py index e1812a1c..946412e3 100644 --- a/NodeGraphQt/widgets/properties.py +++ b/NodeGraphQt/widgets/properties.py @@ -9,7 +9,6 @@ NODE_PROP_QSPINBOX, NODE_PROP_COLORPICKER, NODE_PROP_SLIDER) -from NodeGraphQt.errors import NodePropertyError class BaseProperty(QtWidgets.QWidget): diff --git a/NodeGraphQt/widgets/properties_bin.py b/NodeGraphQt/widgets/properties_bin.py index f53bedb9..8ee8d932 100644 --- a/NodeGraphQt/widgets/properties_bin.py +++ b/NodeGraphQt/widgets/properties_bin.py @@ -62,7 +62,7 @@ def __init__(self, parent=None): self._limit.setToolTip('Set node limit to display.') self._limit.setMaximum(10) self._limit.setMinimum(0) - self._limit.setValue(10) + self._limit.setValue(5) self._limit.valueChanged.connect(self.__on_limit_changed) self.resize(400, 400) diff --git a/NodeGraphQt/widgets/stylesheet.py b/NodeGraphQt/widgets/stylesheet.py index 13b7fc7d..8e920b6a 100644 --- a/NodeGraphQt/widgets/stylesheet.py +++ b/NodeGraphQt/widgets/stylesheet.py @@ -2,12 +2,10 @@ from NodeGraphQt.constants import ICON_DOWN_ARROW -# we reformat the icon file path on windows os. -regex = re.compile('(\w:)') -match = regex.match(ICON_DOWN_ARROW) +# Reformat the icon path on Windows OS. +match = re.match('(\\w:)', ICON_DOWN_ARROW) if match: - match_str = match.group(1) - ICON_DOWN_ARROW = ICON_DOWN_ARROW[len(match_str):] + ICON_DOWN_ARROW = ICON_DOWN_ARROW[len(match.group(1)):] ICON_DOWN_ARROW = ICON_DOWN_ARROW.replace('\\', '/') STYLE_QGROUPBOX = ''' diff --git a/NodeGraphQt/widgets/viewer.py b/NodeGraphQt/widgets/viewer.py index d03e0d0b..c051240b 100644 --- a/NodeGraphQt/widgets/viewer.py +++ b/NodeGraphQt/widgets/viewer.py @@ -7,10 +7,10 @@ PIPE_LAYOUT_STRAIGHT, PIPE_STYLE_DASHED, SCENE_AREA) -from NodeGraphQt.widgets.node_abstract import AbstractNodeItem -from NodeGraphQt.widgets.node_backdrop import BackdropNodeItem -from NodeGraphQt.widgets.pipe import Pipe -from NodeGraphQt.widgets.port import PortItem +from NodeGraphQt.items.node_abstract import AbstractNodeItem +from NodeGraphQt.items.node_backdrop import BackdropNodeItem +from NodeGraphQt.items.pipe import Pipe +from NodeGraphQt.items.port import PortItem from NodeGraphQt.widgets.scene import NodeScene from NodeGraphQt.widgets.stylesheet import STYLE_QMENU from NodeGraphQt.widgets.tab_search import TabSearchWidget From 332a745ecf07d7642acaad5b696457302b756f9a Mon Sep 17 00:00:00 2001 From: jchanvfx Date: Thu, 25 Apr 2019 00:15:03 +1200 Subject: [PATCH 4/4] renamed package. --- NodeGraphQt/base/node.py | 4 ++-- NodeGraphQt/{items => qgraphics}/__init__.py | 0 NodeGraphQt/{items => qgraphics}/node_abstract.py | 0 NodeGraphQt/{items => qgraphics}/node_backdrop.py | 6 +++--- NodeGraphQt/{items => qgraphics}/node_base.py | 4 ++-- NodeGraphQt/{items => qgraphics}/pipe.py | 2 +- NodeGraphQt/{items => qgraphics}/port.py | 0 NodeGraphQt/widgets/viewer.py | 8 ++++---- 8 files changed, 12 insertions(+), 12 deletions(-) rename NodeGraphQt/{items => qgraphics}/__init__.py (100%) rename NodeGraphQt/{items => qgraphics}/node_abstract.py (100%) rename NodeGraphQt/{items => qgraphics}/node_backdrop.py (98%) rename NodeGraphQt/{items => qgraphics}/node_base.py (99%) rename NodeGraphQt/{items => qgraphics}/pipe.py (99%) rename NodeGraphQt/{items => qgraphics}/port.py (100%) diff --git a/NodeGraphQt/base/node.py b/NodeGraphQt/base/node.py index 0e87913a..40e51352 100644 --- a/NodeGraphQt/base/node.py +++ b/NodeGraphQt/base/node.py @@ -8,8 +8,8 @@ NODE_PROP_QCHECKBOX, IN_PORT, OUT_PORT) from NodeGraphQt.errors import PortRegistrationError -from NodeGraphQt.items.node_backdrop import BackdropNodeItem -from NodeGraphQt.items.node_base import NodeItem +from NodeGraphQt.qgraphics.node_backdrop import BackdropNodeItem +from NodeGraphQt.qgraphics.node_base import NodeItem from NodeGraphQt.widgets.node_property import (NodeComboBox, NodeLineEdit, NodeCheckBox) diff --git a/NodeGraphQt/items/__init__.py b/NodeGraphQt/qgraphics/__init__.py similarity index 100% rename from NodeGraphQt/items/__init__.py rename to NodeGraphQt/qgraphics/__init__.py diff --git a/NodeGraphQt/items/node_abstract.py b/NodeGraphQt/qgraphics/node_abstract.py similarity index 100% rename from NodeGraphQt/items/node_abstract.py rename to NodeGraphQt/qgraphics/node_abstract.py diff --git a/NodeGraphQt/items/node_backdrop.py b/NodeGraphQt/qgraphics/node_backdrop.py similarity index 98% rename from NodeGraphQt/items/node_backdrop.py rename to NodeGraphQt/qgraphics/node_backdrop.py index 79ab0296..46e5d6b7 100644 --- a/NodeGraphQt/items/node_backdrop.py +++ b/NodeGraphQt/qgraphics/node_backdrop.py @@ -4,9 +4,9 @@ from NodeGraphQt.constants import (Z_VAL_PIPE, NODE_SEL_COLOR, NODE_SEL_BORDER_COLOR) -from NodeGraphQt.items.node_abstract import AbstractNodeItem -from NodeGraphQt.items.pipe import Pipe -from NodeGraphQt.items.port import PortItem +from NodeGraphQt.qgraphics.node_abstract import AbstractNodeItem +from NodeGraphQt.qgraphics.pipe import Pipe +from NodeGraphQt.qgraphics.port import PortItem class BackdropSizer(QtWidgets.QGraphicsItem): diff --git a/NodeGraphQt/items/node_base.py b/NodeGraphQt/qgraphics/node_base.py similarity index 99% rename from NodeGraphQt/items/node_base.py rename to NodeGraphQt/qgraphics/node_base.py index 79715ca1..1c2fb6fa 100644 --- a/NodeGraphQt/items/node_base.py +++ b/NodeGraphQt/qgraphics/node_base.py @@ -7,8 +7,8 @@ NODE_SEL_COLOR, NODE_SEL_BORDER_COLOR, Z_VAL_NODE, Z_VAL_NODE_WIDGET) from NodeGraphQt.errors import NodeWidgetError -from NodeGraphQt.items.node_abstract import AbstractNodeItem -from NodeGraphQt.items.port import PortItem +from NodeGraphQt.qgraphics.node_abstract import AbstractNodeItem +from NodeGraphQt.qgraphics.port import PortItem class XDisabledItem(QtWidgets.QGraphicsItem): diff --git a/NodeGraphQt/items/pipe.py b/NodeGraphQt/qgraphics/pipe.py similarity index 99% rename from NodeGraphQt/items/pipe.py rename to NodeGraphQt/qgraphics/pipe.py index a093c93d..3a4178d5 100644 --- a/NodeGraphQt/items/pipe.py +++ b/NodeGraphQt/qgraphics/pipe.py @@ -8,7 +8,7 @@ PIPE_STYLE_DASHED, PIPE_STYLE_DEFAULT, PIPE_STYLE_DOTTED, PIPE_LAYOUT_STRAIGHT, PIPE_WIDTH, IN_PORT, OUT_PORT, Z_VAL_PIPE ) -from NodeGraphQt.items.port import PortItem +from NodeGraphQt.qgraphics.port import PortItem PIPE_STYLES = { PIPE_STYLE_DEFAULT: QtCore.Qt.SolidLine, diff --git a/NodeGraphQt/items/port.py b/NodeGraphQt/qgraphics/port.py similarity index 100% rename from NodeGraphQt/items/port.py rename to NodeGraphQt/qgraphics/port.py diff --git a/NodeGraphQt/widgets/viewer.py b/NodeGraphQt/widgets/viewer.py index c051240b..b0e00160 100644 --- a/NodeGraphQt/widgets/viewer.py +++ b/NodeGraphQt/widgets/viewer.py @@ -7,10 +7,10 @@ PIPE_LAYOUT_STRAIGHT, PIPE_STYLE_DASHED, SCENE_AREA) -from NodeGraphQt.items.node_abstract import AbstractNodeItem -from NodeGraphQt.items.node_backdrop import BackdropNodeItem -from NodeGraphQt.items.pipe import Pipe -from NodeGraphQt.items.port import PortItem +from NodeGraphQt.qgraphics.node_abstract import AbstractNodeItem +from NodeGraphQt.qgraphics.node_backdrop import BackdropNodeItem +from NodeGraphQt.qgraphics.pipe import Pipe +from NodeGraphQt.qgraphics.port import PortItem from NodeGraphQt.widgets.scene import NodeScene from NodeGraphQt.widgets.stylesheet import STYLE_QMENU from NodeGraphQt.widgets.tab_search import TabSearchWidget