Commit graph

9428 commits

Author SHA1 Message Date
Daniel Johnson bcb36810dd Rework the way extra files are passed through to the installer script.
Instead of passing the extra-ids everwhere and hoping it lines up, we pass them to the installer to generate the InstallerFiles, but it provides the extra files separately.

We can then extract the download destination paths for each extra file we're downloading, and we can put those in the script.

This way, if there are more or fewer files than we expect, it will still work.

This may help with #4974, but it's hard to be sure.
2024-01-02 19:05:57 -05:00
Daniel Johnson a3c237b21f Avoid created the user's custom cache dir- we should only create our own private one if missing. 2024-01-02 04:46:57 -05:00
Daniel Johnson 70c483d8ff Fix issues with the custom cache-dir feature
The None result from get_cache_path() was leaking into the Preferences dialog, so now it never returns None - there's always ~/.cache/lutris/installer to fall back on, after all. A separate function checks if it is even configured.

Also, the sanity check for whether the custom dir even exists was inconsistently applied and would accept a file; it needs to be a directory. So now it checks with os.path.isdir().
2024-01-01 15:28:26 -05:00
Daniel Johnson 009e8cc1f2 service.get_game_platforms() should return an empty list not None; None was checked for, but treated as an empty list anyway. 2024-01-01 12:15:27 -05:00
Daniel Johnson 859b681388 None of the callers of get_runner_module() or import_runner() or import_task() check for None; so use an exception to crash with better style. 2024-01-01 10:28:47 -05:00
Daniel Johnson b047ef688d Add MissingMediaError to replace None returns from various media-loading methods
Some of these had been unchecked and would have failed anyway; others now use exception handling for fallbacks.
2024-01-01 10:19:03 -05:00
Daniel Johnson df3175d91f Replace None-returning method with a pair, one that returns bool and one that always returns a game. 2024-01-01 09:23:51 -05:00
Daniel Johnson f7991b3553 Replace Gio.ListStore with ordinary Python list for the list of running games. 2024-01-01 09:11:50 -05:00
Daniel Johnson 2bee169ed9 Replace None with empty dict; the caller should be able to handle that. 2024-01-01 08:50:40 -05:00
Daniel Johnson 0f8d89b00a Clean up exceptions and give them names ending in 'Error'.
Remove NoScreenDetected; this exception is just an if statement is disguise. We still need to handle GLib.Error though.

Rename ExtractFailure to ExtractError.

Rename AuthTokenExpired to AuthTokenExpiredError, provide a minimal message.

Replace InvalidPid with ValueError with the custom message. This is never caught, and it's misleading - it means the pid given isn't convertible to int, not that it's a valid PID.

Rename UnauthorizedAccess to UnauthorizedAccessError,
2024-01-01 08:40:06 -05:00
Daniel Johnson b6615b68d9 Fixes for ScriptingError; it should still have a message even if the repr(self.fault_data) is falsey. It should be a LutrisError for sure, too.
Remove FileNotAvailable; it's never used.

Rename MissingDependency to MissingGameDependencyError and ensure it has a message. We do put that message in the logs at least! It should be a LutrisError too.
2024-01-01 08:24:23 -05:00
Daniel Johnson 657cefedac Remove UnsupportedProvider error
This is really just an assertion and is pretty useless - we'd crash on the very next line anyway without it.

 But for documentation I'll leave a RuntimeError.
2024-01-01 08:11:48 -05:00
Daniel Johnson 051b031cb2 Remove redundant exception handler.
It's just doing what the backstop does anyway.
2024-01-01 07:40:35 -05:00
Daniel Johnson 165efbd9b1 Provide base classes for runner exceptions.
This way we need not duplicate the __init__ function in each.

Most are just LutrisError subclasses now, but InvalidRunnerError is a MisconfigurationError. I can't see a bogus runner name coming from anywhere but the configuration.
2024-01-01 07:35:27 -05:00
Daniel Johnson fd4a293f07 Rename the exception InvalidRunner to InvalidRunnerError 2024-01-01 07:29:10 -05:00
Daniel Johnson 87273c5bc0 Tighten up the typing of game.runner.
We use game.runner in many places without checking, so returning None is a bad thing here. Better to raise.

For the few places that check, I've added game.has_runner. Also added a few defensing checks and an exception handler for safety.
2024-01-01 07:28:00 -05:00
Daniel Johnson 79a31082d1 Rename "Notification" to a slightly less generic name 2023-12-31 13:02:00 -05:00
Daniel Johnson 81969e5d02 Fix updates of the list view when media are customized or reset
What an ugly mess!

queue_draw() on every window does not work on the ListView, though I don't understand why not.

This replaces that with a notification system so that the views can register callbacks to redraw themselves.

I've added a Notification class to tame this beast, in the hope that this will at least be reusable.
2023-12-31 12:08:58 -05:00
Daniel Johnson 8d665cd92a Slap a CSS class on the Steam accounts frame, so it looks like the other frames we use. 2023-12-31 07:30:45 -05:00
Daniel Johnson ad322eddca Populate the accounts and services pages in Preferences when they are selected.
It's not a big deal for the services, but we don't want a error parsing out the VDF file Steam uses to make Preference unusable.
2023-12-31 07:28:09 -05:00
Daniel Johnson 96413b3465 Generate plurals in a way that can be localized.
Lots of languages don't just append an 's'. And _(f"...") is always wrong- the string in the _() needs to be constant.
2023-12-31 07:12:11 -05:00
Daniel Johnson 88c7f276e5 Remove extra 'except' handler in get_runtime_versions_date(); handle the text in the update dialog with a separate method.
Resolves #5208
2023-12-30 19:25:44 -05:00
Daniel Johnson 53e88741ae
Merge pull request #5207 from gileri/ubisoft-translation
Untranslate Ubisoft connect
2023-12-30 10:11:47 -05:00
Daniel Johnson 030877ab61 Pause the launching animation while a modal dialog is open.
It looks a bit goofy to just cycle the animation while the launch config dialog is open, so we'll pause it.
2023-12-30 10:09:40 -05:00
gileri a02cdc6c4b
Untranslate Ubisoft connect 2023-12-30 16:00:27 +01:00
Daniel Johnson 09345bb284 Fix parse_installer_url() error handling
Returning False for bad URLS sometimes, but not always, is not sensible.

This commit makes it throw ValueError, which is what the only caller did with the False return anyway.
2023-12-30 09:56:14 -05:00
Daniel Johnson 0bba2e0986 Add French, Greek, and Polish to the locale dropdown
These also have localizations for Lutris, but I overlooked them. So, here there are.
2023-12-30 08:50:27 -05:00
Daniel Johnson 8a2290f8ed Use @cache_single for get_default_runner_version_info() too!
The trick is that we almost always call it with fixed arguments: get_default_runner_version_info("wine", None).

So, I provide a function to do just that at moving the caching there.

The remaining call to get_default_runner_version_info() is from an install() method that does lots of heavy slow things, so the caching there should not be missed.
2023-12-29 19:02:08 -08:00
Daniel Johnson e93f5e3c8a Replace every @lru_cache with @cache_single except one.
This is all the functions that have no arguments; the one leftover has arguments so @cache_single will not work.
2023-12-29 19:02:08 -08:00
Daniel Johnson 797a5f41bf Add our very own '@cache_single' decorator that caches a single result for a function with no arguments at all.
This can replace '@lru_cache' in most of our usages, and has simpler behavior. No metrics, no caching exceptions, nothing you don't absolutely need.
2023-12-29 19:02:08 -08:00
Daniel Johnson 004ddcc8e5 Fix a duplicate line, and bugged error handling.
If an error occurs downloading Lutris media, then image_refresh_cb() gets an error but no image_type, and it crashes. I'll tweak it to not crash.
2023-12-29 17:00:18 -05:00
Mathieu Comandon 6d7a65ac9c Ok, I sort of see why but we should really consider another solution 2023-12-28 21:20:40 -08:00
Mathieu Comandon 215df1720e why 2023-12-28 21:12:27 -08:00
Mathieu Comandon 75c9eab9ae Download media during identifier change in background 2023-12-28 21:08:57 -08:00
Mathieu Comandon 82aadf18fa Save custom images in background 2023-12-28 20:57:25 -08:00
Mathieu Comandon 5e1a73836b Rename confusing method: 2023-12-28 20:47:21 -08:00
Mathieu Comandon 2b514989e0 Run media reset in background 2023-12-28 20:41:48 -08:00
Daniel Johnson ae8f654779 Yeah, I can use AsyncCall. If I have to. I guess.
The uninstall-game dialog computes folder sizes one at  time. With this commit, it updates the UI for each one as it completes, instead of waiting for the whole set to be done.

 Looks nicer this way.
2023-12-28 18:40:40 -05:00
Mathieu Comandon 4e81e3634f Move Image.BICUBIC to Image.Resampling.BICUBIC 2023-12-28 15:38:09 -08:00
Mathieu Comandon 088c325b29 Formatting 2023-12-28 15:29:59 -08:00
Mathieu Comandon 85444a0b77 Rename common.py to game_common.py 2023-12-28 15:29:42 -08:00
Mathieu Comandon 48affb629b Use install type in Flathub installer to avoid crashing installers 2023-12-28 15:15:31 -08:00
Mathieu Comandon 8a58717444 Fix condition for binary requirement 2023-12-28 15:15:31 -08:00
Daniel Johnson dc74685f38 Remove incorrect usage of gtk_safe()
We only need to when we are providing markup to GTK; titles aren't markup.
2023-12-28 17:13:34 -05:00
Mathieu Comandon 8758602e08 Filter out 'Bad file descriptor' messages 2023-12-27 16:53:19 -08:00
Daniel Johnson 04577a960e Remove the generation of generic GameConfigError based on the "error" in the game_info.
There should never be such a key in the game_info; it's all exceptions now.
2023-12-27 18:43:20 -05:00
Daniel Johnson 0ce76eed22 And the big one - replace the FILE_NOT_FOUND error code with an exception, MissingGameExecutableError, that provides the custom message. 2023-12-27 18:41:08 -05:00
Daniel Johnson bc902394b0 Replace DIRECTORY_NOT_FOUND errors with exceptions.
We didn't have handing, so this was an "unknown error". I'll borrow the handling from easyrpg so you can get a better message here.
2023-12-27 18:22:33 -05:00
Daniel Johnson 21694376ce Remove "CUSTOM" error code in favor of raising GameConfigError. 2023-12-27 18:20:01 -05:00
Daniel Johnson d5de4465f4 Retire "PATH_NOT_SET", "NOT_EXECUTABLE" and "NO_BIOS" in error codes in favor of exceptions.
Only NO_BIOS gets its own exception class, as its hte only one raised in more than one place. This way we can avoid repeating the message.

                elif error == "NO_BIOS":
            message_text = _("A bios file is required to run this game")
2023-12-27 18:07:05 -05:00