Compare commits

...
26 Commits
Author SHA1 Message Date
aclist 4d02604bcf Merge pull request #485 from aclist/fix/gint-warning
Mirror to Codeberg / mirror-to-codeberg (push) Canceled after 0s
fix: use more stable GObject signal
2026-10-15 00:32:28 +09:00
aclist ebffbe39f2 fix: use more stable GObject signal 2026-10-15 00:23:11 +09:00
aclist 61860f6aee Merge pull request #482 from aclist/fix/duplicate-warnings
Fix/duplicate warnings
2026-10-14 23:12:18 +09:00
aclist 191776ce74 fix: use correct logger method 2026-10-14 23:11:29 +09:00
aclist 7ae34747e9 fix: add missing dummy method to test 2026-10-14 23:07:22 +09:00
aclist 1555ba2d64 chore: drop no longer relevant filter 2026-10-14 23:07:00 +09:00
aclist 4bac804fd7 fix: duplicate warnings (#480) 2026-10-14 23:06:41 +09:00
aclist 748e1870da Merge pull request #479 from sylvaingirardbe/fix/478-flatpak-steam-detection
Mirror to Codeberg / mirror-to-codeberg (push) Canceled after 0s
fix: detect running Flatpak Steam correctly
2026-10-14 23:03:43 +09:00
aclist cd4c6fdfb2 Merge pull request #481 from aclist/fix/workshop-403
fix: handle HTTPErrors from workshop (#477)
2026-10-14 23:01:48 +09:00
aclist 1752018331 fix: handle HTTPErrors from workshop (#477) 2026-10-14 22:53:02 +09:00
aclist b3b05918b7 chore: add test case 2026-10-09 06:45:59 +09:00
aclist e6e0a3036d fix: drop unused assignment 2026-10-09 04:03:36 +09:00
aclist 8c44a6e255 fix: user-facing Steam client name not available until Options populated
The old method was checking the active ComboBox string after the Options
page was initialized, but before it was actually populated with the real
setting. This caused it to always return the string 'Steam' instead of
the actual client name.
2026-10-09 04:03:17 +09:00
aclist 7fc1264b65 fix: false positive when Flatpak client is running
The process ultimately spawned from the Flatpak run command has the same
process name as the one expected for STEAM_CMD (essentially just the
Steam client wrapped in a Flatpak), so the old logic would return True
for is_steam_running() if the Flatpak version had already been launched.
To prevent unintended collisions and isolate launch parameters,
STEAM_CMD and FLATPAK_RUN_CMD/FLATPAK_SANDBOX should be
mutually exclusive.
2026-10-09 04:02:58 +09:00
Sylvain Girard f748b09ba7 fix: detect running Flatpak Steam correctly
Request only application IDs from flatpak ps so running Steam instances match correctly. Fix client selection validation and cover detection with regression tests.

Refs aclist/dztui#478.
2026-10-08 15:58:51 +02:00
aclist 01be1247b4 Merge pull request #476 from aclist/fix/missing-mission
Mirror to Codeberg / mirror-to-codeberg (push) Canceled after 0s
fix: missing mission
2026-09-24 13:48:24 +09:00
aclist 27d5c4b4b2 Merge branch 'dzgui7' into fix/missing-mission 2026-09-24 13:39:56 +09:00
aclist 045e47037e chore: bump version 2026-09-24 13:39:12 +09:00
aclist 3bc2a54ee4 fix: mission param returning empty 2026-09-24 13:38:16 +09:00
aclist 4e22b82703 change: more explicitchange: more explicit status message 2026-09-24 13:37:56 +09:00
aclist 492ed221c4 change: add padding to error area 2026-09-24 13:37:31 +09:00
aclist 71a61a9201 drop: old comment 2026-09-24 13:37:16 +09:00
aclist 516735defa chore: add string 2026-09-24 13:36:58 +09:00
aclist 9a3df70914 chore: format strings 2026-09-24 13:36:25 +09:00
aclist c41e47859f change: more explicit error message 2026-09-24 13:35:59 +09:00
aclist 11bbe15ecb chore: change comment flag 2026-09-24 13:35:35 +09:00
21 changed files with 178 additions and 63 deletions

No files matched your search

+23
View File
@@ -6,6 +6,7 @@ import subprocess
import vdf # type: ignore
from pathlib import Path
from requests.exceptions import HTTPError
from typing import Any, Union
from warnings import deprecated
@@ -32,6 +33,7 @@ from dzgui.const.endpoints import (
UNSUB_ENDPOINT,
)
from dzgui.strings import wizard
from dzgui.strings.errors import api_validation_error, workshop_endpoint_error
from dzgui.util.bash import concat_bash_args
logger = logging.getLogger(APP_NAME)
@@ -262,6 +264,16 @@ def find_user_id_32(path: Path) -> int:
return int(uid) & 0xFFFFFFFF
class SteamAPIKeyError(Exception):
def __init__(self, msg=None):
super().__init__(msg or api_validation_error)
class SteamWorkshopEndpointError(Exception):
def __init__(self, msg=None):
super().__init__(msg or workshop_endpoint_error)
def update_workshop(key: str, mod: int, endpoint: str) -> None:
payload: dict[str, Union[int, str]] = {
"publishedfileid": mod,
@@ -273,8 +285,19 @@ def update_workshop(key: str, mod: int, endpoint: str) -> None:
try:
res = requests.post(endpoint, params=payload, timeout=REQUEST_TIMEOUT)
res.raise_for_status()
except HTTPError as e:
logger.critical(e)
match res.status_code:
case 403:
raise SteamAPIKeyError()
case 404:
raise SteamWorkshopEndpointError()
case _:
# TODO: apply redaction filter
raise e
except Exception as e:
logger.critical(e)
raise e
def subscribe(key: str, mod: int) -> None:
+1 -1
View File
@@ -36,7 +36,7 @@ HEX_GREEN = "#32CD32"
HEX_RED = "#FF0000"
HEX_ORANGE = "#FFAC1C"
# FIXME: normalize icon names
# TODO: normalize icon names
CALCULATOR = "accessories-calculator-symbolic"
CARET_DOWN = "go-down-symbolic"
CARET_UP = "go-up-symbolic"
+2 -2
View File
@@ -541,8 +541,8 @@ class Controller(GObject.GObject):
def update_status(self) -> None:
self.mediator.preconnect.mark_finished()
def get_steam_client_name(self) -> str:
return self.mediator.options.get_client_name()
def get_steam_client_name(self, cmd: str) -> str:
return self.mediator.options.get_client_name(cmd)
def present_window(self) -> None:
self.mediator.window.present_with_time(Gdk.CURRENT_TIME)
+9 -2
View File
@@ -4,17 +4,24 @@ from pathlib import Path
from dzgui.api.steam import get_app_path
from dzgui.config.query import lookup
from dzgui.const.constants import APPID_DAYZ, APP_NAME
from dzgui.const.constants import APPID_DAYZ, APP_NAME, APPNAME_DAYZ
from dzgui.const.enum import Preferences
from dzgui.strings.preconnect import resync
logger = logging.getLogger(APP_NAME)
class VDFSyncError(Exception):
pass
def is_dayz_installed(config: Path) -> None:
try:
path = lookup(config, Preferences.DEFAULT)
get_app_path(Path(path), APPID_DAYZ)
except Exception as e:
logger.critical(e)
raise e
msg = resync.format(APPNAME_DAYZ)
raise VDFSyncError(msg)
+9 -4
View File
@@ -16,12 +16,15 @@ logger = logging.getLogger(APP_NAME)
def is_steam_running(cmd: str) -> bool:
if cmd == STEAM_CMD:
is_flatpak_running = is_flatpak_steam_running()
if cmd in (FLATPAK_RUN_CMD, FLATPAK_SANDBOX):
return is_flatpak_running
elif cmd == STEAM_CMD:
if is_flatpak_running:
return False
if has_cmd(STEAM_CMD) is False:
return False
return is_running(STEAM_CMD)
elif cmd == FLATPAK_RUN_CMD or FLATPAK_SANDBOX:
return is_flatpak_steam_running()
else:
raise TypeError("Not a valid Steam client selection")
@@ -31,7 +34,9 @@ def is_steam_running(cmd: str) -> bool:
def is_flatpak_steam_running() -> bool:
if has_cmd(FLATPAK_CMD) is False:
return False
proc = subprocess.check_output([FLATPAK_CMD, "ps"], text=True)
proc = subprocess.check_output(
[FLATPAK_CMD, "ps", "--columns=application"], text=True
)
lines = proc.splitlines()
if FLATPAK_APPID in lines:
return True
+15 -4
View File
@@ -48,7 +48,7 @@ from dzgui.strings.dialogs import (
)
from dzgui.strings import kb
from dzgui.strings.server_mods import checkmark, resync
from dzgui.util.format import format_mib
from dzgui.util.format import format_exception, format_mib
from dzgui.util.strings import dialog, server_timeout
from dzgui.util.symlink import rebuild_symlinks
from dzgui.views.dialogs.generic import ExceptionDialog
@@ -184,8 +184,8 @@ class ConnectionManager:
else:
allows_downloads = (True, "")
client_name = self.controller.get_steam_client_name()
client = self.controller.query_config(Preferences.CLIENT)
client_name = self.controller.get_steam_client_name(client)
running = is_steam_running(client)
steam_proc = SteamProcess(client_name, running)
self.client = client
@@ -300,6 +300,11 @@ class ConnectionManager:
dialog = ServerDetailsDialog(self.controller, details)
dialog.run()
def _workshop_timeout(self, msg: str) -> None:
dialog = ExceptionDialog(self.controller, msg)
dialog.show_all()
dialog.run()
def _server_timeout(self) -> None:
dialog = ExceptionDialog(self.controller, server_timeout)
dialog.set_details_buffer(kb.DZG_006)
@@ -351,8 +356,14 @@ class ConnectionManager:
for title, mod, stamp, size in self.missing_mods:
if self.controller.is_cancel_pending():
return
subscribe(key, int(mod))
time.sleep(API_RATE_LIMIT)
try:
subscribe(key, int(mod))
time.sleep(API_RATE_LIMIT)
except Exception as e:
msg = format_exception(e)
func = StoredFunc(self._workshop_timeout, msg)
self.thread_man.set_cleanup_func(func, destroy_first=True)
return
self.thread_man.update_dialog(waiting_for_directories)
for title, mod, stamp, size in self.missing_mods:
+5 -1
View File
@@ -122,7 +122,11 @@ class ModManager:
def unsub_atomic_mod(self, mod: str) -> None:
config_man = self.controller.get_config_man()
key = config_man.lookup(Preferences.STEAM)
unsubscribe(key, int(mod))
try:
unsubscribe(key, int(mod))
except Exception as e:
logger.critical(e)
return
steam_path = Path(self.path)
app_path = PeFile.get_nested_app_path(steam_path, APPID_DAYZ)
+17 -15
View File
@@ -1,20 +1,22 @@
add_button="Add"
add_con_heading="Add/connect"
from dzgui.const.constants import UDP_PORT
add_button = "Add"
add_con_heading = "Add/connect"
add_popover = "This address is already in your Saved Servers"
add_tooltip="Add to Saved Servers"
connect_button="Connect"
connect_tooltip="Connect to this server"
connect_entry_placeholder="Enter IP:Query port (e.g., 192.168.1.1:27016)"
add_tooltip = "Add to Saved Servers"
connect_button = "Connect"
connect_tooltip = "Connect to this server"
connect_entry_placeholder = f"Enter IP:Query port (e.g., 192.168.1.1:{UDP_PORT})"
fav_heading="Favorite server"
favs_empty="None set. Right click a server and select 'Set favorite' to set."
fav_heading = "Favorite server"
favs_empty = "None set. Right click a server and select 'Set favorite' to set."
lan_heading="LAN query port"
lan_default_button="Default port (27016)"
lan_custom_button="Custom port"
lan_scan_button="Scan"
lan_heading = "LAN query port"
lan_default_button = f"Default port ({UDP_PORT})"
lan_custom_button = "Custom port"
lan_scan_button = "Scan"
lan_abort_tooltip = "Unless you have multiple DayZ servers on your LAN,\nleave this checked to get results faster"
lan_checkbox = "Stop scanning on first hit"
lan_entry_placeholder="Enter the query port (1-65535)"
lan_entry_tooltip="Specify the port to search for DayZ servers on the local network"
lan_scan_tooltip="Scan for servers"
lan_entry_placeholder = "Enter the query port (1-65535)"
lan_entry_tooltip = "Specify the port to search for DayZ servers on the local network"
lan_scan_tooltip = "Scan for servers"
+1
View File
@@ -4,3 +4,4 @@ api_validation_error = (
api_popover = "API key validation failed."
dayz_not_found = "Could not find a valid DayZ installation."
workshop_endpoint_error = "Steam Workshop service unavailable, try again later."
+1 -2
View File
@@ -11,8 +11,6 @@ mods = "Mods"
total_mods = "Total mods: "
up_to_date = "All mods are up to date."
all_updated = "All mods updated."
"If you recently installed {build} or moved it to a different drive, "
"restart Steam to allow these changes to synchronize, then try again."
required_space = " Need to download {0} MiB of mod updates."
placeholder_no_mods = "This server has no mods."
@@ -36,6 +34,7 @@ steam_not_running = "'{0}' is set as the default Steam client, but it is either
use_desktop_mode = "Use Desktop Mode to download mods on Steam Deck."
version_mismatch = "Local client version '{0}' does not match remote version '{1}'."
version_missing = "Remote server is running the build '{0}', but it is not installed."
no_errors = "No errors."
# Warnings
+2 -1
View File
@@ -30,7 +30,8 @@ path_remove_prefix = "The following path will be removed:"
not_installed = "It looks like DZGUI was not previously set up; nothing to uninstall."
standalone_uninstall = (
"It looks like you are running the standalone version of DZGUI.\n"
"To finalize the uninstall process, you can remove the 'dzgui' file."
"To finalize the uninstall process, invoke './dzgui self remove',\n"
"then remove the 'dzgui' file."
)
system_uninstall = (
"It looks like DZGUI was installed via your system package manager or directly from source code.\n"
+10 -5
View File
@@ -2,7 +2,12 @@ import logging
from pathlib import Path
from dzgui.api.mods import get_local_mod_path, get_local_mod_ids, _hash
from dzgui.const.constants import APPID_DAYZ, APPID_DAYZ_EXP, APP_NAME, DAYZ_COMMUNITY_ROOT
from dzgui.const.constants import (
APPID_DAYZ,
APPID_DAYZ_EXP,
APP_NAME,
DAYZ_COMMUNITY_ROOT,
)
from dzgui.const.enum import Preferences
from dzgui.config.query import lookup
@@ -20,6 +25,7 @@ def expunge_link(file: Path) -> None:
if str(file.stem)[:2] == "@C":
file.unlink()
def rebuild_symlinks(config: Path) -> None:
# TODO: pass direct path as argument
path = lookup(config, Preferences.DEFAULT)
@@ -63,10 +69,9 @@ def symlink_mission(steam_path: Path, target: str) -> str:
stem = path.name
parent = path.parent
source = dayz_path.joinpath(DAYZ_COMMUNITY_ROOT)
try:
source.symlink_to(parent)
except Exception:
return ""
if source.exists():
source.unlink()
source.symlink_to(parent)
return f"{DAYZ_COMMUNITY_ROOT}/{stem}"
+1 -8
View File
@@ -1,6 +1,5 @@
import logging
import signal
import warnings
from typing import TYPE_CHECKING, Literal, Self
@@ -47,10 +46,6 @@ if TYPE_CHECKING:
logger = logging.getLogger(APP_NAME)
# TODO: drop
# https://bugzilla.gnome.org/show_bug.cgi?id=708676
warnings.filterwarnings("ignore", ".*g_value_get_int", Warning)
class OuterWindow(Gtk.ApplicationWindow):
def __init__(self, app: Gtk.Application) -> None:
@@ -344,8 +339,6 @@ try:
theme = Gtk.IconTheme.get_default()
icons = theme.list_icons(None)
if STEAM_ICON not in icons:
logger.warn(strings.steam_icon_missing)
warnings.warn(strings.steam_icon_missing, stacklevel=2)
logger.warning(strings.steam_icon_missing)
except Exception as e:
logger.warning(e)
warnings.warn(strings.gtk_theme_missing, stacklevel=2)
+9 -2
View File
@@ -15,7 +15,7 @@ class ClientCombo(Gtk.ComboBox):
super().__init__()
self.client_store = Gtk.ListStore(str, str)
clients = (
self.clients = (
(
options.steam_combo,
STEAM_CMD,
@@ -29,7 +29,7 @@ class ClientCombo(Gtk.ComboBox):
FLATPAK_SANDBOX,
),
)
for client in clients:
for client in self.clients:
self.client_store.append(client)
self.set_model(self.client_store)
renderer_text = Gtk.CellRendererText()
@@ -37,6 +37,13 @@ class ClientCombo(Gtk.ComboBox):
self.add_attribute(renderer_text, "text", 0)
self.set_active(0)
def get_client_human_readable(self, cmd: str) -> str:
for client in self.clients:
human, command = client
if command == cmd:
return human
raise TypeError("Not a valid Steam client selection")
class ErrorPopover(Gtk.Popover):
def __init__(self, relative_to: Gtk.Widget, position: Gtk.PositionType) -> None:
super().__init__(relative_to=relative_to, position=position)
+1 -1
View File
@@ -102,7 +102,7 @@ class BootDialog(ColorAwareApp, Gtk.Dialog): # type: ignore
margin_top=30,
margin_bottom=30,
)
self.error_label = Gtk.Label()
self.error_label = Gtk.Label(margin_start=15, margin_end=15)
# TODO: abstract class
self.copy_button = ClipboardButton(None, lambda: self.error_label.get_text())
+4 -10
View File
@@ -76,7 +76,7 @@ class SubmitField(Gtk.Box):
self.button = Gtk.Button(label=options.save_button)
self.button.connect("clicked", self._on_save_clicked)
self.entry.connect("insert-text", self._on_text_typed)
self.entry.connect("changed", self._on_text_typed)
self.entry.connect("activate", self._on_field_activated)
self.entry.get_property("buffer").connect("deleted-text", self._on_text_deleted)
@@ -113,13 +113,9 @@ class SubmitField(Gtk.Box):
def _on_text_typed(
self,
entry: Gtk.Entry,
text: str,
length: int,
pos: int,
) -> None:
buffer = entry.get_property("buffer")
text = buffer.get_text() + text
text = entry.get_text()
state = self._is_valid_text(text)
self.button.set_sensitive(state)
@@ -371,10 +367,8 @@ class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
self.connect("key-press-event", self._on_keypress)
def get_client_name(self) -> str:
model = self.client_combo.get_model()
ind = self.client_combo.get_active()
return str(model[ind][0])
def get_client_name(self, cmd: str) -> str:
return self.client_combo.get_client_human_readable(cmd)
def block_text_entry(self) -> None:
self.steam_box.block_text_entry()
+1 -2
View File
@@ -176,8 +176,7 @@ class PreConnectionAssistant(Gtk.Box):
self.error_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.error_tree = MaskedTree(ERROR)
# TODO: strings
self.error_placeholder = Placeholder("No errors.")
self.error_placeholder = Placeholder(preconnect.no_errors)
self.error_box.add(self.error_tree)
self.error_box.add(self.error_placeholder)
self.error_frame = HeadingFrame.new_with_widget_and_label(
-1
View File
@@ -252,7 +252,6 @@ class ServerTreeView(ContextMixin, TreeView): # type: ignore
case Gdk.KEY_c:
self.controller.menu_action(ContextMenu.COPY_SERVER_IP, self)
case Gdk.KEY_r:
# TODO: unimplemented, needs threading
self.controller.menu_action(ContextMenu.REFRESH_PLAYERS, self)
else:
match event.keyval:
+1 -1
View File
@@ -4,7 +4,7 @@ description = "DayZ server browser and mod manager for Linux"
authors = [
{name = "aclist"}
]
version = "7.0.0b24"
version = "7.0.0b26"
license = "GPL-3.0-or-later"
license-files = ["LICENSE"]
readme = "README.md"
+61
View File
@@ -0,0 +1,61 @@
import unittest
from unittest.mock import patch
from dzgui.const.constants import (
FLATPAK_APPID,
FLATPAK_RUN_CMD,
FLATPAK_SANDBOX,
STEAM_CMD,
)
from dzgui.init import proc
class TestSteamDetection(unittest.TestCase):
def test_flatpak_detection_with_multiple_running_apps(self):
def flatpak_output(args, *, text):
# Default `flatpak ps` includes instance, PID, app and runtime columns.
if args == ["flatpak", "ps", "--columns=application"]:
return f"com.spotify.Client\n{FLATPAK_APPID}\n{FLATPAK_APPID}\n"
return f"3904921611\t1257689\t{FLATPAK_APPID}\torg.freedesktop.Platform\n"
with (
patch.object(proc, "has_cmd", return_value=True),
patch.object(proc.subprocess, "check_output", side_effect=flatpak_output),
):
for client in (FLATPAK_RUN_CMD, FLATPAK_SANDBOX):
with self.subTest(client=client):
self.assertTrue(proc.is_steam_running(client))
def test_flatpak_not_running(self):
with patch.object(proc, "has_cmd", return_value=True):
for output in ("", "com.spotify.Client\n", f"{FLATPAK_APPID}Helper\n"):
with (
self.subTest(output=output),
patch.object(proc.subprocess, "check_output", return_value=output),
):
self.assertFalse(proc.is_flatpak_steam_running())
def test_flatpak_not_installed(self):
with (
patch.object(proc, "has_cmd", return_value=False),
patch.object(proc.subprocess, "check_output") as check_output,
):
self.assertFalse(proc.is_flatpak_steam_running())
check_output.assert_not_called()
def test_native_steam(self):
with patch.object(proc, "has_cmd", return_value=True):
for running in (True, False):
with (
self.subTest(running=running),
patch.object(proc, "is_running", return_value=running),
):
self.assertEqual(proc.is_steam_running(STEAM_CMD), running)
def test_native_steam_while_flatpak_is_running(self):
with patch.object(proc, "is_flatpak_steam_running", return_value=True):
self.assertEqual(proc.is_steam_running(STEAM_CMD), False)
def test_invalid_client(self):
with self.assertRaises(TypeError):
proc.is_steam_running("invalid-client")
+5 -1
View File
@@ -14,7 +14,11 @@ from dzgui.views.dialogs.calc import (
class DummyEmitter:
pass
def __init__(self) -> None:
pass
def connect(self, _, __) -> None:
pass
@pytest.fixture(params=[("05:00", 10.0), ("15:30", 5.0)])