Skip to content

Commit

Permalink
include brief note on plugins tab if there's no check parameters to s…
Browse files Browse the repository at this point in the history
…how (eg; if the user hasn't selected any checks)

without this the user was shown a blank tab; not the best UX
  • Loading branch information
lachlanhurst committed May 2, 2024
1 parent ae01aa3 commit 1189b62
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hyo2/qax/app/widgets/qax/plugin_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def set_selected_checks(self, checks: list[QaxCheckReference]):
if widget:
widget.deleteLater()

# track whether we've added any checks on this plugin tab
no_checks_added = True
for check in self.plugin.checks():
# we only add check widgets for the checks that have been selected
selected_check = next((x for x in checks if x.id == check.id), None)
Expand All @@ -94,6 +96,11 @@ def set_selected_checks(self, checks: list[QaxCheckReference]):
check_widget.check_changed.connect(self._on_check_changed)
self.layout_checks.addWidget(check_widget)
self.check_widgets.append(check_widget)
no_checks_added = False

if no_checks_added:
nothing_label = QtWidgets.QLabel("No checks have been selected for this plugin")
self.layout_checks.addWidget(nothing_label)

self.layout_checks.addStretch(1)

Expand Down

0 comments on commit 1189b62

Please sign in to comment.