update dxvk_versions once per lutris instance at the first acess of config dialog

This commit is contained in:
Nbiba Bedis 2018-11-03 13:39:31 +01:00 committed by Mathieu Comandon
parent f3382af435
commit a49d53c8e3
3 changed files with 7 additions and 9 deletions

View file

@ -37,7 +37,6 @@ from lutris.services.steam import AppManifest, get_appmanifests, get_steamapps_p
from lutris.settings import read_setting, VERSION
from lutris.thread import exec_in_thread
from lutris.util import datapath
from lutris.util.dxvk import init_dxvk_versions
from lutris.util.log import logger
from lutris.util.resources import parse_installer_url
@ -55,7 +54,6 @@ class Application(Gtk.Application):
gettext.textdomain("lutris")
check_config()
init_dxvk_versions()
migrate()
update_platforms()

View file

@ -21,6 +21,7 @@ from lutris.util.system import open_uri
from lutris.util import http
from lutris.util import datapath
from lutris.util.steam import SteamWatcher
from lutris.util.dxvk import init_dxvk_versions
from lutris.services import get_services_synced_at_startup, steam, xdg
@ -166,7 +167,8 @@ class LutrisWindow(Gtk.ApplicationWindow):
self.steam_watcher = SteamWatcher(steamapps_paths, self.on_steam_game_changed)
self.gui_needs_update = True
self.config_menu_first_access = True
def _init_actions(self):
Action = namedtuple('Action', ('callback', 'type', 'enabled', 'default', 'accel'))
Action.__new__.__defaults__ = (None, None, True, None, None)
@ -783,6 +785,9 @@ class LutrisWindow(Gtk.ApplicationWindow):
def on_edit_game_configuration(self, _widget):
"""Edit game preferences"""
if self.config_menu_first_access:
self.config_menu_first_access = False
init_dxvk_versions()
game = Game(self.view.selected_game)
def on_dialog_saved():

View file

@ -31,12 +31,7 @@ def get_dxvk_versions():
os.mkdir(dxvk_path)
versions_path = os.path.join(dxvk_path, 'dxvk_versions.json')
# Download tags if the versions_path does not exist or is more than a day old
if (
not system.path_exists(versions_path) or
os.path.getmtime(versions_path) + CACHE_MAX_AGE < time.time()
):
urllib.request.urlretrieve(DXVK_TAGS_URL, versions_path)
urllib.request.urlretrieve(DXVK_TAGS_URL, versions_path)
with open(versions_path, "r") as dxvk_tags:
dxvk_json = json.load(dxvk_tags)