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