Ejemplo n.º 1
0
    def on_locate_installed_game(self, _button, game):
        """Show the user a dialog to import an existing install to a DRM free service

        Params:
            game (Game): Game instance without a database ID, populated with a fields the service can provides
        """
        AddGameDialog(self.window, game=game)
Ejemplo n.º 2
0
    def run_no_installer_dialog(self):
        """Open dialog for 'no script available' situation."""
        dlg = NoInstallerDialog(self)
        if dlg.result == dlg.MANUAL_CONF:
            game_data = pga.get_game_by_field(self.game_slug, "slug")

            if game_data and "slug" in game_data:
                # Game data already exist locally.
                game = Game(game_data["id"])
            else:
                # Try to load game data from remote.
                games = api.get_api_games([self.game_slug])

                if games and len(games) >= 1:
                    remote_game = games[0]
                    game_data = {
                        "name": remote_game["name"],
                        "slug": remote_game["slug"],
                        "year": remote_game["year"],
                        "updated": remote_game["updated"],
                        "steamid": remote_game["steamid"],
                    }
                    game = Game(pga.add_game(**game_data))
                else:
                    game = None
            AddGameDialog(self.parent, game=game)
        elif dlg.result == dlg.NEW_INSTALLER:
            webbrowser.open(settings.GAME_URL % self.game_slug)
Ejemplo n.º 3
0
 def on_add_game_button_clicked(self, *_args):
     """Add a new game manually with the AddGameDialog."""
     if "runner" in self.filters:
         runner = self.filters["runner"]
     else:
         runner = None
     AddGameDialog(self, runner=runner)
     return True
Ejemplo n.º 4
0
 def on_add_game_button_clicked(self, *_args):
     """Add a new game manually with the AddGameDialog."""
     self.add_popover.hide()
     dialog = AddGameDialog(
         self,
         runner=self.selected_runner,
         callback=lambda: self.game_store.add_game_by_id(dialog.game.id),
     )
     return True
Ejemplo n.º 5
0
 def on_add_game_button_clicked(self, *_args):
     """Add a new game manually with the AddGameDialog."""
     self.add_popover.hide()
     init_dxvk_versions()
     dialog = AddGameDialog(
         self,
         runner=self.selected_runner,
         callback=lambda: self.add_game_to_view(dialog.game.id),
     )
     return True
Ejemplo n.º 6
0
    def on_add_manually(self, _widget, *_args):
        """Callback that presents the Add game dialog"""
        def on_game_added(game):
            self.window.game_store.update(game)
            self.window.sidebar_listbox.update()

        AddGameDialog(
            self.window,
            game=self.game,
            runner=self.game.runner_name,
            callback=lambda: on_game_added(self.game),
        )
Ejemplo n.º 7
0
    def on_add_manually(self, _widget, *_args):
        """Callback that presents the Add game dialog"""
        def on_game_added(game):
            self.window.view.set_installed(game)
            GLib.idle_add(resources.fetch_icon, game.slug,
                          self.window.on_image_downloaded)
            self.window.sidebar_listbox.update()

        AddGameDialog(
            self.window,
            game=self.game,
            runner=self.game.runner_name,
            callback=lambda: on_game_added(self.game),
        )
Ejemplo n.º 8
0
    def manually_configure_game(self):
        game_data = pga.get_game_by_field(self.game_slug, "slug")

        if game_data and "slug" in game_data:
            # Game data already exist locally.
            game = Game(game_data["id"])
        else:
            # Try to load game data from remote.
            games = api.get_api_games([self.game_slug])

            if games and len(games) >= 1:
                remote_game = games[0]
                game_data = {
                    "name": remote_game["name"],
                    "slug": remote_game["slug"],
                    "year": remote_game["year"],
                    "updated": remote_game["updated"],
                    "steamid": remote_game["steamid"],
                }
                game = Game(pga.add_game(**game_data))
            else:
                game = None
        AddGameDialog(self.parent, game=game)
Ejemplo n.º 9
0
 def on_add_manually(self, _widget, *_args):
     """Callback that presents the Add game dialog"""
     return AddGameDialog(self.window, game=self.game, runner=self.game.runner_name)
Ejemplo n.º 10
0
 def on_add_game_button_clicked(self, *_args):
     """Add a new game manually with the AddGameDialog."""
     self.add_popover.hide()
     AddGameDialog(self, runner=self.selected_runner)
     return True
Ejemplo n.º 11
0
 def setUp(self):
     init_lutris()
     lutris_application = Application()
     lutris_window = lutris_application.window
     self.dlg = AddGameDialog(lutris_window)
Ejemplo n.º 12
0
 def setUp(self):
     check_config()
     lutris_application = Application()
     lutris_window = lutris_application.window
     self.dlg = AddGameDialog(lutris_window)
Ejemplo n.º 13
0
 def add_local_game(self):
     """Manually configure game"""
     AddGameDialog(None)
     self.destroy()