From deeaf769704358fd9ac487f16e17794a666c6657 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Thu, 6 Nov 2025 14:57:38 +0100 Subject: [PATCH] change how filtering works --- .../tools/publisher/widgets/comment_input.py | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/client/ayon_core/tools/publisher/widgets/comment_input.py b/client/ayon_core/tools/publisher/widgets/comment_input.py index 9efc8db108..ce321750bc 100644 --- a/client/ayon_core/tools/publisher/widgets/comment_input.py +++ b/client/ayon_core/tools/publisher/widgets/comment_input.py @@ -15,7 +15,13 @@ from ayon_core.tools.utils import ( ) -class ValueItemButton(BaseClickableFrame): +class FilterType(Enum): + NO_MATCH = 0 + MATCH = 1 + FULL_MATCH = 2 + + +class UserValueItemButton(BaseClickableFrame): confirmed = QtCore.Signal(str) def __init__( @@ -53,6 +59,18 @@ class ValueItemButton(BaseClickableFrame): self._filtered = filtered self.setVisible(not filtered) + def check_filter(self, filter_text) -> FilterType: + if not filter_text: + return FilterType.MATCH + if filter_text == self._item.username: + return FilterType.FULL_MATCH + if ( + filter_text in self._item.username + or filter_text in self._item.full_name + ): + return FilterType.MATCH + return FilterType.NO_MATCH + def get_value(self) -> str: return self._item.username @@ -216,17 +234,18 @@ class ValueItemsView(QtWidgets.QWidget): use_first_widget = True first_visible_widget = None for widget_id, widget in self._widgets_by_id.items(): - w_value = widget.get_value() + filter_output = widget.check_filter(text) + if filter_output == FilterType.FULL_MATCH: + exact_match = True - filtered = text_l and text_l not in w_value.lower() - if not filtered: - if not exact_match: - exact_match = w_value == text + filter_matches = filter_output != FilterType.NO_MATCH + if filter_matches: if first_visible_widget is None: first_visible_widget = widget filtered_ids.add(widget_id) - widget.set_filtered(filtered) - if widget is self._last_selected_widget and not filtered: + + widget.set_filtered(filter_output == FilterType.NO_MATCH) + if widget is self._last_selected_widget and filter_matches: use_first_widget = False # There is one exact match, can stay hidden