mirror of
https://github.com/aclist/dztui.git
synced 2026-08-26 01:37:18 +02:00
chore: update preconnect strings
This commit is contained in:
parent
6e29a716a5
commit
65df40ee5d
@ -474,8 +474,8 @@ class Controller(GObject.GObject):
|
||||
def update_and_connect(self, raise_window: bool) -> None:
|
||||
self.connection_man.update_and_connect(raise_window)
|
||||
|
||||
def update_status(self, mod: str, mark_finished: bool = False) -> None:
|
||||
self.mediator.preconnect.update_mod(mod, mark_finished)
|
||||
def update_status(self) -> None:
|
||||
self.mediator.preconnect.mark_finished()
|
||||
|
||||
def get_steam_client_name(self) -> str:
|
||||
return self.mediator.options.get_client_name()
|
||||
|
||||
@ -13,6 +13,7 @@ from dzgui.const.constants import (
|
||||
from dzgui.views.dialogs.early_alert import EarlyAlertDialog
|
||||
from dzgui.util.strings import init
|
||||
|
||||
|
||||
# TODO: move to util.proc
|
||||
def is_dayz_running() -> bool:
|
||||
return is_running(DAYZ_BINARY)
|
||||
@ -54,10 +55,8 @@ def has_cmd(cmd: str) -> bool:
|
||||
|
||||
def foreground(cmd: str, pid: int) -> None:
|
||||
if cmd == "wmctrl":
|
||||
proc = subprocess.check_output(
|
||||
["wmctrl", "-ilp"], capture_output=True, text=True
|
||||
)
|
||||
lines = proc.splitlines()
|
||||
proc = subprocess.run(["wmctrl", "-ilp"], capture_output=True, text=True)
|
||||
lines = proc.stdout.splitlines()
|
||||
for line in lines:
|
||||
els = line.split(" ")
|
||||
if str(pid) in els:
|
||||
@ -66,8 +65,8 @@ def foreground(cmd: str, pid: int) -> None:
|
||||
subprocess.run(["wmctrl", "-ia", wid])
|
||||
elif cmd == "xdotool":
|
||||
args = [cmd, "search", "--pid", str(pid)]
|
||||
proc = subprocess.check_output([*args], stderr=subprocess.DEVNULL)
|
||||
lines = proc.splitlines()
|
||||
proc = subprocess.run([*args], capture_output=True, text=True)
|
||||
lines = proc.stdout.splitlines()
|
||||
## NOTE: some forked subprocesses may fail, so skip over them
|
||||
for line in lines:
|
||||
subprocess.run(
|
||||
|
||||
@ -29,8 +29,9 @@ from dzgui.const.constants import (
|
||||
from dzgui.const.enum import Preferences
|
||||
from dzgui.init.proc import foreground, is_dayz_running, is_steam_running
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.strings.server_mods import checkmark
|
||||
from dzgui.util.format import format_mib
|
||||
from dzgui.util.strings import dialog, server_timeout, checkmark
|
||||
from dzgui.util.strings import dialog, server_timeout
|
||||
from dzgui.util.symlink import rebuild_symlinks
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
from dzgui.views.dialogs.servers import ServerDetailsDialog, ServerModDialog
|
||||
@ -140,10 +141,10 @@ class ConnectionManager:
|
||||
version_file = prefs.paths.version
|
||||
self.missing_mods = get_needs_update(version_file, hashes)
|
||||
|
||||
# TODO: walk through missing mods and update remote_mods store
|
||||
for mod in remote_mods:
|
||||
if any(mod[1] in tuple for tuple in self.missing_mods):
|
||||
mod[2] = "Needs updating"
|
||||
# TODO: store in strings
|
||||
mod[2] = "⟳"
|
||||
|
||||
if local_version is not None:
|
||||
pefile_path = PeFile.get_pefile_path(steam_path, info.game_id)
|
||||
@ -159,7 +160,6 @@ class ConnectionManager:
|
||||
client = self.controller.query_config(Preferences.CLIENT)
|
||||
running = is_steam_running(client)
|
||||
steam_proc = SteamProcess(client_name, running)
|
||||
# /home/USER/.var/app/com.valvesoftware.Steam
|
||||
|
||||
self.foreground_cmd = prefs.foreground_cmd
|
||||
game_mode = prefs.is_game_mode
|
||||
@ -248,7 +248,6 @@ class ConnectionManager:
|
||||
# TODO: test returncode
|
||||
# proc.returncode
|
||||
# TODO: wait for DAYZ_BINARY to load
|
||||
|
||||
# TODO: add to history file and list store
|
||||
|
||||
@call_on_thread("Waiting for Steam to update mods")
|
||||
@ -262,6 +261,7 @@ class ConnectionManager:
|
||||
|
||||
if self.foreground_cmd is not None and raise_window is True:
|
||||
pid = os.getpid()
|
||||
logger.info(f"Raising window with '{self.foreground_cmd}'")
|
||||
foreground(self.foreground_cmd, pid)
|
||||
|
||||
for title, mod, stamp, size in self.missing_mods:
|
||||
@ -277,14 +277,12 @@ class ConnectionManager:
|
||||
break
|
||||
time.sleep(1)
|
||||
|
||||
# TODO: update version file
|
||||
# TODO: get config path or just push steam path directly
|
||||
rebuild_symlinks(self.controller.get_prefs().paths.config)
|
||||
# TODO: update version file
|
||||
|
||||
# TODO: update tree checkmarks when finished
|
||||
func = StoredFunc(
|
||||
self.controller.update_status, "All mods updated.", mark_finished=True
|
||||
)
|
||||
# TODO: make this internal to preconnect page
|
||||
func = StoredFunc(self.controller.update_status)
|
||||
self.thread_man.set_cleanup_func(func)
|
||||
|
||||
def update_and_connect(self, raise_window: bool) -> None:
|
||||
|
||||
@ -6,3 +6,4 @@ warnings = "Warnings"
|
||||
errors = "Errors"
|
||||
mods = "Mods"
|
||||
total_mods = "Total mods: "
|
||||
all_updated = "All mods updated."
|
||||
|
||||
@ -2,3 +2,4 @@ mod = "Mod"
|
||||
mod_id = "ID"
|
||||
up_to_date = "Up to date"
|
||||
modlist = "Modlist"
|
||||
checkmark = "✓"
|
||||
|
||||
@ -460,7 +460,6 @@ crumbs = Crumbs(
|
||||
default="Servers > ",
|
||||
)
|
||||
|
||||
checkmark = "✓"
|
||||
no_mods = "No local mods found."
|
||||
no_servers = "No server metadata to list."
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ from dzgui.const.constants import (
|
||||
from dzgui.const.enum import NotebookPage
|
||||
from dzgui.util.css import add_class
|
||||
from dzgui.util.localize import number
|
||||
from dzgui.strings.server_mods import checkmark
|
||||
from dzgui.strings import preconnect
|
||||
from dzgui.views.components.frame import HeadingFrame
|
||||
from dzgui.views.trees.tree_server_mods import ServerModTreeView
|
||||
@ -214,14 +215,7 @@ class PreConnectionAssistant(Gtk.ScrolledWindow):
|
||||
def _on_ok_clicked(self, button: Gtk.Button) -> None:
|
||||
# TODO: cancel mod downloads
|
||||
# sets some kind of global event listener
|
||||
if self.mod_count.get_visible():
|
||||
# TODO: set ready mode
|
||||
# TODO: strings
|
||||
# self.mod_count.set_label("Enqueuing downloads")
|
||||
# self.cancel.set_visible(True)
|
||||
self.ok.set_label(preconnect.connect)
|
||||
self.controller.update_and_connect(self.raise_window.get_active())
|
||||
pass
|
||||
|
||||
def _on_back_clicked(self, button: Gtk.Button) -> None:
|
||||
self.controller.open_page(NotebookPage.SERVERS)
|
||||
@ -308,8 +302,11 @@ class PreConnectionAssistant(Gtk.ScrolledWindow):
|
||||
|
||||
self._process_warnings(prereqs)
|
||||
|
||||
def update_mod(self, text: str, mark_finished: bool = False) -> None:
|
||||
self.mod_count.set_label(text)
|
||||
def mark_finished(self) -> None:
|
||||
self.mod_count.set_label(preconnect.all_updated)
|
||||
model = self.tree.get_model()
|
||||
for row in model:
|
||||
row[2] = checkmark
|
||||
|
||||
def add_errors(self, errors: list[str]) -> None:
|
||||
self.error_tree.extend(errors)
|
||||
|
||||
@ -307,8 +307,8 @@ class ServerTreeView(ContextMixin, TreeView): # type: ignore
|
||||
def get_record(self) -> Record | None:
|
||||
if self.loaded is False:
|
||||
return None
|
||||
r = self.get_record_string()
|
||||
try:
|
||||
r = self.get_record_string()
|
||||
ip, gameport, qport = r.split(":")
|
||||
return Record(ip, int(gameport), int(qport))
|
||||
except ValueError as e:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user