mirror of
https://github.com/aclist/dztui.git
synced 2026-08-25 17:32:36 +02:00
feat: add DebugDialog to preconnect
This commit is contained in:
parent
c037cf9c40
commit
5eb89a172d
@ -150,6 +150,22 @@ def get_remote_signatures(mods: list[str]) -> list[tuple[str, str, int, int]]:
|
||||
return hashes
|
||||
|
||||
|
||||
def connect_debug(client: str, addr: str, appid: int, name: str, mods: list[str]) -> str:
|
||||
concat = concat_mods(mods)
|
||||
client_args = concat_bash_args(client)
|
||||
params = [
|
||||
"-applaunch",
|
||||
str(appid),
|
||||
f"-connect={addr}",
|
||||
"-nolauncher",
|
||||
"-nosplash",
|
||||
"-skipintro",
|
||||
f"-name={name}",
|
||||
f"-mod={concat}",
|
||||
]
|
||||
client_args.extend(params)
|
||||
return " ".join(client_args)
|
||||
|
||||
# TODO: set config to name=user, use official server and no mods,
|
||||
# ensure that formatted string is identical to fixture with same hash
|
||||
def connect(client: str, addr: str, appid: int, name: str, mods: list[str]) -> int:
|
||||
|
||||
@ -526,6 +526,9 @@ class Controller(GObject.GObject):
|
||||
ind = self.config_man.get_start_tab()
|
||||
self.get_servers().notebook.set_current_page(ind)
|
||||
|
||||
def get_debug_args(self) -> str:
|
||||
return self.connection_man.get_debug_args()
|
||||
|
||||
def update_and_load_to_menu(self) -> None:
|
||||
self.connection_man.update_and_connect(menu_only=True)
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ from dzgui.api.shortcuts import Shortcuts
|
||||
|
||||
from dzgui.api.steam import (
|
||||
connect,
|
||||
connect_debug,
|
||||
get_app_allows_downloads,
|
||||
get_app_name,
|
||||
get_needs_update,
|
||||
@ -304,6 +305,13 @@ class ConnectionManager:
|
||||
dialog.set_secondary_text(kb.DZG_006)
|
||||
dialog.run()
|
||||
|
||||
def get_debug_args(self) -> str:
|
||||
addr = f"{self.record.ip}:{self.record.gameport}"
|
||||
playername = self.controller.query_config(Preferences.NAME)
|
||||
return connect_debug(
|
||||
self.client, addr, self.appid, playername, self.remote_mod_ids
|
||||
)
|
||||
|
||||
def _connect_steam(self, menu_only: bool) -> None:
|
||||
addr = f"{self.record.ip}:{self.record.gameport}"
|
||||
playername = self.controller.query_config(Preferences.NAME)
|
||||
|
||||
@ -11,6 +11,7 @@ from dzgui.util.keys import is_ctrl_mask
|
||||
from dzgui.util.localize import number
|
||||
from dzgui.strings.server_mods import checkmark
|
||||
from dzgui.strings import preconnect
|
||||
from dzgui.views.dialogs.generic import DebugDialog
|
||||
from dzgui.views.components.frame import HeadingFrame
|
||||
from dzgui.views.trees.tree_server_mods import ServerModTreeView
|
||||
|
||||
@ -120,6 +121,12 @@ class PreConnectionAssistant(Gtk.Box):
|
||||
spacing=5,
|
||||
)
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
|
||||
# TODO:
|
||||
if self.controller.get_prefs().is_debug:
|
||||
# TODO: strings
|
||||
debug = Gtk.Button(label="Debug", halign=Gtk.Align.START)
|
||||
debug.connect("clicked", self._on_debug_clicked)
|
||||
box.add(debug)
|
||||
for button in self.back, self.ok, self.connect_last:
|
||||
box.add(button)
|
||||
self.button_box.add(box)
|
||||
@ -221,6 +228,11 @@ class PreConnectionAssistant(Gtk.Box):
|
||||
def _on_connect_last_clicked(self, button: Gtk.Button) -> None:
|
||||
self.controller.update_and_load_to_menu()
|
||||
|
||||
def _on_debug_clicked(self, button: Gtk.Button) -> None:
|
||||
args = self.controller.get_debug_args()
|
||||
d = DebugDialog(self.controller, args)
|
||||
d.run()
|
||||
|
||||
def _on_ok_clicked(self, button: Gtk.Button) -> None:
|
||||
self.controller.update_and_connect()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user