Skip to content

Commit

Permalink
Merge pull request #368 from jchanvfx/node_property_window_bugfixes
Browse files Browse the repository at this point in the history
node property window bug fixes.
  • Loading branch information
jchanvfx committed Aug 3, 2023
2 parents 04a184d + f2ce4c2 commit d9ce381
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions NodeGraphQt/custom_widgets/properties_bin/node_property_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,25 @@ def _read_node(self, node):
ports_container = _PortConnectionsContainer(self, node=node)
self.__tab.addTab(ports_container, 'Ports')

# hide empty tabs with no property widgets.
# hide/remove empty tabs with no property widgets.
tab_index = {
self.__tab.tabText(x): x for x in range(self.__tab.count())
}
current_idx = None
for tab_name, prop_window in self.__tab_windows.items():
prop_widgets = prop_window.get_all_widgets()
if not prop_widgets:
self.__tab.setTabVisible(tab_index[tab_name], False)
self.__tab.setCurrentWidget(prop_window)
# I prefer to hide the tab but in older version of pyside this
# attribute doesn't exist we'll just remove.
if hasattr(self.__tab, 'setTabVisible'):
self.__tab.setTabVisible(tab_index[tab_name], False)
else:
self.__tab.removeTab(tab_index[tab_name])
continue
if current_idx is None:
current_idx = tab_index[tab_name]

self.__tab.setCurrentIndex(current_idx)

return ports_container

Expand Down Expand Up @@ -584,8 +594,8 @@ def __init__(self, parent=None, node_graph=None):
self.resize(450, 400)

# this attribute to block signals if for the "on_property_changed" signal
# in case devs that don't implemented the ".prop_widgets_abstract.BaseProperty"
# widget is not implemented properly to prevent infinite loop.
# in case devs that don't implement the ".prop_widgets_abstract.BaseProperty"
# widget properly to prevent an infinite loop.
self._block_signal = False

self._lock = False
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.14'
__version__ = '0.6.15'
__status__ = 'Work in Progress'
__license__ = 'MIT'

Expand Down

0 comments on commit d9ce381

Please sign in to comment.