diff --git a/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py b/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py index 75bc5717..aea0b7e5 100644 --- a/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py +++ b/NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py @@ -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)) @@ -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): """ @@ -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): """ @@ -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): @@ -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. diff --git a/NodeGraphQt/pkg_info.py b/NodeGraphQt/pkg_info.py index 00e6d8c8..d43c0ad6 100644 --- a/NodeGraphQt/pkg_info.py +++ b/NodeGraphQt/pkg_info.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -__version__ = '0.6.31' +__version__ = '0.6.32' __status__ = 'Work in Progress' __license__ = 'MIT'