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
+94 -72

No files matched your search

+2 -4
View File
@@ -467,7 +467,7 @@ class Controller(GObject.GObject):
# NOTE: manipulates mod store # NOTE: manipulates mod store
case ContextMenu.DELETE_MOD: case ContextMenu.DELETE_MOD:
self.delete_single_mod(path) self.delete_single_mod(path)
# TODO: hook treeview changed signal # TODO: hook treeview changed signal automatically
# Gtk.TreeModel, row-inserted/row-deleted # Gtk.TreeModel, row-inserted/row-deleted
self.update_mod_statusbar() self.update_mod_statusbar()
remove_stale_signatures( remove_stale_signatures(
@@ -539,7 +539,6 @@ class Controller(GObject.GObject):
import time import time
time.sleep(1) time.sleep(1)
# TODO: use model managers, etc.
self.data = ( 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, "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], ["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: def dump_test_2(self) -> None:
import time import time
time.sleep(1) time.sleep(1)
# TODO: use model managers, etc.
self.data = ( 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, "185.207.214.16:2302", 0, 0, "a", False],
) )
@@ -582,6 +579,7 @@ class Controller(GObject.GObject):
for row in data: for row in data:
manager.append_row(row) manager.append_row(row)
treeview.set_loaded(True) treeview.set_loaded(True)
# TODO: emit custom "servers finished loading" signal
self.mediator.statusbar.emit("server_page_changed", context) self.mediator.statusbar.emit("server_page_changed", context)
treeview.grab_focus() treeview.grab_focus()
+86 -61
View File
@@ -2,6 +2,7 @@ from dataclasses import dataclass
from dzgui.const.constants import SYSTEM_LOG from dzgui.const.constants import SYSTEM_LOG
def build_missing(build: str) -> str: def build_missing(build: str) -> str:
msg = ( msg = (
f"This server is running {build}. You can install " f"This server is running {build}. You can install "
@@ -20,6 +21,7 @@ def build_path_invalid(build: str) -> str:
) )
return msg return msg
# General # General
dialog_header = "DZGUI - Dialog" dialog_header = "DZGUI - Dialog"
dz = "DayZ" 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." steam_key_missing = "No Steam API key is set."
malformed_mods = "Found mods on system, but was unable to parse results." malformed_mods = "Found mods on system, but was unable to parse results."
steam_missing = "Local Steam installation is not set, possibly malformed config file." 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: api_warn_msg = """No servers returned. Possible causes:
no servers in favorites/history, local network issue, or API key on cooldown. no servers in favorites/history, local network issue, or API key on cooldown.
Return to the main menu, wait 30s, and try again. Return to the main menu, wait 30s, and try again.
If this issue persists, your API key may be defunct. If this issue persists, your API key may be defunct.
""" """
server_timeout = "Timed out when querying server, check IP or try again later" 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 = (
server_protected = ( "Error while contacting server, possibly timed out. Please wait and try again."
)
server_protected = (
"This server is password-protected and you will be " "This server is password-protected and you will be "
"prompted when connecting. Do you want to proceed?" "prompted when connecting. Do you want to proceed?"
) )
# KeybindingsDialog # KeybindingsDialog
navigation = { navigation = {
"Enter/space/double click": "select row item", "Enter/space/double click": "select row item",
@@ -155,13 +160,9 @@ label_main_menu = "Main menu"
# buttons # buttons
ping_servers = "Ping servers" ping_servers = "Ping servers"
debug_mode = "Debug mode" debug_mode = "Debug mode"
debug_tooltip = ( debug_tooltip = "Used to perform a dry run without\n" "actually connecting to a server"
"Used to perform a dry run without\n"
"actually connecting to a server"
)
ping_tooltip = ( ping_tooltip = (
"Refresh the ping for visible servers.\n" "Refresh the ping for visible servers.\n" "Available once per unique filter context"
"Available once per unique filter context"
) )
# statusbar_helptext = "Select a row to see its detailed description" # statusbar_helptext = "Select a row to see its detailed description"
@@ -235,12 +236,14 @@ class Dialog:
working: str working: str
updating_mods: str updating_mods: str
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class Init: class Init:
is_steam_running: str is_steam_running: str
is_dayz_running: str is_dayz_running: str
requires_steam: str requires_steam: str
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class Button: class Button:
servers_label: str servers_label: str
@@ -254,6 +257,7 @@ class Button:
exit_label: str exit_label: str
exit_tooltip: str exit_tooltip: str
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class Crumbs: class Crumbs:
changelog: str changelog: str
@@ -266,12 +270,14 @@ class Crumbs:
thanks: str thanks: str
developers: str developers: str
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class Thanks: class Thanks:
header: str header: str
description: str description: str
users: list[str] users: list[str]
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class Options: class Options:
header: str header: str
@@ -310,42 +316,43 @@ class Options:
testing: str testing: str
manual_sub_msg: str manual_sub_msg: str
init = Init( init = Init(
is_steam_running = "Is Steam running? DZGUI must be run on top of Steam.", 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.", is_dayz_running="Is DayZ already running? DZGUI cannot launch DayZ if another process is using it.",
requires_steam = "DZGUI requires that Steam or Flatpak Steam be installed on the system.", requires_steam="DZGUI requires that Steam or Flatpak Steam be installed on the system.",
) )
mod_panel = ModPanelStrings( mod_panel = ModPanelStrings(
header = "Mod actions", header="Mod actions",
unhighlight_stale = "Unhighlight stale", unhighlight_stale="Unhighlight stale",
unhighlight_stale_tooltip = "Clears highlight from stale mods", unhighlight_stale_tooltip="Clears highlight from stale mods",
highlight_stale = "Highlight stale", highlight_stale="Highlight stale",
highlight_stale_tooltip = ( highlight_stale_tooltip=(
"Shows locally-installed mods which are not used by any server " "Shows locally-installed mods which are not used by any server "
"in your Saved Servers" "in your Saved Servers"
), ),
delete_selected = "Delete selected", delete_selected="Delete selected",
delete_selected_tooltip = "Deletes selected mods from the system", delete_selected_tooltip="Deletes selected mods from the system",
unselect_all = "Unselect all", unselect_all="Unselect all",
unselect_all_tooltip = "Bulk unselects all mods", unselect_all_tooltip="Bulk unselects all mods",
select_all = "Select all", select_all="Select all",
select_all_tooltip = "Bulk selects all mods", select_all_tooltip="Bulk selects all mods",
bulk_select = "Bulk selects all currently highlighted mods", bulk_select="Bulk selects all currently highlighted mods",
clear_highlights = "Clears highlights and reverts the table to a default state", clear_highlights="Clears highlights and reverts the table to a default state",
select_stale = "Select stale", select_stale="Select stale",
select_stale_tooltip = "Only selects highlighted stale mods", select_stale_tooltip="Only selects highlighted stale mods",
) )
thanks = Thanks( thanks = Thanks(
header = "# Special thanks", header="# Special thanks",
description = ( description=(
"This page recognizes beta testers, collaborators, code " "This page recognizes beta testers, collaborators, code "
"contributors, and sponsors of the project in alphabetical order.\n" "contributors, and sponsors of the project in alphabetical order.\n"
"If you wish to be removed from this list, please submit a ticket." "If you wish to be removed from this list, please submit a ticket."
), ),
users = [ users=[
"bongjutsu", "bongjutsu",
"Deku", "Deku",
"dj3hac", "dj3hac",
@@ -383,29 +390,28 @@ options = Options(
manual_dl="Manual", manual_dl="Manual",
auto_dl="Auto", auto_dl="Auto",
update="Update", update="Update",
install_mode = "Mod install mode", install_mode="Mod install mode",
force_update = "Force update local mods", force_update="Force update local mods",
dl_eventbox = ( dl_eventbox=(
"Manual: prompt to subscribe to mods in Steam. " "Manual: prompt to subscribe to mods in Steam. " "Auto: unmanned downloads."
"Auto: unmanned downloads."
), ),
force_eventbox = "Synchronize all local mods. Automatic mode must be enabled.", force_eventbox="Synchronize all local mods. Automatic mode must be enabled.",
self_update = ( self_update=(
"Stable: only contains stable features. " "Stable: only contains stable features. "
"Testing: pre-release beta, contains new features." "Testing: pre-release beta, contains new features."
), ),
no_self_update = ( no_self_update=(
"In-app updates are disabled when DZGUI is " "In-app updates are disabled when DZGUI is "
"installed globally (e.g., via package manager)." "installed globally (e.g., via package manager)."
), ),
api_keys = "API Keys", api_keys="API Keys",
prefs = "Preferences", prefs="Preferences",
mods = "Mods", mods="Mods",
version = "Version", version="Version",
branch = "DZGUI branch", branch="DZGUI branch",
stable = "Stable", stable="Stable",
testing = "Testing", testing="Testing",
manual_sub_msg = """When switching from MANUAL to AUTO mod install mode, manual_sub_msg="""When switching from MANUAL to AUTO mod install mode,
DZGUI will manage mod installation and deletion for you. DZGUI will manage mod installation and deletion for you.
To prevent conflicts with Steam Workshop subscriptions and old mods from being downloaded To prevent conflicts with Steam Workshop subscriptions and old mods from being downloaded
when Steam updates, you should unsubscribe from any existing Workshop mods you manually subscribed to. when Steam updates, you should unsubscribe from any existing Workshop mods you manually subscribed to.
@@ -415,14 +421,14 @@ on the right-hand side.
) )
dialog = Dialog( dialog = Dialog(
querying = "Querying server", querying="Querying server",
fetching = "Fetching server metadata", fetching="Fetching server metadata",
filtering = "Filtering servers", filtering="Filtering servers",
refreshing = "Refreshing player count", refreshing="Refreshing player count",
details = "Fetching details", details="Fetching details",
modlist = "Fetching modlist", modlist="Fetching modlist",
working = "Working", working="Working",
updating_mods = "Updating mods", updating_mods="Updating mods",
) )
buttons = Button( buttons = Button(
@@ -454,6 +460,7 @@ 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."
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class Flags: class Flags:
description: str description: str
@@ -461,6 +468,7 @@ class Flags:
uninstall: str uninstall: str
developers: str developers: str
flags = Flags( flags = Flags(
description="DayZ server browser and mod manager", description="DayZ server browser and mod manager",
version="Print version information", version="Print version information",
@@ -468,17 +476,21 @@ flags = Flags(
developers="Enables developer debugging features", developers="Enables developer debugging features",
) )
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class FilePicker: class FilePicker:
title: str title: str
placeholder: str placeholder: str
picker = FilePicker( picker = FilePicker(
title = "Save diagnostic log to file", title="Save diagnostic log to file",
placeholder = SYSTEM_LOG, 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) @dataclass(slots=True, frozen=True)
@@ -488,13 +500,15 @@ class DevelopersPage:
prefs_label: str prefs_label: str
columns: list[str] columns: list[str]
developers = DevelopersPage( developers = DevelopersPage(
header="Developers", header="Developers",
paths_label="Resolved XDG paths", paths_label="Resolved XDG paths",
prefs_label="Boot preferences", prefs_label="Boot preferences",
columns=["Key", "Value"] columns=["Key", "Value"],
) )
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class ServerLabels: class ServerLabels:
browser: str browser: str
@@ -502,6 +516,7 @@ class ServerLabels:
recent: str recent: str
lan: str lan: str
server_labels = ServerLabels( server_labels = ServerLabels(
browser="Server Browser", browser="Server Browser",
saved="Saved Servers", saved="Saved Servers",
@@ -509,6 +524,7 @@ server_labels = ServerLabels(
lan="LAN", lan="LAN",
) )
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class ConnectPanel: class ConnectPanel:
connect: str connect: str
@@ -519,6 +535,7 @@ class ConnectPanel:
add_tooltip: str add_tooltip: str
connect_tooltip: str connect_tooltip: str
connect_panel = ConnectPanel( connect_panel = ConnectPanel(
connect="Connect", connect="Connect",
add="Add", add="Add",
@@ -532,16 +549,19 @@ connect_panel = ConnectPanel(
connect_tooltip="Connect to this server", connect_tooltip="Connect to this server",
) )
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class FavPanel: class FavPanel:
heading: str heading: str
no_fav: str no_fav: str
fav_panel = FavPanel( fav_panel = FavPanel(
heading="Favorite server", heading="Favorite server",
no_fav="None set. Right click a server and select 'Set favorite' to set.", no_fav="None set. Right click a server and select 'Set favorite' to set.",
) )
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class LanPanel: class LanPanel:
heading: str heading: str
@@ -552,6 +572,7 @@ class LanPanel:
entry_tooltip: str entry_tooltip: str
scan_tooltip: str scan_tooltip: str
lan_panel = LanPanel( lan_panel = LanPanel(
heading="LAN query port", heading="LAN query port",
default_button="Default port (27016)", default_button="Default port (27016)",
@@ -559,12 +580,13 @@ lan_panel = LanPanel(
scan_button="Scan", scan_button="Scan",
placeholder="Enter the query port (1-65535)", placeholder="Enter the query port (1-65535)",
entry_tooltip="Specify the port to search for DayZ servers on the local network", 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..." distance_suffix = "Distance: calculating..."
dialog_error = "ERROR" dialog_error = "ERROR"
@dataclass(slots=True, frozen=True) @dataclass(slots=True, frozen=True)
class AtomicButton: class AtomicButton:
refresh: str refresh: str
@@ -573,6 +595,7 @@ class AtomicButton:
keys: str keys: str
keys_tooltip: str keys_tooltip: str
atomic_buttons = AtomicButton( atomic_buttons = AtomicButton(
refresh="Refresh", refresh="Refresh",
refresh_tooltip="Refresh server data", refresh_tooltip="Refresh server data",
@@ -580,3 +603,5 @@ atomic_buttons = AtomicButton(
keys="Keys", keys="Keys",
keys_tooltip="Toggles the keybindings dialog", 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 typing import TYPE_CHECKING, Literal
from dzgui.const.enum import NotebookPage 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.controllers.mc import Controller
from dzgui.util import css, strings from dzgui.util import css, strings
from dzgui.util.format import embolden
# NOTEBOOK ITEMS # NOTEBOOK ITEMS
# TODO: import notebook only and add components there? # TODO: import notebook only and add components there?
@@ -399,8 +398,8 @@ class App(Gtk.Application):
MainController = Controller() MainController = Controller()
# TODO: icon sanity check, log result theme = Gtk.IconTheme.get_default()
# theme = Gtk.IconTheme.get_default() icons = theme.list_icons(None)
# icons = theme.list_icons(None) if STEAM_TRAY_MONO not in icons:
# print("steam_tray_mono" in icons) logger.warn(strings.steam_icon_missing)
# FIXME: warnings.warn(strings.steam_icon_missing, stacklevel=2)