Skip to content

Commit

Permalink
property bin reference bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
jchanvfx committed Jan 19, 2024
1 parent 8e41d48 commit f2043b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
32 changes: 19 additions & 13 deletions NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def __init__(self, parent=None):
layout.setAlignment(QtCore.Qt.AlignTop)
layout.addLayout(self.__layout)

self.__property_widgets = {}

def __repr__(self):
return '<{} object at {}>'.format(
self.__class__.__name__, hex(id(self))
Expand Down Expand Up @@ -124,6 +126,7 @@ def add_widget(self, name, widget, value, label=None, tooltip=None):

self.__layout.addWidget(label_widget, row, 0, label_flags)
self.__layout.addWidget(widget, row, 1)
self.__property_widgets[name] = widget

def get_widget(self, name):
"""
Expand All @@ -135,10 +138,7 @@ def get_widget(self, name):
Returns:
QtWidgets.QWidget: property widget.
"""
for row in range(self.__layout.rowCount()):
item = self.__layout.itemAtPosition(row, 1)
if item and name == item.widget().toolTip():
return item.widget()
return self.__property_widgets.get(name)

def get_all_widgets(self):
"""
Expand All @@ -147,14 +147,7 @@ def get_all_widgets(self):
Returns:
dict: {name: widget}
"""
widgets = {}
for row in range(self.__layout.rowCount()):
item = self.__layout.itemAtPosition(row, 1)
if not item:
continue
name = item.widget().toolTip()
widgets[name] = item.widget()
return widgets
return self.__property_widgets


class _PortConnectionsContainer(QtWidgets.QWidget):
Expand Down Expand Up @@ -558,11 +551,24 @@ def get_widget(self, name):
"""
if name == 'name':
return self.name_wgt
for tab_name, prop_win in self.__tab_windows.items():
for prop_win in self.__tab_windows.values():
widget = prop_win.get_widget(name)
if widget:
return widget

def get_all_property_widgets(self):
"""
get all the node property widgets.
Returns:
list[BaseProperty]: property widgets.
"""
widgets = [self.name_wgt]
for prop_win in self.__tab_windows.values():
for widget in prop_win.get_all_widgets().values():
widgets.append(widget)
return widgets

def get_port_connection_widget(self):
"""
Returns the ports connections container widget.
Expand Down
2 changes: 1 addition & 1 deletion NodeGraphQt/pkg_info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
__version__ = '0.6.31'
__version__ = '0.6.32'
__status__ = 'Work in Progress'
__license__ = 'MIT'

Expand Down

0 comments on commit f2043b7

Please sign in to comment.