mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
Merge pull request #423 from aclist/fix/lockstep-history
fix: maintain lockstep with history file (#362)
This commit is contained in:
4 files changed
+26
-20
No files matched your search
@@ -44,6 +44,7 @@
|
|||||||
- Play offline (load mods directly)
|
- Play offline (load mods directly)
|
||||||
- Generate Steam shortcuts and cover art
|
- Generate Steam shortcuts and cover art
|
||||||
- Warn user if background downloads are disabled
|
- Warn user if background downloads are disabled
|
||||||
|
- Dynamic copy button
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Conform to PEP 440 versioning for beta versions
|
- Conform to PEP 440 versioning for beta versions
|
||||||
@@ -63,6 +64,7 @@
|
|||||||
- Propagate subscribed mods to Steam client
|
- Propagate subscribed mods to Steam client
|
||||||
|
|
||||||
### Dropped
|
### Dropped
|
||||||
|
- Battlemetrics API support
|
||||||
- Debug mode
|
- Debug mode
|
||||||
- Branch switching
|
- Branch switching
|
||||||
- Manual mod install mode (describe rationale)
|
- Manual mod install mode (describe rationale)
|
||||||
@@ -73,6 +75,7 @@
|
|||||||
- Center server title text on server dialogs
|
- Center server title text on server dialogs
|
||||||
- Rare segfaults when changing maps (threading)
|
- Rare segfaults when changing maps (threading)
|
||||||
- Moved dialogs out of threads
|
- Moved dialogs out of threads
|
||||||
|
- History table not being in lock-step with state file
|
||||||
|
|
||||||
### Unreleased
|
### Unreleased
|
||||||
- Load offline mods
|
- Load offline mods
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ class ProxyModelManager:
|
|||||||
if found is False:
|
if found is False:
|
||||||
self.control_model.append(history)
|
self.control_model.append(history)
|
||||||
|
|
||||||
# if len(self.control_model) == 11:
|
if len(self.control_model) == 11:
|
||||||
# del self.control_model[0]
|
del self.control_model[0]
|
||||||
|
|
||||||
self.filter(FilterMode.INITIAL, skip_cache=True)
|
self.filter(FilterMode.INITIAL, skip_cache=True)
|
||||||
|
|
||||||
|
|||||||
+20
-14
@@ -15,7 +15,7 @@ from dzgui.const.constants import (
|
|||||||
from dzgui.const.enum import FilterMode, Preferences, ServerTab
|
from dzgui.const.enum import FilterMode, Preferences, ServerTab
|
||||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||||
from dzgui.strings import dialogs
|
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
|
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
@@ -175,18 +175,25 @@ class ServerModelManager:
|
|||||||
# TODO: wrap except
|
# TODO: wrap except
|
||||||
if self.controller.get_exit_event().is_set():
|
if self.controller.get_exit_event().is_set():
|
||||||
return
|
return
|
||||||
res = future.result(timeout=API_TIMEOUT)
|
|
||||||
self.thread_man.increment_dialog()
|
self.thread_man.increment_dialog()
|
||||||
# NOTE: failing entries are culled
|
|
||||||
if res is None:
|
"""
|
||||||
# TODO: log which servers failed
|
Collects futures in linear order after completion
|
||||||
continue
|
for lock-step representation of the state file
|
||||||
servers.append(res)
|
"""
|
||||||
if len(servers) == 0:
|
for future in futures:
|
||||||
self.thread_man.set_cleanup_func(
|
res = future.result(timeout=API_TIMEOUT)
|
||||||
StoredFunc(self._cleanup_on_failure), destroy_first=True
|
# NOTE: failing entries are culled
|
||||||
)
|
if res is None:
|
||||||
return
|
# 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)
|
parsed = Servers.parse_json(servers)
|
||||||
self._push_data(parsed)
|
self._push_data(parsed)
|
||||||
@@ -234,7 +241,6 @@ class ServerModelManager:
|
|||||||
|
|
||||||
self.first_iteration = False
|
self.first_iteration = False
|
||||||
self.emitter.emit("load_maps", store)
|
self.emitter.emit("load_maps", store)
|
||||||
# self.emitter.emit("servers_loaded_init")
|
|
||||||
|
|
||||||
# TODO: dataclass for record rows; check for other dict annotations
|
# TODO: dataclass for record rows; check for other dict annotations
|
||||||
def add_to_history(self, data: tuple[dict[str, Any], "Record"]) -> None:
|
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"
|
# TODO: distinguish signals, e.g. "servers_failed_to_load", "servers_loaded_empty"
|
||||||
# customize statusbar and dialog accordingly
|
# customize statusbar and dialog accordingly
|
||||||
if show_dialog:
|
if show_dialog:
|
||||||
dialog = ExceptionDialog(self.controller, api_warn_msg)
|
dialog = ExceptionDialog(self.controller, server_timeout)
|
||||||
dialog.run()
|
dialog.run()
|
||||||
|
|
||||||
def _push_data(self, data: list[Any]) -> None:
|
def _push_data(self, data: list[Any]) -> None:
|
||||||
|
|||||||
@@ -100,10 +100,7 @@ steam_missing = "Local Steam installation is not set, possibly malformed config
|
|||||||
build_corrupted = (
|
build_corrupted = (
|
||||||
"Steam settings or DayZ installation may be corrupted. Try restarting Steam."
|
"Steam settings or DayZ installation may be corrupted. Try restarting Steam."
|
||||||
)
|
)
|
||||||
api_warn_msg = """No servers returned. Please wait and try again.
|
server_timeout = "Timed out when querying server(s). Check IP or try again later."
|
||||||
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_error = (
|
server_error = (
|
||||||
"Error while contacting server, possibly timed out. Please wait and try again."
|
"Error while contacting server, possibly timed out. Please wait and try again."
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user