def get_usage_stats(self): """Return the usage for each version""" runner_games = get_games_by_runner(self.runner) if self.runner == "wine": runner_games += get_games_by_runner("winesteam") version_usage = defaultdict(list) for db_game in runner_games: if not db_game["installed"]: continue game = Game(db_game["id"]) version = game.config.runner_config["version"] version_usage[version].append(db_game["id"]) return version_usage
def on_show_apps_usage(self, _widget, _button, row): """Return grid with games that uses this wine version""" runner = row.runner runner_version = "%s-%s" % (runner[self.COL_VER], runner[self.COL_ARCH]) runner_games = get_games_by_runner(self.runner) apps = [] for db_game in runner_games: if not db_game["installed"]: continue game = Game(db_game["id"]) version = game.config.runner_config["version"] if version != runner_version: continue apps.append(game) dialog = ShowAppsDialog(_("Wine version usage"), self.get_toplevel(), runner_version, apps) dialog.run() dialog.destroy()