mirror of
https://github.com/lutris/lutris
synced 2024-10-14 19:53:53 +00:00
Move search entry to the top bar
This commit is contained in:
parent
f1fb952cfa
commit
e3fdf904ed
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,6 +8,7 @@ build
|
||||||
tags
|
tags
|
||||||
*.pyc
|
*.pyc
|
||||||
*.pyo
|
*.pyo
|
||||||
|
*.ui~
|
||||||
PYSMELLTAGS
|
PYSMELLTAGS
|
||||||
lutris.e4p
|
lutris.e4p
|
||||||
.coverage
|
.coverage
|
||||||
|
|
|
@ -629,11 +629,13 @@ class LutrisWindow(Gtk.ApplicationWindow): # pylint: disable=too-many-public-me
|
||||||
def on_search_toggle(self, button):
|
def on_search_toggle(self, button):
|
||||||
"""Called when search bar is shown / hidden"""
|
"""Called when search bar is shown / hidden"""
|
||||||
active = button.props.active
|
active = button.props.active
|
||||||
self.search_revealer.set_reveal_child(active)
|
# self.search_revealer.set_reveal_child(active)
|
||||||
if active:
|
if active:
|
||||||
|
self.search_entry.show()
|
||||||
self.search_entry.grab_focus()
|
self.search_entry.grab_focus()
|
||||||
else:
|
else:
|
||||||
self.search_entry.props.text = ""
|
self.search_entry.props.text = ""
|
||||||
|
self.search_entry.hide()
|
||||||
|
|
||||||
@GtkTemplate.Callback
|
@GtkTemplate.Callback
|
||||||
def on_about_clicked(self, *_args):
|
def on_about_clicked(self, *_args):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from lutris.game import Game
|
from lutris.game import Game
|
||||||
from lutris.gui.widgets.utils import get_pixbuf_for_game
|
from lutris.gui.widgets.utils import get_pixbuf_for_game, get_pixbuf
|
||||||
from lutris.runners import RUNNER_NAMES
|
from lutris.runners import RUNNER_NAMES
|
||||||
from lutris.util.log import logger
|
from lutris.util.log import logger
|
||||||
from lutris.util.strings import get_formatted_playtime, gtk_safe
|
from lutris.util.strings import get_formatted_playtime, gtk_safe
|
||||||
|
@ -75,6 +75,8 @@ class GameItem:
|
||||||
|
|
||||||
def get_pixbuf(self, icon_type):
|
def get_pixbuf(self, icon_type):
|
||||||
"""Pixbuf varying on icon type"""
|
"""Pixbuf varying on icon type"""
|
||||||
|
if self._pga_data.get("icon"):
|
||||||
|
return get_pixbuf(self._pga_data["icon"], (96, 96))
|
||||||
return get_pixbuf_for_game(self._pga_data["slug"], icon_type, self._pga_data["installed"])
|
return get_pixbuf_for_game(self._pga_data["slug"], icon_type, self._pga_data["installed"])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -71,11 +71,6 @@ class SteamSyncer:
|
||||||
self._lutris_games = None
|
self._lutris_games = None
|
||||||
self._lutris_steamids = None
|
self._lutris_steamids = None
|
||||||
|
|
||||||
@property
|
|
||||||
def runner(self):
|
|
||||||
"""Return the appropriate runner for the platform"""
|
|
||||||
return "steam" if self.platform == "linux" else "winesteam"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lutris_games(self):
|
def lutris_games(self):
|
||||||
"""Return all Steam games present in the Lutris library"""
|
"""Return all Steam games present in the Lutris library"""
|
||||||
|
@ -108,7 +103,7 @@ class SteamSyncer:
|
||||||
for pga_game in self.lutris_games:
|
for pga_game in self.lutris_games:
|
||||||
if (
|
if (
|
||||||
str(pga_game["steamid"]) == game.appid
|
str(pga_game["steamid"]) == game.appid
|
||||||
and (pga_game["runner"] == self.runner or not pga_game["runner"]) and not pga_game["installed"]
|
and (pga_game["runner"] == game.runner or not pga_game["runner"]) and not pga_game["installed"]
|
||||||
):
|
):
|
||||||
return pga_game
|
return pga_game
|
||||||
|
|
||||||
|
@ -125,25 +120,10 @@ class SteamSyncer:
|
||||||
if (steamid in self.lutris_steamids and pga_game["installed"] != 1 and pga_game["installed"]):
|
if (steamid in self.lutris_steamids and pga_game["installed"] != 1 and pga_game["installed"]):
|
||||||
added_games.append(game.install())
|
added_games.append(game.install())
|
||||||
|
|
||||||
if steamid not in self.lutris_steamids:
|
|
||||||
added_games.append(game.install())
|
|
||||||
else:
|
|
||||||
if pga_game:
|
|
||||||
added_games.append(game.install(pga_game))
|
|
||||||
|
|
||||||
if not full:
|
if not full:
|
||||||
return added_games, games
|
return added_games, games
|
||||||
|
|
||||||
removed_games = []
|
removed_games = []
|
||||||
unavailable_ids = self.lutris_steamids.difference(available_ids)
|
|
||||||
for steamid in unavailable_ids:
|
|
||||||
for pga_game in self.lutris_games:
|
|
||||||
if (
|
|
||||||
str(pga_game["steamid"]) == steamid and pga_game["installed"] and pga_game["runner"] == self.runner
|
|
||||||
):
|
|
||||||
game = SteamGame.new_from_lutris_id(pga_game["id"])
|
|
||||||
game.uninstall()
|
|
||||||
removed_games.append(pga_game["id"])
|
|
||||||
return (added_games, removed_games)
|
return (added_games, removed_games)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -652,20 +652,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchEntry" id="search_entry">
|
<placeholder/>
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="halign">center</property>
|
|
||||||
<property name="valign">center</property>
|
|
||||||
<property name="width_chars">30</property>
|
|
||||||
<property name="placeholder_text" translatable="yes">Search games</property>
|
|
||||||
<signal name="search-changed" handler="on_search_entry_changed" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinner" id="search_spinner">
|
<object class="GtkSpinner" id="search_spinner">
|
||||||
|
@ -946,6 +933,20 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSearchEntry" id="search_entry">
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">center</property>
|
||||||
|
<property name="width_chars">30</property>
|
||||||
|
<property name="placeholder_text" translatable="yes">Search games</property>
|
||||||
|
<signal name="search-changed" handler="on_search_entry_changed" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="pack_type">end</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in a new issue