1
0
mirror of https://github.com/lutris/lutris synced 2024-07-08 19:45:47 +00:00

Move search entry to the top bar

This commit is contained in:
Mathieu Comandon 2020-08-10 01:21:51 -07:00 committed by Mathieu Comandon
parent f1fb952cfa
commit e3fdf904ed
5 changed files with 23 additions and 37 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ build
tags
*.pyc
*.pyo
*.ui~
PYSMELLTAGS
lutris.e4p
.coverage

View File

@ -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):

View File

@ -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

View File

@ -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)

View File

@ -652,20 +652,7 @@
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<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>
<placeholder/>
</child>
<child>
<object class="GtkSpinner" id="search_spinner">
@ -946,6 +933,20 @@
<property name="position">1</property>
</packing>
</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>
</child>
</template>