Example #1
0
 def on_load(self, widget, data=None):
     """Finish initializing the view"""
     self.redraw_view()
     self._bind_zoom_adjustment()
     self.view.grab_focus()
     self.view.contextual_menu = ContextualMenu(
         self.game_actions.get_game_actions())
Example #2
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)
Example #3
0
 def on_load(self, widget, data):
     self.game_store = GameStore(self.service_media)
     self.switch_view()
     self.view.grab_focus()
     self.view.contextual_menu = ContextualMenu(
         self.game_actions.get_game_actions())
     self.update_runtime()
Example #4
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
Example #5
0
 def on_load(self, widget, data):
     self.game_store = GameStore(self.service_media)
     self.redraw_view()
     self._bind_zoom_adjustment()
     self.view.grab_focus()
     self.view.contextual_menu = ContextualMenu(
         self.game_actions.get_game_actions())
     self.update_runtime()
Example #6
0
    def redraw_view(self):
        """Completely reconstruct the main view"""
        if self.view:
            self.view.destroy()
        self.reload_service_media()

        view_class = GameGridView if self.view_type == "grid" else GameListView
        self.view = view_class(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()
Example #7
0
    def switch_view(self, view_type=None):
        """Switch between grid view and list view."""
        if self.view:
            self.view.destroy()
            logger.debug("View destroyed")
        self.reload_service_media()
        view_class = GameGridView if self.view_type == "grid" else GameListView
        self.view = view_class(self.game_store, self.game_store.service_media)

        self.view.connect("game-selected", self.on_game_selection_changed)
        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)

        if view_type:
            self.set_viewtype_icon(view_type)
            settings.write_setting("view_type", view_type)

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