Exemplo n.º 1
0
    def redraw_view(self):
        """Completely reconstruct the main view"""
        if not self.game_store:
            logger.error("No game store yet")
            return
        if self.view:
            self.view.destroy()
        self.game_store = GameStore(self.service, self.service_media)
        if self.view_type == "grid":
            self.view = GameGridView(self.game_store,
                                     self.game_store.service_media,
                                     hide_text=settings.read_setting(
                                         "hide_text_under_icons") == "True")
        else:
            self.view = GameListView(self.game_store,
                                     self.game_store.service_media)

        self.view.connect("game-selected", self.on_game_selection_changed)
        self.view.connect("game-activated", self.on_game_activated)
        self.view.contextual_menu = ContextualMenu(
            self.game_actions.get_game_actions())
        for child in self.games_scrollwindow.get_children():
            child.destroy()
        self.games_scrollwindow.add(self.view)

        self.view.show_all()
        self.view.grab_focus()
        GLib.idle_add(self.update_store)
Exemplo n.º 2
0
    def redraw_view(self):
        """Completely reconstruct the main view"""
        if self.view:
            self.view.destroy()
        self.reload_service_media()

        if self.view_type == "grid":
            self.view = GameGridView(self.game_store,
                                     self.game_store.service_media,
                                     hide_text=settings.read_setting(
                                         "hide_text_under_icons") == "True")
        else:
            self.view = GameListView(self.game_store,
                                     self.game_store.service_media)

        self.view.connect("game-selected", self.on_game_selection_changed)
        self.view.connect("game-activated", self.on_game_activated)
        self.view.contextual_menu = ContextualMenu(
            self.game_actions.get_game_actions())
        for child in self.games_scrollwindow.get_children():
            child.destroy()
        self.games_scrollwindow.add(self.view)
        self.connect("view-updated", self.update_store)

        self.view.show_all()
        self.update_store()

        if self.current_view_type == 'grid':
            self.view.select_path(
                Gtk.TreePath('0'))  # needed for gridview only
        self.view.set_cursor(Gtk.TreePath('0'), None,
                             False)  # needed for both view types
Exemplo n.º 3
0
 def get_view(self, view_type):
     """Return the appropriate widget for the current view"""
     if view_type == "grid":
         return GameGridView(self.game_store)
     return GameListView(self.game_store)