Пример #1
0
 def update(self, *_args):
     self.installed_runners = [
         runner.name for runner in runners.get_installed()
     ]
     self.active_platforms = pga.get_used_platforms()
     self.invalidate_filter()
     return True
Пример #2
0
 def update(self, *args):
     self.installed_runners = [runner.name for runner in runners.get_installed()]
     self.active_platforms = pga.get_used_platforms()
     self.model_filter.refilter()
     self.expand_all()
     # Return False here because this method is called with GLib.idle_add
     return False
Пример #3
0
 def add_platforms(self):
     """No"""
     self.active_platforms = pga.get_used_platforms()
     for platform in self.active_platforms:
         menu_item = Gtk.MenuItem()
         menu_item.set_label(platform)
         menu_item.connect('activate', self.on_platform_selected, platform)
         self.menu.append(menu_item)
Пример #4
0
 def update(self, *args):
     self.installed_runners = [runner.name for runner in runners.get_installed()]
     self.update_runners_game_count(pga.get_used_runners_game_count())
     self.active_platforms = pga.get_used_platforms()
     self.update_platforms_game_count(pga.get_used_platforms_game_count())
     self.model_filter.refilter()
     self.expand_all()
     # Return False here because this method is called with GLib.idle_add
     return False
Пример #5
0
    def __init__(self, application):
        super().__init__()
        self.application = application
        self.get_style_context().add_class("sidebar")
        self.installed_runners = []
        self.active_platforms = pga.get_used_platforms()
        self.runners = sorted(runners.__all__)
        self.platforms = sorted(platforms.__all__)
        self.categories = pga.get_categories()

        GObject.add_emission_hook(RunnersDialog, "runner-installed",
                                  self.update)
        GObject.add_emission_hook(RunnersDialog, "runner-removed", self.update)
        GObject.add_emission_hook(Game, "game-updated", self.update)
        GObject.add_emission_hook(Game, "game-removed", self.update)

        load_icon_theme()

        icon = Gtk.Image.new_from_icon_name("favorite-symbolic",
                                            Gtk.IconSize.MENU)
        self.add(SidebarRow("favorite", "category", _("Favorites"), icon))

        all_row = SidebarRow(None, "runner", _("All"), None)
        self.add(all_row)
        self.select_row(all_row)
        for runner_name in self.runners:
            icon_name = runner_name.lower().replace(" ", "") + "-symbolic"
            icon = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
            runner = runners.import_runner(runner_name)()
            self.add(
                SidebarRow(runner_name,
                           "runner",
                           runner.human_name,
                           icon,
                           application=self.application))

        self.add(SidebarRow(None, "platform", _("All"), None))
        for platform in self.platforms:
            icon_name = (platform.lower().replace(" ", "").replace("/", "_") +
                         "-symbolic")
            icon = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
            self.add(SidebarRow(platform, "platform", platform, icon))

        self.set_filter_func(self._filter_func)
        self.set_header_func(self._header_func)
        self.update()
        self.show_all()
Пример #6
0
    def __init__(self):
        super().__init__()
        self.get_style_context().add_class("sidebar")
        self.installed_runners = []
        self.active_platforms = pga.get_used_platforms()
        self.runners = sorted(runners.__all__)
        self.platforms = sorted(platforms.__all__)

        GObject.add_emission_hook(RunnersDialog, "runner-installed",
                                  self.update)
        GObject.add_emission_hook(RunnersDialog, "runner-removed", self.update)
        GObject.add_emission_hook(Game, "game-updated", self.update)
        GObject.add_emission_hook(Game, "game-removed", self.update)

        # TODO: This should be in a more logical location
        icon_theme = Gtk.IconTheme.get_default()
        local_theme_path = os.path.join(datapath.get(), "icons")
        if local_theme_path not in icon_theme.get_search_path():
            icon_theme.prepend_search_path(local_theme_path)

        all_row = SidebarRow(None, "runner", "All", None)
        self.add(all_row)
        self.select_row(all_row)
        for runner in self.runners:
            icon = Gtk.Image.new_from_icon_name(
                runner.lower().replace(" ", "") + "-symbolic",
                Gtk.IconSize.MENU)
            name = runners.import_runner(runner).human_name
            self.add(SidebarRow(runner, "runner", name, icon))

        self.add(SidebarRow(None, "platform", "All", None))
        for platform in self.platforms:
            icon_name = (platform.lower().replace(" ", "").replace("/", "_") +
                         "-symbolic")
            icon = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
            self.add(SidebarRow(platform, "platform", platform, icon))

        self.set_filter_func(self._filter_func)
        self.set_header_func(self._header_func)
        self.update()
        self.show_all()
Пример #7
0
    def __init__(self):
        super().__init__()
        self.get_style_context().add_class("sidebar")
        self.installed_runners = []
        self.active_platforms = pga.get_used_platforms()
        self.runners = sorted(runners.__all__)
        self.platforms = sorted(platforms.__all__)

        GObject.add_emission_hook(RunnersDialog, "runner-installed", self.update)
        GObject.add_emission_hook(RunnersDialog, "runner-removed", self.update)
        GObject.add_emission_hook(Game, "game-updated", self.update)
        GObject.add_emission_hook(Game, "game-removed", self.update)

        # TODO: This should be in a more logical location
        icon_theme = Gtk.IconTheme.get_default()
        local_theme_path = os.path.join(datapath.get(), "icons")
        if local_theme_path not in icon_theme.get_search_path():
            icon_theme.prepend_search_path(local_theme_path)

        all_row = SidebarRow(None, "runner", "All", None)
        self.add(all_row)
        self.select_row(all_row)
        for runner in self.runners:
            icon = Gtk.Image.new_from_icon_name(
                runner.lower().replace(" ", "") + "-symbolic", Gtk.IconSize.MENU
            )
            name = runners.import_runner(runner).human_name
            self.add(SidebarRow(runner, "runner", name, icon))

        self.add(SidebarRow(None, "platform", "All", None))
        for platform in self.platforms:
            icon_name = platform.lower().replace(" ", "") + "-symbolic"
            icon = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
            self.add(SidebarRow(platform, "platform", platform, icon))

        self.set_filter_func(self._filter_func)
        self.set_header_func(self._header_func)
        self.update()
        self.show_all()
Пример #8
0
 def update(self, *args):
     self.installed_runners = [runner.name for runner in runners.get_installed()]
     self.active_platforms = pga.get_used_platforms()
     self.invalidate_filter()
Пример #9
0
 def update(self, *args):  # pylint: disable=unused-argument
     self.installed_runners = [runner.name for runner in runners.get_installed()]
     self.active_platforms = pga.get_used_platforms()
     self.invalidate_filter()
     return True