mirror of
https://github.com/lutris/lutris
synced 2024-10-14 19:53:53 +00:00
Remove extra 'except' handler in get_runtime_versions_date(); handle the text in the update dialog with a separate method.
Resolves #5208
This commit is contained in:
parent
53e88741ae
commit
88c7f276e5
|
@ -8,6 +8,7 @@ import urllib.error
|
|||
import urllib.parse
|
||||
import urllib.request
|
||||
from collections import OrderedDict
|
||||
from gettext import gettext as _
|
||||
from typing import Any, Dict
|
||||
|
||||
import requests
|
||||
|
@ -18,6 +19,7 @@ from lutris.util.display import get_gpus_info
|
|||
from lutris.util.http import HTTPError, Request
|
||||
from lutris.util.linux import LINUX_SYSTEM
|
||||
from lutris.util.log import logger
|
||||
from lutris.util.strings import time_ago
|
||||
|
||||
API_KEY_FILE_PATH = os.path.join(settings.CACHE_DIR, "auth-token")
|
||||
USER_INFO_FILE_PATH = os.path.join(settings.CACHE_DIR, "user.json")
|
||||
|
@ -29,10 +31,14 @@ def get_time_from_api_date(date_string):
|
|||
|
||||
|
||||
def get_runtime_versions_date() -> float:
|
||||
return os.path.getmtime(settings.RUNTIME_VERSIONS_PATH)
|
||||
|
||||
|
||||
def get_runtime_versions_date_time_ago() -> str:
|
||||
try:
|
||||
return os.path.getmtime(settings.RUNTIME_VERSIONS_PATH)
|
||||
return time_ago(get_runtime_versions_date())
|
||||
except FileNotFoundError:
|
||||
return 0.0
|
||||
return _("never")
|
||||
|
||||
|
||||
def check_stale_runtime_versions() -> bool:
|
||||
|
|
|
@ -5,7 +5,7 @@ from typing import Callable
|
|||
from gi.repository import Gio, Gtk
|
||||
|
||||
from lutris import settings
|
||||
from lutris.api import get_runtime_versions_date
|
||||
from lutris.api import get_runtime_versions_date_time_ago
|
||||
from lutris.gui.config.base_config_box import BaseConfigBox
|
||||
from lutris.gui.dialogs import NoticeDialog
|
||||
from lutris.runtime import RuntimeUpdater
|
||||
|
@ -88,7 +88,7 @@ class UpdatesBox(BaseConfigBox):
|
|||
update_label_text = _(
|
||||
"Your wine version is up to date. Using: <b>%s</b>\n"
|
||||
"<i>Last checked %s.</i>"
|
||||
) % (wine_version_info['version'], time_ago(get_runtime_versions_date()))
|
||||
) % (wine_version_info['version'], get_runtime_versions_date_time_ago())
|
||||
update_button_text = _("Check again")
|
||||
elif not system.path_exists(os.path.join(settings.RUNNER_DIR, "wine")):
|
||||
update_label_text = _(
|
||||
|
|
Loading…
Reference in a new issue