Skip to content

Commit

Permalink
added label shown if nothing is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Aug 21, 2024
1 parent a819797 commit 1e7be78
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions client/ayon_core/tools/publisher/publish_report_viewer/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ def __init__(self, parent):

scroll_area.setWidget(scroll_content_widget)

empty_label = QtWidgets.QLabel(
"<br/><br/>Select plugins to view more information...",
scroll_content_widget
)
empty_label.setAlignment(QtCore.Qt.AlignCenter)

content_widget = QtWidgets.QWidget(scroll_content_widget)

content_layout = QtWidgets.QVBoxLayout(content_widget)
Expand All @@ -513,14 +519,18 @@ def __init__(self, parent):

scroll_content_layout = QtWidgets.QVBoxLayout(scroll_content_widget)
scroll_content_layout.setContentsMargins(0, 0, 0, 0)
scroll_content_layout.addWidget(empty_label, 0)
scroll_content_layout.addWidget(content_widget, 0)
scroll_content_layout.addStretch(1)

main_layout = QtWidgets.QVBoxLayout(self)
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.addWidget(scroll_area, 1)

content_widget.setVisible(False)

self._scroll_area = scroll_area
self._empty_label = empty_label
self._content_layout = content_layout
self._content_widget = content_widget

Expand Down Expand Up @@ -583,6 +593,7 @@ def _update_widgets(self):
# the layout and widget size hints
self._content_widget.setVisible(False)

any_visible = False
for plugin_id in self._get_plugin_ids():
widget = self._widgets_by_plugin_id.get(plugin_id)
if widget is None:
Expand All @@ -591,9 +602,14 @@ def _update_widgets(self):
self._widgets_by_plugin_id[plugin_id] = widget
self._content_layout.addWidget(widget, 0)

widget.setVisible(plugin_id in self._plugin_filter)
is_visible = plugin_id in self._plugin_filter
widget.setVisible(is_visible)
if is_visible:
any_visible = True

self._content_widget.setVisible(any_visible)
self._empty_label.setVisible(not any_visible)

self._content_widget.setVisible(True)

class DeselectableTreeView(QtWidgets.QTreeView):
"""A tree view that deselects on clicking on an empty area in the view"""
Expand Down

0 comments on commit 1e7be78

Please sign in to comment.