diff --git a/dzgui/const/constants.py b/dzgui/const/constants.py index c0ff071..ce90d9c 100644 --- a/dzgui/const/constants.py +++ b/dzgui/const/constants.py @@ -36,7 +36,7 @@ HEX_GREEN = "#32CD32" HEX_RED = "#FF0000" HEX_ORANGE = "#FFAC1C" -# FIXME: normalize icon names +# TODO: normalize icon names CALCULATOR = "accessories-calculator-symbolic" CARET_DOWN = "go-down-symbolic" CARET_UP = "go-up-symbolic" diff --git a/dzgui/init/dayz.py b/dzgui/init/dayz.py index 01bc271..490cae6 100644 --- a/dzgui/init/dayz.py +++ b/dzgui/init/dayz.py @@ -4,17 +4,24 @@ from pathlib import Path from dzgui.api.steam import get_app_path from dzgui.config.query import lookup -from dzgui.const.constants import APPID_DAYZ, APP_NAME +from dzgui.const.constants import APPID_DAYZ, APP_NAME, APPNAME_DAYZ from dzgui.const.enum import Preferences +from dzgui.strings.preconnect import resync + logger = logging.getLogger(APP_NAME) +class VDFSyncError(Exception): + pass + + def is_dayz_installed(config: Path) -> None: try: path = lookup(config, Preferences.DEFAULT) get_app_path(Path(path), APPID_DAYZ) except Exception as e: logger.critical(e) - raise e + msg = resync.format(APPNAME_DAYZ) + raise VDFSyncError(msg) diff --git a/dzgui/strings/connect_panel.py b/dzgui/strings/connect_panel.py index 94d9e7d..3c05714 100644 --- a/dzgui/strings/connect_panel.py +++ b/dzgui/strings/connect_panel.py @@ -1,20 +1,22 @@ -add_button="Add" -add_con_heading="Add/connect" +from dzgui.const.constants import UDP_PORT + +add_button = "Add" +add_con_heading = "Add/connect" 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_placeholder="Enter IP:Query port (e.g., 192.168.1.1:27016)" +add_tooltip = "Add to Saved Servers" +connect_button = "Connect" +connect_tooltip = "Connect to this server" +connect_entry_placeholder = f"Enter IP:Query port (e.g., 192.168.1.1:{UDP_PORT})" -fav_heading="Favorite server" -favs_empty="None set. Right click a server and select 'Set favorite' to set." +fav_heading = "Favorite server" +favs_empty = "None set. Right click a server and select 'Set favorite' to set." -lan_heading="LAN query port" -lan_default_button="Default port (27016)" -lan_custom_button="Custom port" -lan_scan_button="Scan" +lan_heading = "LAN query port" +lan_default_button = f"Default port ({UDP_PORT})" +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_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" +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" diff --git a/dzgui/strings/preconnect.py b/dzgui/strings/preconnect.py index 274c4b0..cd54196 100644 --- a/dzgui/strings/preconnect.py +++ b/dzgui/strings/preconnect.py @@ -11,8 +11,6 @@ mods = "Mods" total_mods = "Total mods: " up_to_date = "All mods are up to date." all_updated = "All mods updated." -"If you recently installed {build} or moved it to a different drive, " -"restart Steam to allow these changes to synchronize, then try again." required_space = " Need to download {0} MiB of mod updates." placeholder_no_mods = "This server has no mods." @@ -36,6 +34,7 @@ steam_not_running = "'{0}' is set as the default Steam client, but it is either use_desktop_mode = "Use Desktop Mode to download mods on Steam Deck." version_mismatch = "Local client version '{0}' does not match remote version '{1}'." version_missing = "Remote server is running the build '{0}', but it is not installed." +no_errors = "No errors." # Warnings diff --git a/dzgui/strings/uninstall.py b/dzgui/strings/uninstall.py index 1a725ca..f52a2ca 100644 --- a/dzgui/strings/uninstall.py +++ b/dzgui/strings/uninstall.py @@ -30,7 +30,8 @@ path_remove_prefix = "The following path will be removed:" not_installed = "It looks like DZGUI was not previously set up; nothing to uninstall." standalone_uninstall = ( "It looks like you are running the standalone version of DZGUI.\n" - "To finalize the uninstall process, you can remove the 'dzgui' file." + "To finalize the uninstall process, invoke './dzgui self remove',\n" + "then remove the 'dzgui' file." ) system_uninstall = ( "It looks like DZGUI was installed via your system package manager or directly from source code.\n" diff --git a/dzgui/util/symlink.py b/dzgui/util/symlink.py index a686dd2..574ec2b 100644 --- a/dzgui/util/symlink.py +++ b/dzgui/util/symlink.py @@ -2,7 +2,12 @@ import logging from pathlib import Path from dzgui.api.mods import get_local_mod_path, get_local_mod_ids, _hash -from dzgui.const.constants import APPID_DAYZ, APPID_DAYZ_EXP, APP_NAME, DAYZ_COMMUNITY_ROOT +from dzgui.const.constants import ( + APPID_DAYZ, + APPID_DAYZ_EXP, + APP_NAME, + DAYZ_COMMUNITY_ROOT, +) from dzgui.const.enum import Preferences from dzgui.config.query import lookup @@ -20,6 +25,7 @@ def expunge_link(file: Path) -> None: if str(file.stem)[:2] == "@C": file.unlink() + def rebuild_symlinks(config: Path) -> None: # TODO: pass direct path as argument path = lookup(config, Preferences.DEFAULT) @@ -63,10 +69,9 @@ def symlink_mission(steam_path: Path, target: str) -> str: stem = path.name parent = path.parent source = dayz_path.joinpath(DAYZ_COMMUNITY_ROOT) - try: - source.symlink_to(parent) - except Exception: - return "" + if source.exists(): + source.unlink() + source.symlink_to(parent) return f"{DAYZ_COMMUNITY_ROOT}/{stem}" diff --git a/dzgui/views/dialogs/boot.py b/dzgui/views/dialogs/boot.py index 34fb8fe..e16792c 100644 --- a/dzgui/views/dialogs/boot.py +++ b/dzgui/views/dialogs/boot.py @@ -102,7 +102,7 @@ class BootDialog(ColorAwareApp, Gtk.Dialog): # type: ignore margin_top=30, margin_bottom=30, ) - self.error_label = Gtk.Label() + self.error_label = Gtk.Label(margin_start=15, margin_end=15) # TODO: abstract class self.copy_button = ClipboardButton(None, lambda: self.error_label.get_text()) diff --git a/dzgui/views/pages/preconnect.py b/dzgui/views/pages/preconnect.py index 93b0fb6..38bf90e 100644 --- a/dzgui/views/pages/preconnect.py +++ b/dzgui/views/pages/preconnect.py @@ -176,8 +176,7 @@ class PreConnectionAssistant(Gtk.Box): self.error_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.error_tree = MaskedTree(ERROR) - # TODO: strings - self.error_placeholder = Placeholder("No errors.") + self.error_placeholder = Placeholder(preconnect.no_errors) self.error_box.add(self.error_tree) self.error_box.add(self.error_placeholder) self.error_frame = HeadingFrame.new_with_widget_and_label( diff --git a/dzgui/views/trees/tree_servers.py b/dzgui/views/trees/tree_servers.py index f910c6f..3143c6d 100644 --- a/dzgui/views/trees/tree_servers.py +++ b/dzgui/views/trees/tree_servers.py @@ -252,7 +252,6 @@ class ServerTreeView(ContextMixin, TreeView): # type: ignore case Gdk.KEY_c: self.controller.menu_action(ContextMenu.COPY_SERVER_IP, self) case Gdk.KEY_r: - # TODO: unimplemented, needs threading self.controller.menu_action(ContextMenu.REFRESH_PLAYERS, self) else: match event.keyval: diff --git a/pyproject.toml b/pyproject.toml index 234f2e0..45de47b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ description = "DayZ server browser and mod manager for Linux" authors = [ {name = "aclist"} ] -version = "7.0.0b24" +version = "7.0.0b25" license = "GPL-3.0-or-later" license-files = ["LICENSE"] readme = "README.md"