Skip to content

Commit 0b2f721

Browse files
committed
update example && clean code && fix bug
1 parent a26285c commit 0b2f721

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

NodeGraphQt/qgraphics/node_base.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ def paint(self, painter, option, widget):
4040
used to describe the parameters needed to draw.
4141
widget (QtWidgets.QWidget): not used.
4242
"""
43-
4443
painter.save()
45-
painter.setClipRect(option.exposedRect)
4644

4745
margin = 20
4846
rect = self.boundingRect()
@@ -136,10 +134,6 @@ def __init__(self, name='node', parent=None):
136134
self._proxy_mode = False
137135
self._porxy_mode_threshold = 70
138136

139-
# def paint(self, painter, option, widget,force=False):
140-
# if self.auto_switch_mode() or force:
141-
# self._paint(self, painter, option, widget)
142-
143137
def paint(self, painter, option, widget):
144138
"""
145139
Draws the node base not the ports.

NodeGraphQt/widgets/node_widgets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def get_icon(self, name):
143143
"""
144144
return self.style().standardIcon(QtWidgets.QStyle.StandardPixmap(name))
145145

146+
146147
class NodeComboBox(NodeBaseWidget):
147148
"""
148149
NodeComboBox widget is subclassed from :class:`NodeBaseWidget`,

NodeGraphQt/widgets/properties.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class _ColorSolid(QtWidgets.QWidget):
2828
def __init__(self, parent=None, color=None):
2929
super(_ColorSolid, self).__init__(parent)
3030
self.setFixedSize(15, 15)
31-
self._color = color or (0, 0, 0)
31+
self.color = color or (0, 0, 0)
3232

3333
def paintEvent(self, event):
3434
size = self.geometry()
@@ -63,7 +63,6 @@ def __init__(self, parent=None):
6363
layout = QtWidgets.QHBoxLayout(self)
6464
layout.setContentsMargins(0, 0, 8, 0)
6565
layout.setSpacing(4)
66-
# layout.addWidget(self._solid, 0, QtCore.Qt.AlignCenter)
6766
layout.addWidget(self._label, 0, QtCore.Qt.AlignCenter)
6867
layout.addWidget(self._button, 1, QtCore.Qt.AlignLeft)
6968

@@ -475,7 +474,8 @@ def _read_node(self, node):
475474

476475
WidClass = WIDGET_MAP.get(wid_type)
477476
widget = WidClass()
478-
widget.setFixedHeight(widget_height)
477+
if wid_type != NODE_PROP_QTEXTEDIT:
478+
widget.setFixedHeight(widget_height)
479479
if prop_name in common_props.keys():
480480
if 'items' in common_props[prop_name].keys():
481481
widget.set_items(common_props[prop_name]['items'])

example_auto_nodes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def toggle_auto_cook(graph,node):
5050

5151
# create node graph.
5252
graph = NodeGraph()
53+
graph.use_opengl()
5354

5455
# set up default menu and commands.
5556
setup_context_menu(graph)
@@ -117,4 +118,4 @@ def show_nodes_list(node):
117118
name='Output',
118119
pos=[250, 0])
119120

120-
app.exec_()
121+
sys.exit(app.exec_())

0 commit comments

Comments
 (0)