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"
connect_button="Connect"
connect_tooltip="Connect to this server"
connect_entry_tooltip=(
"- IP: format as IP:Query port\ne.g. 192.168.1.1:27016"
)
connect_entry_placeholder="Enter IP (IP:Query port)"
connect_entry_placeholder="Enter IP:Query port (e.g., 192.168.1.1:27016)"
fav_heading="Favorite server"
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_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_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_scan_tooltip="Scan for servers"

View File

@ -1,27 +1,6 @@
from dataclasses import dataclass
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
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..."
dialog_error = "ERROR"

View File

@ -6,7 +6,6 @@ from dzgui.strings import buttons
from dzgui.util.strings import (
alert_button_tooltip,
atomic_buttons,
connect_panel,
)
from dzgui.const.constants import (
CLIPBOARD,
@ -18,6 +17,7 @@ from dzgui.const.constants import (
WARNING,
WEB_BROWSER,
)
from dzgui.strings import connect_panel
import gi
@ -222,7 +222,7 @@ class KeysButton(IconTextButton):
class SteamConnectButton(LargeIconTextButton):
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)
@ -242,7 +242,7 @@ class SteamWorkshopButton(SteamTextButton):
class AddButton(IconTextButton):
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)

View File

@ -3,7 +3,7 @@ from typing import Any, Callable, TYPE_CHECKING
from dzgui.api.servers import validate_ip
from dzgui.const.constants import VIEW_CONCEAL, VIEW_REVEAL
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
import gi
@ -122,11 +122,8 @@ class IpEntry(ValidatedEntry):
super().__init__(
controller,
func=validate_ip_truthy,
placeholder_text=connect_panel.placeholder,
tooltip_text=connect_panel.entry_tooltip,
placeholder_text=connect_panel.connect_entry_placeholder,
)
self.set_placeholder_text(connect_panel.placeholder)
self.set_tooltip_text(connect_panel.entry_tooltip)
class PortEntry(ValidatedEntry):
@ -134,11 +131,9 @@ class PortEntry(ValidatedEntry):
super().__init__(
controller,
func=validate_port,
placeholder_text=connect_panel.placeholder,
tooltip_text=connect_panel.entry_tooltip,
placeholder_text=connect_panel.lan_entry_placeholder,
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