From ad33eacb8c32c6abf86e34f72860f204e48f336f Mon Sep 17 00:00:00 2001 From: Mathieu Comandon Date: Thu, 11 Jul 2013 18:15:32 +0200 Subject: [PATCH] Add custom message for N/A files --- docs/installers.rst | 37 ++++++++++++++++++++++++++++--------- lutris/installer.py | 13 +++++++++---- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/docs/installers.rst b/docs/installers.rst index 1bfd6142e..e67152d24 100644 --- a/docs/installers.rst +++ b/docs/installers.rst @@ -13,8 +13,11 @@ The ``uri`` key is equivalent to passing only a string to the installer and the ``filename`` key will be used to give the local copy another name. If the game contains copyrighted files that cannot be redistributed, the value -should be ``N\A``. When the installer encounter this value, it will prompt the -user for the location of the file. +should begin with ``N/A``. When the installer encounter this value, it will +prompt the user for the location of the file. To indicate to the user what file +to select, append a message to ``N/A`` like this: +``N/A:Please select the installer for this game`` + If the game makes use of (Windows) Steam data, the value should be ``$WINESTEAM:appid:path/to/data``. This will check that the data is available @@ -72,11 +75,11 @@ The ``move`` command cannot overwrite files. Example: :: - + move: src: game-file-id dst: $GAMEDIR/location - + Copying and merging directories ------------------------------- @@ -89,26 +92,26 @@ this into account when writing your script and order your actions accordingly. Example: :: - + merge: src: game-file-id dst: $GAMEDIR/location - + Extracting archives ------------------- Extracting archives is done with the ``extract`` directive, the ``file`` -argument is a ``file id``. If the archive should be extracted in some other +argument is a ``file id``. If the archive should be extracted in some other location than the ``$GAMEDIR``, you can specify a ``dst`` argument. -Example: +Example: :: extract: file: game-archive - dst: $GAMEDIR/datadir/ + dst: $GAMEDIR/datadir/ Making a file executable ------------------------ @@ -118,6 +121,22 @@ needed for games that ships in a zip file which does not retain file permissions Example: ``chmodx: $GAMEDIR/game_binary`` +Running a task provided by a runner +----------------------------------- + +Some actions are specific to some runners, you can call them with th ``task`` +command. You must at least provide the ``name`` parameter which is the function +that will be called. Other parameters depend on the task being called. + +Currently, the following tasks are implemented: + +wine: ``wineexec`` Runs a windows executable. Parameters are ``executable``, +``args`` (optional arguments passed to the executable), ``prefix`` (optional +WINEPREFIX). + +wine: ``winetricks`` Runs winetricks with the ``app`` argument. ``prefix`` is +an optional WINEPREFIX path. + Calling the installer ===================== diff --git a/lutris/installer.py b/lutris/installer.py index 4077eb698..d592f283a 100644 --- a/lutris/installer.py +++ b/lutris/installer.py @@ -191,9 +191,14 @@ class ScriptInterpreter(object): # Setup destination path dest_file = os.path.join(self.download_cache_path, filename) - if file_uri == "N/A": + if file_uri.startswith("N/A"): #Ask the user where is located the file - file_uri = self.parent.ask_user_for_file() + parts = file_uri.split(":", 1) + if len(parts) == 2: + message = parts[1] + else: + message = file_id + file_uri = self.parent.ask_user_for_file(message) if not file_uri: raise ScriptingError( "Can't continue installation without file", file_id @@ -599,8 +604,8 @@ class InstallerDialog(Gtk.Dialog): button.set_sensitive(False) self.interpreter.iter_game_files() - def ask_user_for_file(self): - dlg = FileDialog() + def ask_user_for_file(self, message=None): + dlg = FileDialog(message) filename = getattr(dlg, 'filename', '') return filename