mirror of
https://github.com/lutris/lutris
synced 2024-10-04 14:59:37 +00:00
Add tooltips to explain search terms a bit
This commit is contained in:
parent
ce8961fce2
commit
7d38dd032d
|
@ -123,12 +123,13 @@ class GameDialogCommon(SavableModelessDialog, DialogInstallUIDelegate):
|
|||
show_search = current_page_index in self.searchable_page_indices
|
||||
self.set_search_entry_visibility(show_search)
|
||||
|
||||
def set_search_entry_visibility(self, show_search, placeholder_text=None):
|
||||
def set_search_entry_visibility(self, show_search, placeholder_text=None, tooltip_markup=None):
|
||||
"""Explicitly shows or hides the search entry; can also update the placeholder text."""
|
||||
header_bar = self.get_header_bar()
|
||||
if show_search and self.search_entry:
|
||||
header_bar.set_custom_title(self.search_entry)
|
||||
self.search_entry.set_placeholder_text(placeholder_text or self.get_search_entry_placeholder())
|
||||
self.search_entry.set_tooltip_markup(tooltip_markup)
|
||||
else:
|
||||
header_bar.set_custom_title(None)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# pylint: disable=no-member
|
||||
from gettext import gettext as _
|
||||
from textwrap import dedent
|
||||
|
||||
from gi.repository import GObject, Gtk
|
||||
|
||||
|
@ -91,7 +92,15 @@ class PreferencesDialog(GameDialogCommon):
|
|||
if stack_id == "system-stack":
|
||||
self.set_search_entry_visibility(True)
|
||||
elif stack_id == "runners-stack":
|
||||
self.set_search_entry_visibility(True, self.runners_box.search_entry_placeholder_text)
|
||||
tooltip_markup = """
|
||||
Enter the name or description of a runner to search for, or use search terms:
|
||||
|
||||
<b>installed:</b><i>true</i> Only installed runners.
|
||||
"""
|
||||
tooltip_markup = dedent(tooltip_markup).strip()
|
||||
self.set_search_entry_visibility(
|
||||
True, self.runners_box.search_entry_placeholder_text, tooltip_markup=tooltip_markup
|
||||
)
|
||||
else:
|
||||
self.set_search_entry_visibility(False)
|
||||
|
||||
|
|
|
@ -305,6 +305,15 @@
|
|||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="tooltip-markup" translatable="yes">Enter the name of a game to search for, or use search terms:
|
||||
|
||||
<b>installed:</b><i>true</i> Only installed games.
|
||||
<b>hidden:</b><i>true</i> Only hidden games.
|
||||
<b>favorite:</b><i>true</i> Only favorite games.
|
||||
<b>category:</b><i>x</i> Only games in cateogry <i>x</i>.
|
||||
<b>runner:</b><i>wine</i> Only Wine games
|
||||
<b>platform:</b><i>windows</i> Only Windows games
|
||||
<b>playtime:</b><i>&gt;2 hours</i> Only games played for more than 2 hours.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="width-chars">30</property>
|
||||
|
|
Loading…
Reference in a new issue