Skip to content

Commit 0d83e16

Browse files
committed
Merge branch 'master' of https://github.com/jchanvfx/NodeGraphQt
2 parents 443d7b2 + 0656246 commit 0d83e16

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

NodeGraphQt/base/graph.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ def set_context_menu(self, menu_name, data):
772772
"""
773773
Populate a context menu from serialized data.
774774
775-
serialized menu data example:
775+
example of serialized menu data:
776776
777777
.. highlight:: python
778778
.. code-block:: python
@@ -795,6 +795,15 @@ def set_context_menu(self, menu_name, data):
795795
},
796796
]
797797
798+
the ``run_test`` example function:
799+
800+
.. highlight:: python
801+
.. code-block:: python
802+
803+
def run_test(graph):
804+
print(graph.selected_nodes())
805+
806+
798807
Args:
799808
menu_name (str): name of the parent context menu to populate under.
800809
data (dict): serialized menu data.
@@ -806,7 +815,8 @@ def set_context_menu_from_file(self, file_path, menu=None):
806815
"""
807816
Populate a context menu from a serialized json file.
808817
809-
Menu Types:
818+
menu types:
819+
810820
- ``"graph"`` context menu from the node graph.
811821
- ``"nodes"`` context menu for the nodes.
812822
@@ -1202,13 +1212,13 @@ def delete_node(self, node, push_undo=True):
12021212
p.set_locked(False,
12031213
connected_ports=False,
12041214
push_undo=push_undo)
1205-
p.clear_connections()
1215+
p.clear_connections(push_undo=push_undo)
12061216
for p in node.output_ports():
12071217
if p.locked():
12081218
p.set_locked(False,
12091219
connected_ports=False,
12101220
push_undo=push_undo)
1211-
p.clear_connections()
1221+
p.clear_connections(push_undo=push_undo)
12121222

12131223
# collapse group node before removing.
12141224
if isinstance(node, GroupNode) and node.is_expanded:
@@ -1249,13 +1259,13 @@ def remove_node(self, node, push_undo=True):
12491259
p.set_locked(False,
12501260
connected_ports=False,
12511261
push_undo=push_undo)
1252-
p.clear_connections()
1262+
p.clear_connections(push_undo=push_undo)
12531263
for p in node.output_ports():
12541264
if p.locked():
12551265
p.set_locked(False,
12561266
connected_ports=False,
12571267
push_undo=push_undo)
1258-
p.clear_connections()
1268+
p.clear_connections(push_undo=push_undo)
12591269

12601270
if push_undo:
12611271
self._undo_stack.push(NodeRemovedCmd(self, node))

NodeGraphQt/nodes/base_node.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ def add_custom_widget(self, widget, widget_type=None, tab=None):
167167
widget.value_changed.connect(lambda k, v: self.set_property(k, v))
168168
widget._node = self
169169
self.view.add_widget(widget)
170+
#: redraw node to address calls outside the "__init__" func.
171+
self.view.draw_node()
170172

171173
def add_combo_menu(self, name, label='', items=None, tab=None):
172174
"""
@@ -194,6 +196,8 @@ def add_combo_menu(self, name, label='', items=None, tab=None):
194196
widget = NodeComboBox(self.view, name, label, items)
195197
widget.value_changed.connect(lambda k, v: self.set_property(k, v))
196198
self.view.add_widget(widget)
199+
#: redraw node to address calls outside the "__init__" func.
200+
self.view.draw_node()
197201

198202
def add_text_input(self, name, label='', text='', tab=None):
199203
"""
@@ -220,6 +224,8 @@ def add_text_input(self, name, label='', text='', tab=None):
220224
widget = NodeLineEdit(self.view, name, label, text)
221225
widget.value_changed.connect(lambda k, v: self.set_property(k, v))
222226
self.view.add_widget(widget)
227+
#: redraw node to address calls outside the "__init__" func.
228+
self.view.draw_node()
223229

224230
def add_checkbox(self, name, label='', text='', state=False, tab=None):
225231
"""
@@ -247,6 +253,8 @@ def add_checkbox(self, name, label='', text='', state=False, tab=None):
247253
widget = NodeCheckBox(self.view, name, label, text, state)
248254
widget.value_changed.connect(lambda k, v: self.set_property(k, v))
249255
self.view.add_widget(widget)
256+
#: redraw node to address calls outside the "__init__" func.
257+
self.view.draw_node()
250258

251259
def add_input(self, name='input', multi_input=False, display_name=True,
252260
color=None, locked=False, painter_func=None):

NodeGraphQt/pkg_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
3-
__version__ = '0.5.0'
3+
__version__ = '0.5.2'
44
__status__ = 'Work in Progress'
55
__license__ = 'MIT'
66

NodeGraphQt/qgraphics/node_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,4 +1024,4 @@ def from_dict(self, node_dict):
10241024
widgets = node_dict.pop('widgets', {})
10251025
for name, value in widgets.items():
10261026
if self._widgets.get(name):
1027-
self._widgets[name].get_value = value
1027+
self._widgets[name].set_value(value)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = NodeGraphQt
3-
version=0.5.0
3+
version=0.5.2
44
author=Johnny Chan
55
license = MIT License
66
license_file = LICENSE.md

0 commit comments

Comments
 (0)