Fallback to list view when FlowBox is not supported

This commit is contained in:
Mathieu Comandon 2016-10-17 13:58:38 -07:00
parent e21c04240b
commit f9b6d4d99e
2 changed files with 14 additions and 7 deletions

View file

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

View file

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