From f9b6d4d99e3a99e35ab389fae968cfb47ddd2956 Mon Sep 17 00:00:00 2001 From: Mathieu Comandon Date: Mon, 17 Oct 2016 13:58:38 -0700 Subject: [PATCH] Fallback to list view when FlowBox is not supported --- lutris/gui/flowbox.py | 9 ++++++++- lutris/gui/lutriswindow.py | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lutris/gui/flowbox.py b/lutris/gui/flowbox.py index 8fb725960..f69fe4937 100644 --- a/lutris/gui/flowbox.py +++ b/lutris/gui/flowbox.py @@ -2,6 +2,13 @@ from lutris import pga from gi.repository import Gtk, GObject, GLib from lutris.gui.widgets import get_pixbuf_for_game +try: + FlowBox = Gtk.FlowBox + FLOWBOX_SUPPORTED = True +except AttributeError: + FlowBox = object + FLOWBOX_SUPPORTED = False + class GameItem(Gtk.VBox): def __init__(self, game, parent, icon_type='banner'): @@ -62,7 +69,7 @@ class GameItem(Gtk.VBox): self.parent.popup_contextual_menu(event, self) -class GameFlowBox(Gtk.FlowBox): +class GameFlowBox(FlowBox): __gsignals__ = { "game-selected": (GObject.SIGNAL_RUN_FIRST, None, ()), "game-activated": (GObject.SIGNAL_RUN_FIRST, None, ()), diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py index 1bd3bab00..d0eb668be 100644 --- a/lutris/gui/lutriswindow.py +++ b/lutris/gui/lutriswindow.py @@ -27,7 +27,7 @@ from lutris.gui.uninstallgamedialog import UninstallGameDialog from lutris.gui.config_dialogs import ( AddGameDialog, EditGameConfigDialog, SystemConfigDialog ) -from lutris.gui.flowbox import GameFlowBox +from lutris.gui import flowbox from lutris.gui.gameviews import ( GameListView, GameGridView, ContextualMenu, GameStore ) @@ -238,12 +238,12 @@ class LutrisWindow(Gtk.Application): gtksettings.set_property("gtk-application-prefer-dark-theme", is_dark) def get_view(self, view_type): - if view_type == 'grid': + if view_type == 'grid' and flowbox.FLOWBOX_SUPPORTED: # view_type = GameGridView(self.game_store) - return GameFlowBox(self.game_list, - icon_type=self.icon_type, - filter_installed=self.filter_installed) - elif view_type == 'list': + return flowbox.GameFlowBox(self.game_list, + icon_type=self.icon_type, + filter_installed=self.filter_installed) + else: return GameListView(self.game_store) def connect_signals(self):