Skip to content

Commit 879ca29

Browse files
committed
backdrop properties update
1 parent eef92dd commit 879ca29

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

NodeGraphQt/base/node.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from NodeGraphQt.base.port import Port
55
from NodeGraphQt.constants import (NODE_PROP,
66
NODE_PROP_QLINEEDIT,
7+
NODE_PROP_QTEXTEDIT,
78
NODE_PROP_QCOMBO,
89
NODE_PROP_QCHECKBOX,
910
IN_PORT, OUT_PORT)
@@ -574,7 +575,8 @@ def __init__(self):
574575
super(BackdropNode, self).__init__(BackdropNodeItem())
575576
# override base default color.
576577
self.model.color = (5, 129, 138, 255)
577-
self.create_property('backdrop_text', '')
578+
self.create_property('backdrop_text', '',
579+
widget_type=NODE_PROP_QTEXTEDIT, tab='Backdrop')
578580

579581
def auto_size(self):
580582
"""

NodeGraphQt/constants.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,21 @@
4242
#: Property type will hidden in the properties bin (default).
4343
NODE_PROP = 0
4444
#: Property type represented with a QLabel widget in the properties bin.
45-
NODE_PROP_QLABEL = 1
45+
NODE_PROP_QLABEL = 2
4646
#: Property type represented with a QLineEdit widget in the properties bin.
47-
NODE_PROP_QLINEEDIT = 2
47+
NODE_PROP_QLINEEDIT = 3
48+
#: Property type represented with a QTextEdit widget in the properties bin.
49+
NODE_PROP_QTEXTEDIT = 4
4850
#: Property type represented with a QComboBox widget in the properties bin.
49-
NODE_PROP_QCOMBO = 3
51+
NODE_PROP_QCOMBO = 5
5052
#: Property type represented with a QCheckBox widget in the properties bin.
51-
NODE_PROP_QCHECKBOX = 4
53+
NODE_PROP_QCHECKBOX = 6
5254
#: Property type represented with a QSpinBox widget in the properties bin.
53-
NODE_PROP_QSPINBOX = 5
55+
NODE_PROP_QSPINBOX = 7
5456
#: Property type represented with a ColorPicker widget in the properties bin.
55-
NODE_PROP_COLORPICKER = 6
57+
NODE_PROP_COLORPICKER = 8
5658
#: Property type represented with a Slider widget in the properties bin.
57-
NODE_PROP_SLIDER = 7
59+
NODE_PROP_SLIDER = 9
5860

5961
# === NODE VIEWER ===
6062

NodeGraphQt/qgraphics/node_backdrop.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ def _combined_rect(self, nodes):
109109
self.scene().destroyItemGroup(group)
110110
return rect
111111

112+
def mouseDoubleClickEvent(self, event):
113+
viewer = self.viewer()
114+
if viewer:
115+
viewer.node_double_clicked.emit(self.id)
116+
super(BackdropNodeItem, self).mouseDoubleClickEvent(event)
117+
112118
def mousePressEvent(self, event):
113119
if event.button() == QtCore.Qt.LeftButton:
114120
pos = event.scenePos()

NodeGraphQt/widgets/properties.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from NodeGraphQt import QtWidgets, QtCore, QtGui
55
from NodeGraphQt.constants import (NODE_PROP_QLABEL,
66
NODE_PROP_QLINEEDIT,
7+
NODE_PROP_QTEXTEDIT,
78
NODE_PROP_QCOMBO,
89
NODE_PROP_QCHECKBOX,
910
NODE_PROP_QSPINBOX,
@@ -260,6 +261,7 @@ def set_value(self, value):
260261
WIDGET_MAP = {
261262
NODE_PROP_QLABEL: PropLabel,
262263
NODE_PROP_QLINEEDIT: PropLineEdit,
264+
NODE_PROP_QTEXTEDIT: PropLineEdit,
263265
NODE_PROP_QCOMBO: PropComboBox,
264266
NODE_PROP_QCHECKBOX: PropCheckBox,
265267
NODE_PROP_QSPINBOX: PropSpinBox,
@@ -417,8 +419,10 @@ def _read_node(self, node):
417419
prop_window = self.__tab_windows[tab]
418420
for prop_name, value in tab_mapping[tab]:
419421
wid_type = model.get_widget_type(prop_name)
420-
WidClass = WIDGET_MAP.get(wid_type)
422+
if wid_type == 0:
423+
continue
421424

425+
WidClass = WIDGET_MAP.get(wid_type)
422426
widget = WidClass()
423427
if prop_name in common_props.keys():
424428
if 'items' in common_props[prop_name].keys():

0 commit comments

Comments
 (0)