chore: drop unused enums

This commit is contained in:
aclist committed 2026-01-22 16:03:06 +09:00
1 parent df5f146a6e
commit 93c5acb66d
4 files changed
+85 -187

No files matched your search

+84 -178
View File
@@ -9,6 +9,13 @@ class Port(Enum):
CUSTOM = 2 CUSTOM = 2
class ServerTab(Enum):
BROWSER = 1
SAVED = 2
RECENT = 3
LAN = 4
class Popup(Enum): class Popup(Enum):
WAIT = 1 WAIT = 1
NOTIFY = 2 NOTIFY = 2
@@ -59,20 +66,47 @@ class EnumWithAttrs(Enum):
def __init__(self, d: dict): def __init__(self, d: dict):
self.dict = d self.dict = d
class Preferences(EnumWithAttrs): class Preferences(EnumWithAttrs):
STEAM = {"key": "steam_api",} STEAM = {
BM = {"key": "bm_api",} "key": "steam_api",
CLIENT = {"key": "client",} }
WINDOW = {"key": "fullscreen",} BM = {
DIST = {"key": "use_miles",} "key": "bm_api",
NAME = {"key": "name",} }
INSTALL = {"key": "auto_install",} CLIENT = {
DEBUG = {"key": "debug",} "key": "client",
DEFAULT = {"key": "default_steam_path",} }
FAV_LBL = {"key": "fav_label",} WINDOW = {
FAV_SRV = {"key": "fav_server",} "key": "fullscreen",
IP_LIST = {"key": "ip_list",} }
BRANCH = {"key": "branch",} DIST = {
"key": "use_miles",
}
NAME = {
"key": "name",
}
INSTALL = {
"key": "auto_install",
}
DEBUG = {
"key": "debug",
}
DEFAULT = {
"key": "default_steam_path",
}
FAV_LBL = {
"key": "fav_label",
}
FAV_SRV = {
"key": "fav_server",
}
IP_LIST = {
"key": "ip_list",
}
BRANCH = {
"key": "branch",
}
class NotebookPage(EnumWithAttrs): class NotebookPage(EnumWithAttrs):
@@ -93,173 +127,53 @@ class RowType(EnumWithAttrs):
for member in cls: for member in cls:
if string == member.dict["label"]: if string == member.dict["label"]:
return member return member
return RowType.DYNAMIC
# specialized behavior # TODO: add to strings
# TODO: deprecated # SERVER_BROWSER = {
DYNAMIC = { # "label": "Server browser",
"label": None, # "tooltip": "Used to browse the global server list",
"tooltip": None, # "type": "server",
} # }
RESOLVE_IP = { # SAVED_SERVERS = {
"label": "Resolve IP", # "label": "My saved servers",
"tooltip": None, # "tooltip": "Browse your saved servers. Unreachable servers will be excluded",
"wait_msg": "Resolving remote IP", # "type": "server",
} # }
HIGHLIGHT = { # RECENT_SERVERS = {
"label": "Highlight stale", # "label": "Recent servers",
"tooltip": None, # "tooltip": "Shows the last 10 servers you connected to (includes attempts)",
"wait_msg": "Looking for stale mods", # "type": "server",
} # }
# SCAN_LAN = {
# pages # "label": "Scan LAN servers",
SERVER_BROWSER = { # "tooltip": "Search for servers on your local network",
"label": "Server browser", # "type": "server",
"tooltip": "Used to browse the global server list", # }
"type": "server", # LIST_MODS = {
} # "label": "Mods",
SAVED_SERVERS = { # "tooltip": "Browse a list of locally-installed mods",
"label": "My saved servers", # "quad_label": "Mods",
"tooltip": "Browse your saved servers. Unreachable servers will be excluded", # "type": "mods",
"type": "server", # }
}
RECENT_SERVERS = {
"label": "Recent servers",
"tooltip": "Shows the last 10 servers you connected to (includes attempts)",
"type": "server",
}
SCAN_LAN = {
"label": "Scan LAN servers",
"tooltip": "Search for servers on your local network",
"type": "server",
}
LIST_MODS = {
"label": "Mods",
"tooltip": "Browse a list of locally-installed mods",
"quad_label": "Mods",
"type": "mods",
}
CHANGELOG = { CHANGELOG = {
"label": "View changelog", "label": "View changelog",
"tooltip": "Opens the DZGUI changelog", "tooltip": "Opens the DZGUI changelog",
} }
OPTIONS = {"label": "Options", "tooltip": None}
KEYBINDINGS = {"label": "Keybindings", "tooltip": None}
SHOW_LOG = { SHOW_LOG = {
"label": "Show debug log", "label": "Show debug log",
"tooltip": "Read the DZGUI log generated since startup", "tooltip": "Read the DZGUI log generated since startup",
"quad_label": "Debug log", "quad_label": "Debug log",
} }
# interactive dialogs
CONN_BY_IP = {
"label": "Connect by IP",
"tooltip": "Connect to a server by IP",
"prompt": "Enter IP in IP:Queryport format (e.g. 192.168.1.1:27016)",
"link_label": None,
"type": Command.INTERACTIVE,
}
CONN_BY_ID = {
"label": "Connect by ID",
"tooltip": "Connect to a server by Battlemetrics ID",
"prompt": "Enter server ID",
"link_label": "Open Battlemetrics",
"type": Command.INTERACTIVE,
}
SEPARATOR = { SEPARATOR = {
"label" : "SEPARATOR", "label": "SEPARATOR",
"tooltip": "", "tooltip": "",
} }
ADD_BY_IP = {
"label": "Add server by IP",
"tooltip": "Add a server by IP",
"prompt": "Enter IP in IP:Queryport format (e.g. 192.168.1.1:27016)",
"link_label": None,
"type": Command.INTERACTIVE,
}
ADD_BY_ID = {
"label": "Add server by ID",
"tooltip": "Add a server by Battlemetrics ID",
"prompt": "Enter server ID",
"link_label": "Open Battlemetrics",
"type": Command.INTERACTIVE,
}
CHNG_FAV = {
"label": "Change favorite server",
"tooltip": "Update your quick-connect server",
"prompt": "Enter IP in IP:Queryport format (e.g. 192.168.1.1:27016)",
"link_label": None,
"alt": None,
"default": "unset",
"val": "fav_label",
"type": Command.INTERACTIVE,
}
CHNG_PLAYER = {
"label": "Change player name",
"tooltip": "Update your in-game name (required by some servers)",
"prompt": "Enter new nickname",
"link_label": None,
"alt": None,
"default": None,
"val": "name",
"type": Command.INTERACTIVE,
}
CHNG_STEAM_API = {
"label": "Change Steam API key",
"tooltip": "Can be used if you revoked an old API key",
"prompt": "Enter new API key",
"link_label": "Open Steam API page",
"type": Command.INTERACTIVE,
}
CHNG_BM_API = {
"label": "Change Battlemetrics API key",
"tooltip": "Can be used if you revoked an old API key",
"link_label": "Open Battlemetrics API page",
"prompt": "Enter new API key",
"type": Command.INTERACTIVE,
}
# oneshot commands
QUICK_CONNECT = {
"label": "Quick-connect to favorite server",
"tooltip": "Connect to your favorite server",
"wait_msg": "Working",
"default": "unset",
"alt": None,
"val": "fav_label",
"type": Command.ONESHOT,
}
FORCE_UPDATE = {
"label": "Force update local mods",
"tooltip": "Synchronize local mods with remote versions (experimental)",
"wait_msg": "Updating mods",
"type": Command.ONESHOT,
}
DUMP_LOG = { DUMP_LOG = {
"label": "Output system info to log file", "label": "Output system info to log file",
"tooltip": "Dump diagnostic data for troubleshooting", "tooltip": "Dump diagnostic data for troubleshooting",
"wait_msg": "Generating log", "wait_msg": "Generating log",
"type": Command.ONESHOT, "type": Command.ONESHOT,
} }
HANDSHAKE = {
"label": "Handshake",
"tooltip": None,
"wait_msg": "Waiting for DayZ",
"type": Command.ONESHOT,
}
HANDSHAKE_EXP = {
"label": "Handshake_EXP",
"tooltip": None,
"wait_msg": "Waiting for DayZ",
"type": Command.ONESHOT,
}
DELETE_SELECTED = {
"label": "Delete selected mods",
"tooltip": None,
"wait_msg": "Deleting mods",
"type": Command.ONESHOT,
}
# help pages # help pages
DOCS = { DOCS = {
"label": "Documentation/help files (GitHub) ⧉", "label": "Documentation/help files (GitHub) ⧉",
@@ -315,12 +229,9 @@ class ContextMenuGroup(Enum):
""" """
Groupings of context menu items Groupings of context menu items
""" """
MOD = (
ContextMenu.OPEN_WORKSHOP, ContextMenu.DELETE_MOD MOD = (ContextMenu.OPEN_WORKSHOP, ContextMenu.DELETE_MOD)
) LOG = (ContextMenu.COPY_LOG_CLIPBOARD,)
LOG = (
ContextMenu.COPY_LOG_CLIPBOARD,
)
SERVER_BROWSER = ( SERVER_BROWSER = (
ContextMenu.CONNECT, ContextMenu.CONNECT,
ContextMenu.ADD_SERVER, ContextMenu.ADD_SERVER,
@@ -366,6 +277,7 @@ class ContextMenuGroup(Enum):
ContextMenu.REFRESH_PLAYERS, ContextMenu.REFRESH_PLAYERS,
) )
class ModButton(EnumWithAttrs): class ModButton(EnumWithAttrs):
SELECT_ALL = { SELECT_ALL = {
"label": strings.mod_panel.select_all, "label": strings.mod_panel.select_all,
@@ -373,7 +285,7 @@ class ModButton(EnumWithAttrs):
} }
UNSELECT_ALL = { UNSELECT_ALL = {
"label": strings.mod_panel.unselect_all, "label": strings.mod_panel.unselect_all,
"tooltip": strings.mod_panel.unselect_all_tooltip "tooltip": strings.mod_panel.unselect_all_tooltip,
} }
HIGHLIGHT_STALE = { HIGHLIGHT_STALE = {
"label": strings.mod_panel.highlight_stale, "label": strings.mod_panel.highlight_stale,
@@ -388,8 +300,8 @@ class ModButton(EnumWithAttrs):
"tooltip": strings.mod_panel.delete_selected_tooltip, "tooltip": strings.mod_panel.delete_selected_tooltip,
} }
SELECT_STALE = { SELECT_STALE = {
"label": strings.mod_panel.select_stale, "label": strings.mod_panel.select_stale,
"tooltip": strings.mod_panel.select_stale_tooltip, "tooltip": strings.mod_panel.select_stale_tooltip,
} }
@@ -407,8 +319,8 @@ class ButtonType(EnumWithAttrs):
OPTIONS = { OPTIONS = {
"label": strings.buttons.options_label, "label": strings.buttons.options_label,
"tooltip": strings.buttons.options_tooltip, "tooltip": strings.buttons.options_tooltip,
"opens": NotebookPage.OPTIONS "opens": NotebookPage.OPTIONS,
} }
HELP = { HELP = {
"label": strings.buttons.help_label, "label": strings.buttons.help_label,
"tooltip": strings.buttons.help_tooltip, "tooltip": strings.buttons.help_tooltip,
@@ -434,9 +346,3 @@ HELP_MENU_ROWS = (
RowType.SEPARATOR, RowType.SEPARATOR,
RowType.THANKS, RowType.THANKS,
) )
class ServerTab(Enum):
BROWSER = 1
SAVED = 2
RECENT = 3
LAN = 4
+1
View File
@@ -518,6 +518,7 @@ class Controller:
except Exception as e: except Exception as e:
dialog = ExceptionDialog(self, str(e)) dialog = ExceptionDialog(self, str(e))
dialog.run() dialog.run()
return
self.open_page(NotebookPage.LOG) self.open_page(NotebookPage.LOG)
def select_colorized(self) -> None: def select_colorized(self) -> None:
-4
View File
@@ -12,10 +12,6 @@ links = {
RowType.BUGS: endpoints.GITHUB_ISSUES, RowType.BUGS: endpoints.GITHUB_ISSUES,
RowType.FORUM: endpoints.FORUM, RowType.FORUM: endpoints.FORUM,
RowType.SPONSOR: endpoints.SPONSORS, RowType.SPONSOR: endpoints.SPONSORS,
RowType.CHNG_STEAM_API: endpoints.STEAM_API_SETUP,
RowType.CHNG_BM_API: endpoints.BM_API_SETUP,
RowType.CONN_BY_ID: endpoints.BM_BROWSE,
RowType.ADD_BY_ID: endpoints.BM_BROWSE,
} }
-5
View File
@@ -51,11 +51,6 @@ class MenuTreeView(TreeView):
match row_type: match row_type:
case RowType.THANKS: case RowType.THANKS:
self.controller.open_page(NotebookPage.THANKS) self.controller.open_page(NotebookPage.THANKS)
case RowType.SERVER_BROWSER:
# TODO: add threading
# TODO: handle recent, saved, lan, etc.
# self.controller.open_page(NotebookPage.SERVERS)
return
case RowType.SHOW_LOG: case RowType.SHOW_LOG:
self.controller.populate_log() self.controller.populate_log()
case RowType.CHANGELOG: case RowType.CHANGELOG: