diff --git a/CHANGELOG.md b/CHANGELOG.md index 85bd68d..ef0913c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ - Play offline (load mods directly) - Generate Steam shortcuts and cover art - Warn user if background downloads are disabled +- Dynamic copy button ### Changed - Conform to PEP 440 versioning for beta versions @@ -63,6 +64,7 @@ - Propagate subscribed mods to Steam client ### Dropped +- Battlemetrics API support - Debug mode - Branch switching - Manual mod install mode (describe rationale) @@ -73,6 +75,7 @@ - Center server title text on server dialogs - Rare segfaults when changing maps (threading) - Moved dialogs out of threads +- History table not being in lock-step with state file ### Unreleased - Load offline mods diff --git a/dzgui/model/proxy_model.py b/dzgui/model/proxy_model.py index bc5e02d..c07a711 100644 --- a/dzgui/model/proxy_model.py +++ b/dzgui/model/proxy_model.py @@ -85,8 +85,8 @@ class ProxyModelManager: if found is False: self.control_model.append(history) - # if len(self.control_model) == 11: - # del self.control_model[0] + if len(self.control_model) == 11: + del self.control_model[0] self.filter(FilterMode.INITIAL, skip_cache=True) diff --git a/dzgui/model/servers.py b/dzgui/model/servers.py index eff84d5..bc5d616 100644 --- a/dzgui/model/servers.py +++ b/dzgui/model/servers.py @@ -15,7 +15,7 @@ from dzgui.const.constants import ( from dzgui.const.enum import FilterMode, Preferences, ServerTab from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager from dzgui.strings import dialogs -from dzgui.util.strings import api_warn_msg, dialog +from dzgui.util.strings import server_timeout, dialog from dzgui.views.dialogs.generic import ExceptionDialog import gi @@ -175,18 +175,25 @@ class ServerModelManager: # TODO: wrap except if self.controller.get_exit_event().is_set(): return - res = future.result(timeout=API_TIMEOUT) self.thread_man.increment_dialog() - # NOTE: failing entries are culled - if res is None: - # TODO: log which servers failed - continue - servers.append(res) - if len(servers) == 0: - self.thread_man.set_cleanup_func( - StoredFunc(self._cleanup_on_failure), destroy_first=True - ) - return + + """ + Collects futures in linear order after completion + for lock-step representation of the state file + """ + for future in futures: + res = future.result(timeout=API_TIMEOUT) + # NOTE: failing entries are culled + if res is None: + # TODO: log which servers failed + # query_direct() currently does not return enough information + continue + servers.append(res) + if len(servers) == 0: + self.thread_man.set_cleanup_func( + StoredFunc(self._cleanup_on_failure), destroy_first=True + ) + return parsed = Servers.parse_json(servers) self._push_data(parsed) @@ -234,7 +241,6 @@ class ServerModelManager: self.first_iteration = False self.emitter.emit("load_maps", store) - # self.emitter.emit("servers_loaded_init") # TODO: dataclass for record rows; check for other dict annotations def add_to_history(self, data: tuple[dict[str, Any], "Record"]) -> None: @@ -413,7 +419,7 @@ class ServerModelManager: # TODO: distinguish signals, e.g. "servers_failed_to_load", "servers_loaded_empty" # customize statusbar and dialog accordingly if show_dialog: - dialog = ExceptionDialog(self.controller, api_warn_msg) + dialog = ExceptionDialog(self.controller, server_timeout) dialog.run() def _push_data(self, data: list[Any]) -> None: diff --git a/dzgui/util/strings.py b/dzgui/util/strings.py index b20dab9..261d605 100644 --- a/dzgui/util/strings.py +++ b/dzgui/util/strings.py @@ -100,10 +100,7 @@ steam_missing = "Local Steam installation is not set, possibly malformed config build_corrupted = ( "Steam settings or DayZ installation may be corrupted. Try restarting Steam." ) -api_warn_msg = """No servers returned. Please wait and try again. -This usually indicates a transitory network timeout. If this issue persists, your API key or network may be malfunctioning. -""" -server_timeout = "Timed out when querying server, check IP or try again later." +server_timeout = "Timed out when querying server(s). Check IP or try again later." server_error = ( "Error while contacting server, possibly timed out. Please wait and try again." )