From e3fdf904edb8561912b04e870700e7b375d6902a Mon Sep 17 00:00:00 2001 From: Mathieu Comandon Date: Mon, 10 Aug 2020 01:21:51 -0700 Subject: [PATCH] Move search entry to the top bar --- .gitignore | 1 + lutris/gui/lutriswindow.py | 4 +++- lutris/gui/views/pga_game.py | 4 +++- lutris/services/steam.py | 22 +--------------------- share/lutris/ui/lutris-window.ui | 29 +++++++++++++++-------------- 5 files changed, 23 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index 69d4ba916..2ed23898f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ build tags *.pyc *.pyo +*.ui~ PYSMELLTAGS lutris.e4p .coverage diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py index 232d488b7..efba2b3a7 100644 --- a/lutris/gui/lutriswindow.py +++ b/lutris/gui/lutriswindow.py @@ -629,11 +629,13 @@ class LutrisWindow(Gtk.ApplicationWindow): # pylint: disable=too-many-public-me def on_search_toggle(self, button): """Called when search bar is shown / hidden""" active = button.props.active - self.search_revealer.set_reveal_child(active) + # self.search_revealer.set_reveal_child(active) if active: + self.search_entry.show() self.search_entry.grab_focus() else: self.search_entry.props.text = "" + self.search_entry.hide() @GtkTemplate.Callback def on_about_clicked(self, *_args): diff --git a/lutris/gui/views/pga_game.py b/lutris/gui/views/pga_game.py index 05e2afa48..6d4dce93d 100644 --- a/lutris/gui/views/pga_game.py +++ b/lutris/gui/views/pga_game.py @@ -2,7 +2,7 @@ import time 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.util.log import logger from lutris.util.strings import get_formatted_playtime, gtk_safe @@ -75,6 +75,8 @@ class GameItem: def get_pixbuf(self, 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"]) @property diff --git a/lutris/services/steam.py b/lutris/services/steam.py index af2fb9298..2671857c6 100644 --- a/lutris/services/steam.py +++ b/lutris/services/steam.py @@ -71,11 +71,6 @@ class SteamSyncer: self._lutris_games = 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 def lutris_games(self): """Return all Steam games present in the Lutris library""" @@ -108,7 +103,7 @@ class SteamSyncer: for pga_game in self.lutris_games: if ( 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 @@ -125,25 +120,10 @@ class SteamSyncer: if (steamid in self.lutris_steamids and pga_game["installed"] != 1 and pga_game["installed"]): 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: return added_games, 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) diff --git a/share/lutris/ui/lutris-window.ui b/share/lutris/ui/lutris-window.ui index da226200b..94cf7e7d9 100644 --- a/share/lutris/ui/lutris-window.ui +++ b/share/lutris/ui/lutris-window.ui @@ -652,20 +652,7 @@ False 12 - - True - True - center - center - 30 - Search games - - - - False - False - 0 - + @@ -946,6 +933,20 @@ 1 + + + True + center + center + 30 + Search games + + + + end + 2 + +