chore: clean up structure of panel strings and tooltips

This commit is contained in:
aclist 2026-08-14 02:42:23 +09:00
parent 5532e4e267
commit e9ce292368
4 changed files with 9 additions and 93 deletions

View File

@ -4,10 +4,7 @@ add_popover = "This address is already in your Saved Servers"
add_tooltip="Add to Saved Servers" add_tooltip="Add to Saved Servers"
connect_button="Connect" connect_button="Connect"
connect_tooltip="Connect to this server" connect_tooltip="Connect to this server"
connect_entry_tooltip=( connect_entry_placeholder="Enter IP:Query port (e.g., 192.168.1.1:27016)"
"- IP: format as IP:Query port\ne.g. 192.168.1.1:27016"
)
connect_entry_placeholder="Enter IP (IP:Query port)"
fav_heading="Favorite server" fav_heading="Favorite server"
favs_empty="None set. Right click a server and select 'Set favorite' to set." favs_empty="None set. Right click a server and select 'Set favorite' to set."
@ -18,6 +15,6 @@ lan_custom_button="Custom port"
lan_scan_button="Scan" lan_scan_button="Scan"
lan_abort_tooltip = "Unless you have multiple DayZ servers on your LAN,\nleave this checked to get results faster" 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_checkbox = "Stop scanning on first hit"
lan_placeholder="Enter the query port (1-65535)" 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_entry_tooltip="Specify the port to search for DayZ servers on the local network"
lan_scan_tooltip="Scan for servers" lan_scan_tooltip="Scan for servers"

View File

@ -1,27 +1,6 @@
from dataclasses import dataclass from dataclasses import dataclass
from dzgui.const.constants import SYSTEM_LOG from dzgui.const.constants import SYSTEM_LOG
# TODO: move to util.format.py
def build_missing(build: str) -> str:
msg = (
f"This server is running {build}. You can install "
f"{build} by searching for it in your Steam library. "
f"If you recently installed {build} or moved it to a different drive, "
"restart Steam to allow these changes to synchronize, then try again."
)
return msg
def build_path_invalid(build: str) -> str:
msg = (
f"Steam is reporting that {build} is installed at a non-existent location. "
f"If you recently installed {build} or moved it to a different drive, "
"restart Steam to allow these changes to synchronize, then try again."
)
return msg
# General # General
dialog_header = "DZGUI - Dialog" dialog_header = "DZGUI - Dialog"
@ -527,61 +506,6 @@ server_labels = ServerLabels(
) )
@dataclass(slots=True, frozen=True)
class ConnectPanel:
connect: str
add: str
add_con: str
placeholder: str
entry_tooltip: str
add_tooltip: str
connect_tooltip: str
connect_panel = ConnectPanel(
connect="Connect",
add="Add",
add_con="Add/connect",
placeholder="Enter IP (IP:Query port)",
entry_tooltip=("- IP: format as IP:Query port\ne.g. 192.168.1.1:27016"),
add_tooltip="Add to Saved Servers",
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
default_button: str
custom_button: str
scan_button: str
placeholder: str
entry_tooltip: str
scan_tooltip: str
lan_panel = LanPanel(
heading="LAN query port",
default_button="Default port (27016)",
custom_button="Custom port",
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",
)
distance_suffix = "Distance: calculating..." distance_suffix = "Distance: calculating..."
dialog_error = "ERROR" dialog_error = "ERROR"

View File

@ -6,7 +6,6 @@ from dzgui.strings import buttons
from dzgui.util.strings import ( from dzgui.util.strings import (
alert_button_tooltip, alert_button_tooltip,
atomic_buttons, atomic_buttons,
connect_panel,
) )
from dzgui.const.constants import ( from dzgui.const.constants import (
CLIPBOARD, CLIPBOARD,
@ -18,6 +17,7 @@ from dzgui.const.constants import (
WARNING, WARNING,
WEB_BROWSER, WEB_BROWSER,
) )
from dzgui.strings import connect_panel
import gi import gi
@ -222,7 +222,7 @@ class KeysButton(IconTextButton):
class SteamConnectButton(LargeIconTextButton): class SteamConnectButton(LargeIconTextButton):
def __init__(self) -> None: def __init__(self) -> None:
super().__init__(icon=STEAM_ICON, label=connect_panel.connect) super().__init__(icon=STEAM_ICON, label=connect_panel.connect_button)
self.set_tooltip_text(connect_panel.connect_tooltip) self.set_tooltip_text(connect_panel.connect_tooltip)
@ -242,7 +242,7 @@ class SteamWorkshopButton(SteamTextButton):
class AddButton(IconTextButton): class AddButton(IconTextButton):
def __init__(self) -> None: def __init__(self) -> None:
super().__init__(icon=LIST_ADD, label=connect_panel.add) super().__init__(icon=LIST_ADD, label=connect_panel.add_button)
self.set_tooltip_text(connect_panel.add_tooltip) self.set_tooltip_text(connect_panel.add_tooltip)

View File

@ -3,7 +3,7 @@ from typing import Any, Callable, TYPE_CHECKING
from dzgui.api.servers import validate_ip from dzgui.api.servers import validate_ip
from dzgui.const.constants import VIEW_CONCEAL, VIEW_REVEAL from dzgui.const.constants import VIEW_CONCEAL, VIEW_REVEAL
from dzgui.util.css import add_class, remove_class from dzgui.util.css import add_class, remove_class
from dzgui.util.strings import connect_panel, lan_panel from dzgui.strings import connect_panel
from dzgui.strings.errors import api_popover from dzgui.strings.errors import api_popover
import gi import gi
@ -122,11 +122,8 @@ class IpEntry(ValidatedEntry):
super().__init__( super().__init__(
controller, controller,
func=validate_ip_truthy, func=validate_ip_truthy,
placeholder_text=connect_panel.placeholder, placeholder_text=connect_panel.connect_entry_placeholder,
tooltip_text=connect_panel.entry_tooltip,
) )
self.set_placeholder_text(connect_panel.placeholder)
self.set_tooltip_text(connect_panel.entry_tooltip)
class PortEntry(ValidatedEntry): class PortEntry(ValidatedEntry):
@ -134,11 +131,9 @@ class PortEntry(ValidatedEntry):
super().__init__( super().__init__(
controller, controller,
func=validate_port, func=validate_port,
placeholder_text=connect_panel.placeholder, placeholder_text=connect_panel.lan_entry_placeholder,
tooltip_text=connect_panel.entry_tooltip, tooltip_text=connect_panel.lan_entry_tooltip,
) )
self.set_placeholder_text(lan_panel.placeholder)
self.set_tooltip_text(lan_panel.entry_tooltip)
# TODO: backport to Options page # TODO: backport to Options page