feat: emit warning if icon is missing

This commit is contained in:
aclist committed 2026-01-24 09:11:54 +09:00
1 parent eb05cbdbfd
commit 69a881cee8
3 files changed
+47 -25

No files matched your search

+2 -4
View File
@@ -467,7 +467,7 @@ class Controller(GObject.GObject):
# NOTE: manipulates mod store
case ContextMenu.DELETE_MOD:
self.delete_single_mod(path)
# TODO: hook treeview changed signal
# TODO: hook treeview changed signal automatically
# Gtk.TreeModel, row-inserted/row-deleted
self.update_mod_statusbar()
remove_stale_signatures(
@@ -539,7 +539,6 @@ class Controller(GObject.GObject):
import time
time.sleep(1)
# TODO: use model managers, etc.
self.data = (
["BAR", "a", "a", "a", 1, 1, 1, "185.207.214.16:2302", 0, 0, "a", False],
["BAR", "a", "a", "a", 1, 1, 1, "172.111.51.156:2302", 0, 0, "a", False],
@@ -564,9 +563,7 @@ class Controller(GObject.GObject):
def dump_test_2(self) -> None:
import time
time.sleep(1)
# TODO: use model managers, etc.
self.data = (
["BAR", "a", "a", "a", 1, 1, 1, "185.207.214.16:2302", 0, 0, "a", False],
)
@@ -582,6 +579,7 @@ class Controller(GObject.GObject):
for row in data:
manager.append_row(row)
treeview.set_loaded(True)
# TODO: emit custom "servers finished loading" signal
self.mediator.statusbar.emit("server_page_changed", context)
treeview.grab_focus()
+39 -14
View File
@@ -2,6 +2,7 @@ from dataclasses import dataclass
from dzgui.const.constants import SYSTEM_LOG
def build_missing(build: str) -> str:
msg = (
f"This server is running {build}. You can install "
@@ -20,6 +21,7 @@ def build_path_invalid(build: str) -> str:
)
return msg
# General
dialog_header = "DZGUI - Dialog"
dz = "DayZ"
@@ -93,21 +95,24 @@ something_wrong = "Something went wrong. See the detailed error below."
steam_key_missing = "No Steam API key is set."
malformed_mods = "Found mods on system, but was unable to parse results."
steam_missing = "Local Steam installation is not set, possibly malformed config file."
build_corrupted = "Steam settings or DayZ installation may be corrupted. Try restarting Steam."
build_corrupted = (
"Steam settings or DayZ installation may be corrupted. Try restarting Steam."
)
api_warn_msg = """No servers returned. Possible causes:
no servers in favorites/history, local network issue, or API key on cooldown.
Return to the main menu, wait 30s, and try again.
If this issue persists, your API key may be defunct.
"""
server_timeout = "Timed out when querying server, check IP or try again later"
server_error = "Error while contacting server, possibly timed out. Please wait and try again."
server_error = (
"Error while contacting server, possibly timed out. Please wait and try again."
)
server_protected = (
"This server is password-protected and you will be "
"prompted when connecting. Do you want to proceed?"
)
# KeybindingsDialog
navigation = {
"Enter/space/double click": "select row item",
@@ -155,13 +160,9 @@ label_main_menu = "Main menu"
# buttons
ping_servers = "Ping servers"
debug_mode = "Debug mode"
debug_tooltip = (
"Used to perform a dry run without\n"
"actually connecting to a server"
)
debug_tooltip = "Used to perform a dry run without\n" "actually connecting to a server"
ping_tooltip = (
"Refresh the ping for visible servers.\n"
"Available once per unique filter context"
"Refresh the ping for visible servers.\n" "Available once per unique filter context"
)
# statusbar_helptext = "Select a row to see its detailed description"
@@ -235,12 +236,14 @@ class Dialog:
working: str
updating_mods: str
@dataclass(slots=True, frozen=True)
class Init:
is_steam_running: str
is_dayz_running: str
requires_steam: str
@dataclass(slots=True, frozen=True)
class Button:
servers_label: str
@@ -254,6 +257,7 @@ class Button:
exit_label: str
exit_tooltip: str
@dataclass(slots=True, frozen=True)
class Crumbs:
changelog: str
@@ -266,12 +270,14 @@ class Crumbs:
thanks: str
developers: str
@dataclass(slots=True, frozen=True)
class Thanks:
header: str
description: str
users: list[str]
@dataclass(slots=True, frozen=True)
class Options:
header: str
@@ -310,6 +316,7 @@ class Options:
testing: str
manual_sub_msg: str
init = Init(
is_steam_running="Is Steam running? DZGUI must be run on top of Steam.",
is_dayz_running="Is DayZ already running? DZGUI cannot launch DayZ if another process is using it.",
@@ -386,8 +393,7 @@ options = Options(
install_mode="Mod install mode",
force_update="Force update local mods",
dl_eventbox=(
"Manual: prompt to subscribe to mods in Steam. "
"Auto: unmanned downloads."
"Manual: prompt to subscribe to mods in Steam. " "Auto: unmanned downloads."
),
force_eventbox="Synchronize all local mods. Automatic mode must be enabled.",
self_update=(
@@ -454,6 +460,7 @@ checkmark = "✓"
no_mods = "No local mods found."
no_servers = "No server metadata to list."
@dataclass(slots=True, frozen=True)
class Flags:
description: str
@@ -461,6 +468,7 @@ class Flags:
uninstall: str
developers: str
flags = Flags(
description="DayZ server browser and mod manager",
version="Print version information",
@@ -468,17 +476,21 @@ flags = Flags(
developers="Enables developer debugging features",
)
@dataclass(slots=True, frozen=True)
class FilePicker:
title: str
placeholder: str
picker = FilePicker(
title="Save diagnostic log to file",
placeholder=SYSTEM_LOG,
)
api_error = "API key validation error or timeout. See 'Help > Show debug log' for details."
api_error = (
"API key validation error or timeout. See 'Help > Show debug log' for details."
)
@dataclass(slots=True, frozen=True)
@@ -488,13 +500,15 @@ class DevelopersPage:
prefs_label: str
columns: list[str]
developers = DevelopersPage(
header="Developers",
paths_label="Resolved XDG paths",
prefs_label="Boot preferences",
columns=["Key", "Value"]
columns=["Key", "Value"],
)
@dataclass(slots=True, frozen=True)
class ServerLabels:
browser: str
@@ -502,6 +516,7 @@ class ServerLabels:
recent: str
lan: str
server_labels = ServerLabels(
browser="Server Browser",
saved="Saved Servers",
@@ -509,6 +524,7 @@ server_labels = ServerLabels(
lan="LAN",
)
@dataclass(slots=True, frozen=True)
class ConnectPanel:
connect: str
@@ -519,6 +535,7 @@ class ConnectPanel:
add_tooltip: str
connect_tooltip: str
connect_panel = ConnectPanel(
connect="Connect",
add="Add",
@@ -532,16 +549,19 @@ connect_panel = ConnectPanel(
connect_tooltip="Connect to this server",
)
@dataclass(slots=True, frozen=True)
class FavPanel:
heading: str
no_fav: str
fav_panel = FavPanel(
heading="Favorite server",
no_fav="None set. Right click a server and select 'Set favorite' to set.",
)
@dataclass(slots=True, frozen=True)
class LanPanel:
heading: str
@@ -552,6 +572,7 @@ class LanPanel:
entry_tooltip: str
scan_tooltip: str
lan_panel = LanPanel(
heading="LAN query port",
default_button="Default port (27016)",
@@ -559,12 +580,13 @@ lan_panel = LanPanel(
scan_button="Scan",
placeholder="Enter the query port (1-65535)",
entry_tooltip="Specify the port to search for DayZ servers on the local network",
scan_tooltip="Scan for servers"
scan_tooltip="Scan for servers",
)
distance_suffix = "Distance: calculating..."
dialog_error = "ERROR"
@dataclass(slots=True, frozen=True)
class AtomicButton:
refresh: str
@@ -573,6 +595,7 @@ class AtomicButton:
keys: str
keys_tooltip: str
atomic_buttons = AtomicButton(
refresh="Refresh",
refresh_tooltip="Refresh server data",
@@ -580,3 +603,5 @@ atomic_buttons = AtomicButton(
keys="Keys",
keys_tooltip="Toggles the keybindings dialog",
)
steam_icon_missing="Steam icon not found in IconTheme"
+6 -7
View File
@@ -5,10 +5,9 @@ import warnings
from typing import TYPE_CHECKING, Literal
from dzgui.const.enum import NotebookPage
from dzgui.const.constants import APP_NAME, APP_NAME_LOWER
from dzgui.const.constants import APP_NAME, APP_NAME_LOWER, STEAM_TRAY_MONO
from dzgui.controllers.mc import Controller
from dzgui.util import css, strings
from dzgui.util.format import embolden
# NOTEBOOK ITEMS
# TODO: import notebook only and add components there?
@@ -399,8 +398,8 @@ class App(Gtk.Application):
MainController = Controller()
# TODO: icon sanity check, log result
# theme = Gtk.IconTheme.get_default()
# icons = theme.list_icons(None)
# print("steam_tray_mono" in icons)
# FIXME:
theme = Gtk.IconTheme.get_default()
icons = theme.list_icons(None)
if STEAM_TRAY_MONO not in icons:
logger.warn(strings.steam_icon_missing)
warnings.warn(strings.steam_icon_missing, stacklevel=2)