1
0
mirror of https://github.com/lutris/lutris synced 2024-07-05 08:28:41 +00:00

Add custom message for N/A files

This commit is contained in:
Mathieu Comandon 2013-07-11 18:15:32 +02:00
parent 34bb62c8c1
commit ad33eacb8c
2 changed files with 37 additions and 13 deletions

View File

@ -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
=====================

View File

@ -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