From 417801ac41f6fe139849dd06b630d96dc900db39 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 22 Nov 2026 14:06:39 +0900 Subject: [PATCH] chore: abstract developers and thanks page --- dzgui/strings/developers.py | 4 +++ dzgui/strings/filepickers.py | 2 ++ dzgui/util/strings.py | 54 +------------------------------ dzgui/views/dialogs/filepicker.py | 19 ++++++++--- dzgui/views/pages/devs.py | 4 +-- dzgui/views/pages/thanks.py | 2 +- 6 files changed, 25 insertions(+), 60 deletions(-) create mode 100644 dzgui/strings/developers.py create mode 100644 dzgui/strings/filepickers.py diff --git a/dzgui/strings/developers.py b/dzgui/strings/developers.py new file mode 100644 index 00000000..8081e111 --- /dev/null +++ b/dzgui/strings/developers.py @@ -0,0 +1,4 @@ +page_header = "Developers" +paths_label="Resolved XDG paths", +prefs_label="Boot preferences", +columns=["Key", "Value"] diff --git a/dzgui/strings/filepickers.py b/dzgui/strings/filepickers.py new file mode 100644 index 00000000..dadfb6e1 --- /dev/null +++ b/dzgui/strings/filepickers.py @@ -0,0 +1,2 @@ +debug_picker_title = "Save the debug log to a file" +diagnostic_picker_title = "Save system diagnostics to a file" diff --git a/dzgui/util/strings.py b/dzgui/util/strings.py index d8e00277..7c3d1216 100644 --- a/dzgui/util/strings.py +++ b/dzgui/util/strings.py @@ -1,11 +1,5 @@ from dataclasses import dataclass -@dataclass(slots=True, frozen=True) -class DevelopersPage: - header: str - paths_label: str - prefs_label: str - columns: list[str] @dataclass(slots=True, frozen=True) class ServerLabels: @@ -32,6 +26,7 @@ class Flags: debug: str map_count: str + @dataclass(slots=True, frozen=True) class ModPanelStrings: header: str @@ -103,13 +98,6 @@ class Crumbs: connect: str -@dataclass(slots=True, frozen=True) -class Thanks: - header: str - description: str - users: list[str] - - @dataclass(slots=True, frozen=True) class Options: header: str @@ -271,8 +259,6 @@ self_workshop = "Open Steam workshop" settings_updated = "Settings updated!" - - 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.", @@ -302,33 +288,6 @@ mod_panel = ModPanelStrings( validate_tooltip="Validates selected mods and updates them if necessary", ) - -thanks = Thanks( - header="# Special thanks", - description=( - "This page recognizes beta testers, collaborators, code " - "contributors, and sponsors of the project in alphabetical order.\n" - "If you wish to be removed from this list, please submit a ticket." - ), - users=[ - "bongjutsu", - "Deku", - "dj3hac", - "finntux", - "GaryBlackbourne", - "jiriks74", - "Johnofwrong", - "MatheusLasserr", - "nolan-perez", - "OnniSaarni", - "scandalouss", - "SnackSBR", - "StevelDusa", - "Thoughtduck216", - ], -) - - options = Options( header="Options", steam_web="Steam API page", @@ -401,7 +360,6 @@ no_mods = "No local mods found." no_servers = "No server metadata to list." - flags = Flags( description="DayZ server browser and mod manager", version="print version information", @@ -416,16 +374,6 @@ api_error = ( ) - - -developers = DevelopersPage( - header="Developers", - paths_label="Resolved XDG paths", - prefs_label="Boot preferences", - columns=["Key", "Value"], -) - - server_labels = ServerLabels( browser="Server Browser", saved="Saved Servers", diff --git a/dzgui/views/dialogs/filepicker.py b/dzgui/views/dialogs/filepicker.py index 2c0e3ccf..a7c912c4 100644 --- a/dzgui/views/dialogs/filepicker.py +++ b/dzgui/views/dialogs/filepicker.py @@ -1,6 +1,7 @@ from pathlib import Path -from dzgui.util.strings import picker +from dzgui.const.constants import DEBUG_LOG, SYSTEM_LOG +from dzgui.strings.filepickers import diagnostic_picker_title, debug_picker_title import gi @@ -9,9 +10,9 @@ from gi.repository import Gtk class FilePicker(Gtk.FileChooserDialog): - def __init__(self, parent: Gtk.Window) -> None: + def __init__(self, parent: Gtk.Window, title: str, placeholder: str) -> None: super().__init__( - title=picker.title, + title=title, action=Gtk.FileChooserAction.SAVE, transient_for=parent, resizable=True, @@ -20,7 +21,7 @@ class FilePicker(Gtk.FileChooserDialog): self.add_buttons("_Save", Gtk.ResponseType.OK) # type: ignore[no-untyped-call] self.set_default_response(Gtk.ResponseType.OK) - self.set_current_name(picker.placeholder) + self.set_current_name(placeholder) def pick_file(self) -> Path | None: res = self.run() # type: ignore[no-untyped-call] @@ -35,6 +36,16 @@ class FilePicker(Gtk.FileChooserDialog): return None +class DiagnosticLogPicker(FilePicker): + def __init__(self, parent: Gtk.Window) -> None: + super().__init__(parent, diagnostic_picker_title, SYSTEM_LOG) + + +class DebugLogPicker(FilePicker): + def __init__(self, parent: Gtk.Window) -> None: + super().__init__(parent, debug_picker_title, DEBUG_LOG) + + class FolderPicker(Gtk.FileChooserDialog): def __init__(self, parent: Gtk.Window, title: str) -> None: super().__init__( diff --git a/dzgui/views/pages/devs.py b/dzgui/views/pages/devs.py index 3eccae81..185a2dbc 100644 --- a/dzgui/views/pages/devs.py +++ b/dzgui/views/pages/devs.py @@ -3,7 +3,7 @@ from typing import Self, Union, TYPE_CHECKING from dzgui.const.enum import NotebookPage from dzgui.util.css import add_class -from dzgui.util.strings import developers +from dzgui.strings import developers from dzgui.views.components.labels import BoldLabel from dzgui.views.trees.tree_base import TreeView @@ -32,7 +32,7 @@ class Developers(Gtk.ScrolledWindow): orientation=Gtk.Orientation.VERTICAL, margin_start=10, margin_end=10 ) - heading = Gtk.Label(label=developers.header) + heading = Gtk.Label(label=developers.page_header) heading.set_halign(Gtk.Align.CENTER) add_class(heading, "page-heading") diff --git a/dzgui/views/pages/thanks.py b/dzgui/views/pages/thanks.py index 88e42567..9f7fc108 100644 --- a/dzgui/views/pages/thanks.py +++ b/dzgui/views/pages/thanks.py @@ -1,7 +1,7 @@ from typing import TYPE_CHECKING from dzgui.util.format import format_pango -from dzgui.util.strings import thanks +from dzgui.strings import thanks from dzgui.views.mixins.help_menu_mixin import HelpMenuMixin from dzgui.views.mixins.scrollable_mixin import ScrollableMixin