Repository: lutris/lutris
Pull request: Silence bogus "Could not retrieve game installer" dialog
This removes two bogus error reports - one is a dialog, the other a log message.

The offending code treats 'None' coming back from the install() method of a game service as an 'installer not found' error, but this is not correct. This method returns 'None' when it has starting an installation, but it is still ongoing.

This PR also adds a comment on the base-class install() method to explain this behavior.

Resolves #3853

Problem statement:
"Could not retrieve game installer" when trying to install a game from EGS source
Whenever I try to install a game through the Epic Games source, I always get a "Could not retrieve game installer" when the installer window pops up. After I close it (which seems to put the installer window to foreground for some reason, very annoying), I can install EGS just fine.

Hints from issue discussion:

Commit message: Merge branch 'lutris:master' into dj/could-not-retrieve

Patch to review:
diff --git a/lutris/gui/application.py b/lutris/gui/application.py
index 2fbdf1309b..896ad593e8 100644
--- a/lutris/gui/application.py
+++ b/lutris/gui/application.py
@@ -502,8 +502,6 @@ def on_game_install(self, game):
             if game_id:
                 game = Game(game_id)
                 game.launch()
-            else:
-                ErrorDialog(message=_("Could not retrieve game installer."), parent=self.window)
             return True
         if not game.slug:
             raise ValueError("Invalid game passed: %s" % game)
diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py
index 2185032a96..0378557421 100644
--- a/lutris/gui/lutriswindow.py
+++ b/lutris/gui/lutriswindow.py
@@ -808,7 +808,6 @@ def on_game_collection_changed(self, _sender):
 
     def on_game_activated(self, view, game_id):
         """Handles view activations (double click, enter press)"""
-        initial_game_id = game_id
         if self.service:
             logger.debug("Looking up %s game %s", self.service.id, game_id)
             db_game = games_db.get_game_for_service(self.service.id, game_id)
@@ -837,5 +836,3 @@ def on_game_activated(self, view, game_id):
                 game.emit("game-launch")
             else:
                 game.emit("game-install")
-        else:
-            logger.warning("No game found for %s", initial_game_id)
diff --git a/lutris/services/base.py b/lutris/services/base.py
index e0efdfcea7..9aed1f0d75 100644
--- a/lutris/services/base.py
+++ b/lutris/services/base.py
@@ -184,7 +184,17 @@ def get_installers_from_api(self, appid):
         return service_installers
 
     def install(self, db_game):
-        """Install a service game"""
+        """Install a service game, or starts the installer of the game.
+
+        Args:
+            db_name (dict or str): Database fields of the game to add, or (for Lutris service only
+                the slug of the game.)
+
+        Returns:
+            str: The slug of the game that was installed, to be run. None if the game should not be
+                run now. Many installers start from here, but continue running after this returns;
+                they return None.
+        """
         appid = db_game["appid"]
         logger.debug("Installing %s from service %s", appid, self.id)
         if self.local:


Code review comments:
diff_hunk: @@ -184,7 +184,17 @@ def get_installers_from_api(self, appid):
         return service_installers
 
     def install(self, db_game):
-        """Install a service game"""
+        """Install a service game, or starts the installer of the game.
+
+        Args:
+            db_name (dict or str): Database fields of the game to add, or (for Lutris service only
path: lutris/services/base.py
text: @user1:
db_**g**ame