mirror of
https://github.com/aclist/dztui.git
synced 2026-11-23 09:59:36 +01:00
chore: abstract options strings
This commit is contained in:
1 parent
aa18129e19
commit
dabcd85990
4 files changed
+44
-99
No files matched your search
+27
-22
@@ -1,28 +1,33 @@
|
|||||||
developers = "Developers"
|
always_fs = "Always fullscreen"
|
||||||
start_tab = "Start tab"
|
|
||||||
workshop_label = "Subscribed mods"
|
|
||||||
steam_combo = "Steam"
|
|
||||||
flatpak_combo = "Flatpak"
|
|
||||||
flatpak_container_combo = "Flatpak (container)"
|
|
||||||
|
|
||||||
steam_placeholder = "Enter your Steam API key"
|
|
||||||
name_placeholder = "Identifies you to other players"
|
|
||||||
|
|
||||||
server_combo = "Server browser"
|
|
||||||
saved_combo = "Saved servers"
|
|
||||||
recent_combo = "Recent"
|
|
||||||
lan_combo = "LAN"
|
|
||||||
|
|
||||||
fullscreen_eventbox = "This option is not available on Steam Deck."
|
|
||||||
save_button = "Save"
|
|
||||||
|
|
||||||
api_placeholder = "Enter API key"
|
|
||||||
api_failed = "API validation failed"
|
api_failed = "API validation failed"
|
||||||
|
api_key = "API Key"
|
||||||
|
api_placeholder = "Enter API key"
|
||||||
api_validate = "Validate"
|
api_validate = "Validate"
|
||||||
|
developers = "Developers"
|
||||||
flatpak_label = "Flatpak client"
|
distance = "Distance display"
|
||||||
flatpak_standard = "Standard"
|
|
||||||
flatpak_container = "Containerized (flatpak-spawn --host)"
|
flatpak_container = "Containerized (flatpak-spawn --host)"
|
||||||
|
flatpak_container_combo = "Flatpak (container)"
|
||||||
flatpak_info = (
|
flatpak_info = (
|
||||||
"Containerized mode is used on certain distributions. May have side effects."
|
"Containerized mode is used on certain distributions. May have side effects."
|
||||||
)
|
)
|
||||||
|
flatpak_label = "Flatpak client"
|
||||||
|
flatpak_standard = "Standard"
|
||||||
|
fullscreen_eventbox = "This option is not available on Steam Deck."
|
||||||
|
header = "Options"
|
||||||
|
km = "km (kilometers)"
|
||||||
|
lan_combo = "LAN"
|
||||||
|
last_used = "Last used dimensions"
|
||||||
|
mi="mi (miles)"
|
||||||
|
name = "Player name"
|
||||||
|
name_placeholder = "Identifies you to other players"
|
||||||
|
prefs = "Preferences"
|
||||||
|
recent_combo = "Recent"
|
||||||
|
save_button = "Save"
|
||||||
|
saved_combo = "Saved servers"
|
||||||
|
server_combo = "Server browser"
|
||||||
|
start_tab = "Start tab"
|
||||||
|
steam_combo = "Steam"
|
||||||
|
steam_placeholder = "Enter your Steam API key"
|
||||||
|
steam_web = "Steam API page"
|
||||||
|
version = "Version"
|
||||||
|
window_size = "Window size at boot"
|
||||||
@@ -16,35 +16,6 @@ class Init:
|
|||||||
requires_steam: str
|
requires_steam: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass(slots=True, frozen=True)
|
|
||||||
class Options:
|
|
||||||
header: str
|
|
||||||
steam_web: str
|
|
||||||
enter_steam: str
|
|
||||||
steam_placeholder: str
|
|
||||||
name_placeholder: str
|
|
||||||
last_used: str
|
|
||||||
always_fs: str
|
|
||||||
steam: str
|
|
||||||
flatpak: str
|
|
||||||
km: str
|
|
||||||
mi: str
|
|
||||||
client: str
|
|
||||||
window_size: str
|
|
||||||
distance: str
|
|
||||||
name: str
|
|
||||||
manual_dl: str
|
|
||||||
auto_dl: str
|
|
||||||
update: str
|
|
||||||
api_key: str
|
|
||||||
prefs: str
|
|
||||||
mods: str
|
|
||||||
version: str
|
|
||||||
branch: str
|
|
||||||
stable: str
|
|
||||||
testing: str
|
|
||||||
|
|
||||||
|
|
||||||
# General
|
# General
|
||||||
dz = "DayZ"
|
dz = "DayZ"
|
||||||
dz_exp = "DayZ Experimental"
|
dz_exp = "DayZ Experimental"
|
||||||
@@ -120,34 +91,6 @@ init = Init(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
options = Options(
|
|
||||||
header="Options",
|
|
||||||
steam_web="Steam API page",
|
|
||||||
enter_steam="Enter your Steam API key",
|
|
||||||
steam_placeholder="Steam API key",
|
|
||||||
name_placeholder="Identifies you to other players in-game",
|
|
||||||
last_used="Last used dimensions",
|
|
||||||
always_fs="Always fullscreen",
|
|
||||||
steam="Steam",
|
|
||||||
flatpak="Flatpak (experimental)",
|
|
||||||
km="km (kilometers)",
|
|
||||||
mi="mi (miles)",
|
|
||||||
client="Steam client",
|
|
||||||
window_size="Window size at boot",
|
|
||||||
distance="Distance display",
|
|
||||||
name="Player name",
|
|
||||||
manual_dl="Manual",
|
|
||||||
auto_dl="Auto",
|
|
||||||
update="Update",
|
|
||||||
api_key="API Key",
|
|
||||||
prefs="Preferences",
|
|
||||||
mods="Mods",
|
|
||||||
version="Version",
|
|
||||||
branch="DZGUI branch",
|
|
||||||
stable="Stable",
|
|
||||||
testing="Testing",
|
|
||||||
)
|
|
||||||
|
|
||||||
server_labels = ServerLabels(
|
server_labels = ServerLabels(
|
||||||
browser="Server Browser",
|
browser="Server Browser",
|
||||||
saved="Saved Servers",
|
saved="Saved Servers",
|
||||||
|
|||||||
@@ -3,9 +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.icons import ICON_VIEW_CONCEAL, ICON_VIEW_REVEAL
|
from dzgui.const.icons import ICON_VIEW_CONCEAL, ICON_VIEW_REVEAL
|
||||||
from dzgui.util.css import add_class, remove_class
|
from dzgui.util.css import add_class, remove_class
|
||||||
from dzgui.strings import connect_panel
|
from dzgui.strings import connect_panel, errors, options
|
||||||
from dzgui.strings.options import api_placeholder, api_validate
|
|
||||||
from dzgui.strings.errors import api_popover
|
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
@@ -144,7 +142,7 @@ class APIEntry(Gtk.Box):
|
|||||||
self.func: Callable[[str], None] | None = None
|
self.func: Callable[[str], None] | None = None
|
||||||
|
|
||||||
self.entry = Gtk.Entry(
|
self.entry = Gtk.Entry(
|
||||||
width_chars=60, hexpand=True, placeholder_text=api_placeholder
|
width_chars=60, hexpand=True, placeholder_text=options.api_placeholder
|
||||||
)
|
)
|
||||||
self.entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, ICON_VIEW_REVEAL)
|
self.entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, ICON_VIEW_REVEAL)
|
||||||
self.entry.set_icon_activatable(Gtk.EntryIconPosition.SECONDARY, True)
|
self.entry.set_icon_activatable(Gtk.EntryIconPosition.SECONDARY, True)
|
||||||
@@ -153,13 +151,13 @@ class APIEntry(Gtk.Box):
|
|||||||
self.entry.connect("icon-release", self._on_icon_release)
|
self.entry.connect("icon-release", self._on_icon_release)
|
||||||
self.entry.connect("activate", self._on_field_activated)
|
self.entry.connect("activate", self._on_field_activated)
|
||||||
|
|
||||||
self.submit = Gtk.Button(label=api_validate)
|
self.submit = Gtk.Button(label=options.api_validate)
|
||||||
self.submit.set_sensitive(False)
|
self.submit.set_sensitive(False)
|
||||||
self.submit.connect("clicked", self._on_submit)
|
self.submit.connect("clicked", self._on_submit)
|
||||||
|
|
||||||
self.pop = Gtk.Popover()
|
self.pop = Gtk.Popover()
|
||||||
self.pop_label = Gtk.Label(
|
self.pop_label = Gtk.Label(
|
||||||
label=api_popover,
|
label=errors.api_popover,
|
||||||
margin_start=10,
|
margin_start=10,
|
||||||
margin_end=10,
|
margin_end=10,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ from dzgui.const.constants import (
|
|||||||
from dzgui.const.endpoints import STEAM_API_SETUP
|
from dzgui.const.endpoints import STEAM_API_SETUP
|
||||||
from dzgui.const.enum import Preferences, ServerTab
|
from dzgui.const.enum import Preferences, ServerTab
|
||||||
from dzgui.const.icons import ICON_VIEW_CONCEAL, ICON_VIEW_REVEAL
|
from dzgui.const.icons import ICON_VIEW_CONCEAL, ICON_VIEW_REVEAL
|
||||||
from dzgui.strings import errors
|
from dzgui.strings import errors, options
|
||||||
from dzgui.strings import options
|
|
||||||
from dzgui.util import strings, css, open_links
|
from dzgui.util import strings, css, open_links
|
||||||
from dzgui.views.components.box import ShortHBox, VBox
|
from dzgui.views.components.box import ShortHBox, VBox
|
||||||
from dzgui.views.components.eventbox import InfoEventBox
|
from dzgui.views.components.eventbox import InfoEventBox
|
||||||
@@ -289,12 +288,12 @@ class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
|
|||||||
self.steam_entry: Gtk.Entry
|
self.steam_entry: Gtk.Entry
|
||||||
self.pop: Gtk.Popover
|
self.pop: Gtk.Popover
|
||||||
|
|
||||||
self.steam = WebButton(label=strings.options.steam_web)
|
self.steam = WebButton(label=options.steam_web)
|
||||||
self.steam.connect("clicked", self._on_link_button_clicked, STEAM_API_SETUP)
|
self.steam.connect("clicked", self._on_link_button_clicked, STEAM_API_SETUP)
|
||||||
|
|
||||||
self.steam_box = SteamSubmitField(controller)
|
self.steam_box = SteamSubmitField(controller)
|
||||||
api_rows = [
|
api_rows = [
|
||||||
[LeftLabel(strings.options.steam_placeholder), self.steam_box, self.steam],
|
[LeftLabel(options.steam_placeholder), self.steam_box, self.steam],
|
||||||
]
|
]
|
||||||
|
|
||||||
self.player_box = NameSubmitField(controller)
|
self.player_box = NameSubmitField(controller)
|
||||||
@@ -304,13 +303,13 @@ class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
|
|||||||
self.flatpak_toggle = FlatpakToggleField(self.controller)
|
self.flatpak_toggle = FlatpakToggleField(self.controller)
|
||||||
self.fullscreen_toggle = ToggleField(
|
self.fullscreen_toggle = ToggleField(
|
||||||
self.controller,
|
self.controller,
|
||||||
strings.options.last_used,
|
options.last_used,
|
||||||
strings.options.always_fs,
|
options.always_fs,
|
||||||
Preferences.WINDOW,
|
Preferences.WINDOW,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.distance_toggle = ToggleField(
|
self.distance_toggle = ToggleField(
|
||||||
self.controller, strings.options.km, strings.options.mi, Preferences.DIST
|
self.controller, options.km, options.mi, Preferences.DIST
|
||||||
)
|
)
|
||||||
|
|
||||||
combo_store = Gtk.ListStore(str, object)
|
combo_store = Gtk.ListStore(str, object)
|
||||||
@@ -332,10 +331,10 @@ class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
|
|||||||
self.start_tab_combo.connect("changed", self._on_start_tab_changed)
|
self.start_tab_combo.connect("changed", self._on_start_tab_changed)
|
||||||
|
|
||||||
pref_rows = [
|
pref_rows = [
|
||||||
[LeftLabel(strings.options.window_size), self.fullscreen_toggle],
|
[LeftLabel(options.window_size), self.fullscreen_toggle],
|
||||||
[LeftLabel(strings.options.distance), self.distance_toggle],
|
[LeftLabel(options.distance), self.distance_toggle],
|
||||||
[LeftLabel(options.start_tab), start_tab_hbox],
|
[LeftLabel(options.start_tab), start_tab_hbox],
|
||||||
[LeftLabel(strings.options.name), self.player_box],
|
[LeftLabel(options.name), self.player_box],
|
||||||
]
|
]
|
||||||
default = self.controller.query_config(Preferences.DEFAULT)
|
default = self.controller.query_config(Preferences.DEFAULT)
|
||||||
if FLATPAK_STEAM_PATH in default:
|
if FLATPAK_STEAM_PATH in default:
|
||||||
@@ -377,16 +376,16 @@ class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
|
|||||||
grid.attach(developers, 1, 0, self.DEFAULT_WIDTH, self.DEFAULT_HEIGHT)
|
grid.attach(developers, 1, 0, self.DEFAULT_WIDTH, self.DEFAULT_HEIGHT)
|
||||||
|
|
||||||
for pair in [
|
for pair in [
|
||||||
(api_box, strings.options.api_key),
|
(api_box, options.api_key),
|
||||||
(prefs_grid, strings.options.prefs),
|
(prefs_grid, options.prefs),
|
||||||
(version_grid, strings.options.version),
|
(version_grid, options.version),
|
||||||
]:
|
]:
|
||||||
|
|
||||||
frame = HeadingFrame.new_with_widget_and_label(*pair)
|
frame = HeadingFrame.new_with_widget_and_label(*pair)
|
||||||
grid.attach(frame, col, row, self.DEFAULT_WIDTH, self.DEFAULT_HEIGHT)
|
grid.attach(frame, col, row, self.DEFAULT_WIDTH, self.DEFAULT_HEIGHT)
|
||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
label = Gtk.Label(label=strings.options.header)
|
label = Gtk.Label(label=options.header)
|
||||||
label.set_halign(Gtk.Align.CENTER)
|
label.set_halign(Gtk.Align.CENTER)
|
||||||
css.add_class(label, "page-heading")
|
css.add_class(label, "page-heading")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user