mirror of
https://github.com/aclist/dztui.git
synced 2026-08-29 03:06:56 +02:00
change: move workshop button to mods page
This commit is contained in:
parent
e8b18d83a5
commit
bfd1d3e0f9
@ -168,7 +168,7 @@ class ContextMenu(EnumWithAttrs):
|
|||||||
COPY_LOG_CLIPBOARD = {"label": strings.copy_log}
|
COPY_LOG_CLIPBOARD = {"label": strings.copy_log}
|
||||||
COPY_SERVER_IP = {"label": strings.copy_ip}
|
COPY_SERVER_IP = {"label": strings.copy_ip}
|
||||||
COPY_SERVER_NAME = {"label": strings.copy_name}
|
COPY_SERVER_NAME = {"label": strings.copy_name}
|
||||||
DELETE_MOD = {"label": strings.delete_mod}
|
UNSUB_MOD = {"label": strings.unsub_mod}
|
||||||
OPEN_WORKSHOP = {"label": strings.open_workshop}
|
OPEN_WORKSHOP = {"label": strings.open_workshop}
|
||||||
REFRESH_PLAYERS = {"label": strings.refresh_players}
|
REFRESH_PLAYERS = {"label": strings.refresh_players}
|
||||||
REMOVE_HISTORY = {"label": strings.remove_history}
|
REMOVE_HISTORY = {"label": strings.remove_history}
|
||||||
@ -184,7 +184,7 @@ class ContextMenuGroup(Enum):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
SERVER_MOD = (ContextMenu.OPEN_WORKSHOP,)
|
SERVER_MOD = (ContextMenu.OPEN_WORKSHOP,)
|
||||||
MOD = (ContextMenu.OPEN_WORKSHOP, ContextMenu.DELETE_MOD)
|
MOD = (ContextMenu.OPEN_WORKSHOP, ContextMenu.UNSUB_MOD)
|
||||||
MOD_OFFLINE = (None,)
|
MOD_OFFLINE = (None,)
|
||||||
LOG = (ContextMenu.COPY_LOG_CLIPBOARD,)
|
LOG = (ContextMenu.COPY_LOG_CLIPBOARD,)
|
||||||
SERVER_BROWSER = (
|
SERVER_BROWSER = (
|
||||||
@ -250,9 +250,9 @@ class ModButton(EnumWithAttrs):
|
|||||||
"label": strings.mod_panel.unhighlight_stale,
|
"label": strings.mod_panel.unhighlight_stale,
|
||||||
"tooltip": strings.mod_panel.unhighlight_stale_tooltip,
|
"tooltip": strings.mod_panel.unhighlight_stale_tooltip,
|
||||||
}
|
}
|
||||||
DELETE_SELECTED = {
|
UNSUB_SELECTED = {
|
||||||
"label": strings.mod_panel.delete_selected,
|
"label": strings.mod_panel.unsub_selected,
|
||||||
"tooltip": strings.mod_panel.delete_selected_tooltip,
|
"tooltip": strings.mod_panel.unsub_selected_tooltip,
|
||||||
}
|
}
|
||||||
SELECT_STALE = {
|
SELECT_STALE = {
|
||||||
"label": strings.mod_panel.select_stale,
|
"label": strings.mod_panel.select_stale,
|
||||||
|
|||||||
@ -233,7 +233,7 @@ class Controller(GObject.GObject):
|
|||||||
mod_man = self.mediator.modtreeview.get_mod_man()
|
mod_man = self.mediator.modtreeview.get_mod_man()
|
||||||
mod_man.toggle_mod_selection(state)
|
mod_man.toggle_mod_selection(state)
|
||||||
|
|
||||||
def delete_mods(
|
def unsub_mods(
|
||||||
self, treeview: Union["ModTreeView", "OfflineModTreeView", None] = None
|
self, treeview: Union["ModTreeView", "OfflineModTreeView", None] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
if treeview is None:
|
if treeview is None:
|
||||||
@ -241,7 +241,7 @@ class Controller(GObject.GObject):
|
|||||||
else:
|
else:
|
||||||
view = treeview
|
view = treeview
|
||||||
mod_man = view.get_mod_man()
|
mod_man = view.get_mod_man()
|
||||||
mod_man.delete_mods()
|
mod_man.unsub_mods()
|
||||||
|
|
||||||
def get_mod_store(self) -> Gtk.TreeModel | None:
|
def get_mod_store(self) -> Gtk.TreeModel | None:
|
||||||
return self.mediator.modtreeview.get_model()
|
return self.mediator.modtreeview.get_model()
|
||||||
|
|||||||
@ -80,8 +80,8 @@ class ContextMenuManager:
|
|||||||
|
|
||||||
if isinstance(self.treeview, (ModTreeView, OfflineModTreeView)):
|
if isinstance(self.treeview, (ModTreeView, OfflineModTreeView)):
|
||||||
match action:
|
match action:
|
||||||
case ContextMenu.DELETE_MOD:
|
case ContextMenu.UNSUB_MOD:
|
||||||
self.controller.delete_mods(self.treeview)
|
self.controller.unsub_mods(self.treeview)
|
||||||
case ContextMenu.OPEN_WORKSHOP:
|
case ContextMenu.OPEN_WORKSHOP:
|
||||||
self.open_mod_page()
|
self.open_mod_page()
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ update_success = "Updated successfully. Please exit and relaunch."
|
|||||||
|
|
||||||
load_error_lan = "Failed to find any servers on your network.\nCheck the server query port or your firewall settings."
|
load_error_lan = "Failed to find any servers on your network.\nCheck the server query port or your firewall settings."
|
||||||
fetching_mods = "Fetching mod metadata"
|
fetching_mods = "Fetching mod metadata"
|
||||||
deleting_mods = "Deleting mods"
|
deleting_mods = "Unsubscribing mods"
|
||||||
scanning_mods = "Scanning mods"
|
scanning_mods = "Scanning mods"
|
||||||
parsing_mods = "Parsing mods"
|
parsing_mods = "Parsing mods"
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ show_mods = "Show server-side mods"
|
|||||||
show_details = "Show server details"
|
show_details = "Show server details"
|
||||||
refresh_players = "Refresh player count"
|
refresh_players = "Refresh player count"
|
||||||
open_workshop = "Open in Steam Workshop"
|
open_workshop = "Open in Steam Workshop"
|
||||||
delete_mod = "Delete mod"
|
unsub_mod = "Unsubscribe mod"
|
||||||
copy_name = "Copy name to clipboard"
|
copy_name = "Copy name to clipboard"
|
||||||
copy_ip = "Copy IP to clipboard"
|
copy_ip = "Copy IP to clipboard"
|
||||||
copy_log = "Copy record(s) to clipboard"
|
copy_log = "Copy record(s) to clipboard"
|
||||||
@ -215,8 +215,8 @@ class ModPanelStrings:
|
|||||||
unhighlight_stale_tooltip: str
|
unhighlight_stale_tooltip: str
|
||||||
highlight_stale: str
|
highlight_stale: str
|
||||||
highlight_stale_tooltip: str
|
highlight_stale_tooltip: str
|
||||||
delete_selected: str
|
unsub_selected: str
|
||||||
delete_selected_tooltip: str
|
unsub_selected_tooltip: str
|
||||||
unselect_all: str
|
unselect_all: str
|
||||||
unselect_all_tooltip: str
|
unselect_all_tooltip: str
|
||||||
select_all: str
|
select_all: str
|
||||||
@ -337,8 +337,8 @@ mod_panel = ModPanelStrings(
|
|||||||
"Shows locally-installed mods which are not used by any server "
|
"Shows locally-installed mods which are not used by any server "
|
||||||
"in your Saved Servers"
|
"in your Saved Servers"
|
||||||
),
|
),
|
||||||
delete_selected="Delete selected",
|
unsub_selected="Unsubscribe selected",
|
||||||
delete_selected_tooltip="Deletes selected mods from the system",
|
unsub_selected_tooltip="Unsubscribes from selected mods",
|
||||||
unselect_all="Unselect all",
|
unselect_all="Unselect all",
|
||||||
unselect_all_tooltip="Bulk unselects all mods",
|
unselect_all_tooltip="Bulk unselects all mods",
|
||||||
select_all="Select all",
|
select_all="Select all",
|
||||||
@ -463,7 +463,7 @@ crumbs = Crumbs(
|
|||||||
thanks="Help > Special thanks",
|
thanks="Help > Special thanks",
|
||||||
developers="Options > Developers",
|
developers="Options > Developers",
|
||||||
default="Servers > ",
|
default="Servers > ",
|
||||||
offline="Mods > Play offline"
|
offline="Mods > Play offline",
|
||||||
)
|
)
|
||||||
|
|
||||||
no_mods = "No local mods found."
|
no_mods = "No local mods found."
|
||||||
|
|||||||
@ -11,7 +11,8 @@ gi.require_version("Gtk", "3.0")
|
|||||||
from gi.repository import Gtk # noqa E402
|
from gi.repository import Gtk # noqa E402
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from dzgui.controllers.mc import Controller, Emitter
|
from dzgui.controllers.mc import Controller
|
||||||
|
from dzgui.controllers.emitter import Emitter
|
||||||
|
|
||||||
|
|
||||||
class EnumeratedModButton(Gtk.Button):
|
class EnumeratedModButton(Gtk.Button):
|
||||||
@ -48,7 +49,7 @@ class ModSelectionPanel(Gtk.Box):
|
|||||||
buttons = (
|
buttons = (
|
||||||
ModButton.SELECT_ALL,
|
ModButton.SELECT_ALL,
|
||||||
ModButton.UNSELECT_ALL,
|
ModButton.UNSELECT_ALL,
|
||||||
ModButton.DELETE_SELECTED,
|
ModButton.UNSUB_SELECTED,
|
||||||
)
|
)
|
||||||
for button in buttons:
|
for button in buttons:
|
||||||
b = EnumeratedModButton(button)
|
b = EnumeratedModButton(button)
|
||||||
@ -100,8 +101,8 @@ class ModSelectionPanel(Gtk.Box):
|
|||||||
self.controller.toggle_mod_selection(True)
|
self.controller.toggle_mod_selection(True)
|
||||||
case ModButton.UNSELECT_ALL:
|
case ModButton.UNSELECT_ALL:
|
||||||
self.controller.toggle_mod_selection(False)
|
self.controller.toggle_mod_selection(False)
|
||||||
case ModButton.DELETE_SELECTED:
|
case ModButton.UNSUB_SELECTED:
|
||||||
self.controller.delete_mods()
|
self.controller.unsub_mods()
|
||||||
case ModButton.HIGHLIGHT_STALE:
|
case ModButton.HIGHLIGHT_STALE:
|
||||||
self.controller.highlight_stale()
|
self.controller.highlight_stale()
|
||||||
case ModButton.UNHIGHLIGHT_STALE:
|
case ModButton.UNHIGHLIGHT_STALE:
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from typing import Self, TYPE_CHECKING
|
from typing import Self, TYPE_CHECKING
|
||||||
from dzgui.const.enum import NotebookPage
|
from dzgui.api.steam import find_user_id
|
||||||
|
from dzgui.const.enum import NotebookPage, Preferences
|
||||||
|
from dzgui.views.components.buttons import SteamWorkshopButton
|
||||||
from dzgui.views.components.scrollable import NoOverlayScrolledWindow
|
from dzgui.views.components.scrollable import NoOverlayScrolledWindow
|
||||||
from dzgui.views.trees.tree_mods import ModTreeView
|
from dzgui.views.trees.tree_mods import ModTreeView
|
||||||
|
|
||||||
@ -26,6 +30,19 @@ class Mods(Gtk.Box):
|
|||||||
self.controller.register_widget("modtreeview", self.tree)
|
self.controller.register_widget("modtreeview", self.tree)
|
||||||
self.emitter = controller.get_emitter()
|
self.emitter = controller.get_emitter()
|
||||||
|
|
||||||
|
# TODO: move
|
||||||
|
default_steam_path = self.controller.query_config(Preferences.DEFAULT)
|
||||||
|
steam_path = Path(default_steam_path)
|
||||||
|
uid = find_user_id(steam_path)
|
||||||
|
|
||||||
|
pretty_uid = "" if uid is None else uid
|
||||||
|
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
|
||||||
|
workshop_button = SteamWorkshopButton()
|
||||||
|
workshop_button.set_margin_top(10)
|
||||||
|
workshop_button.set_margin_bottom(10)
|
||||||
|
workshop_button.connect(
|
||||||
|
"clicked", lambda _: self.controller.open_user_workshop(pretty_uid)
|
||||||
|
)
|
||||||
self.offline_button = Gtk.Button(
|
self.offline_button = Gtk.Button(
|
||||||
label="Play offline",
|
label="Play offline",
|
||||||
halign=Gtk.Align.START,
|
halign=Gtk.Align.START,
|
||||||
@ -34,7 +51,10 @@ class Mods(Gtk.Box):
|
|||||||
)
|
)
|
||||||
self.offline_button.connect("clicked", self._on_offline_clicked)
|
self.offline_button.connect("clicked", self._on_offline_clicked)
|
||||||
|
|
||||||
self.add(self.offline_button)
|
hbox.add(workshop_button)
|
||||||
|
hbox.add(self.offline_button)
|
||||||
|
|
||||||
|
self.add(hbox)
|
||||||
self.add(self.box)
|
self.add(self.box)
|
||||||
|
|
||||||
self.connect("map", self._on_map)
|
self.connect("map", self._on_map)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from pathlib import Path
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from dzgui.api import pefile as PeFile
|
from dzgui.api import pefile as PeFile
|
||||||
from dzgui.api.steam import find_user_id
|
|
||||||
from dzgui.config import query
|
from dzgui.config import query
|
||||||
from dzgui.const.constants import (
|
from dzgui.const.constants import (
|
||||||
APPID_DAYZ,
|
APPID_DAYZ,
|
||||||
@ -19,7 +19,8 @@ from dzgui.const.endpoints import STEAM_API_SETUP, BM_API_SETUP
|
|||||||
from dzgui.const.enum import Preferences, ServerTab
|
from dzgui.const.enum import Preferences, ServerTab
|
||||||
from dzgui.strings import errors, options
|
from dzgui.strings import errors, options
|
||||||
from dzgui.util import strings, css, open_links
|
from dzgui.util import strings, css, open_links
|
||||||
from dzgui.views.components.buttons import SteamWorkshopButton
|
|
||||||
|
# from dzgui.views.components.buttons import SteamWorkshopButton
|
||||||
from dzgui.views.components.labels import LeftLabel
|
from dzgui.views.components.labels import LeftLabel
|
||||||
from dzgui.views.components.eventbox import InfoEventBox
|
from dzgui.views.components.eventbox import InfoEventBox
|
||||||
from dzgui.views.components.buttons import WebButton
|
from dzgui.views.components.buttons import WebButton
|
||||||
@ -134,16 +135,6 @@ class Options(Gtk.Box):
|
|||||||
[LeftLabel(strings.options.name), self.player_box],
|
[LeftLabel(strings.options.name), self.player_box],
|
||||||
]
|
]
|
||||||
|
|
||||||
eb = InfoEventBox(options.workshop_eventbox, controller)
|
|
||||||
|
|
||||||
workshop_button = SteamWorkshopButton()
|
|
||||||
workshop_button.connect(
|
|
||||||
"clicked", lambda _: self.controller.open_user_workshop(self.uid)
|
|
||||||
)
|
|
||||||
mod_rows = [
|
|
||||||
[LeftLabel(options.workshop_label), workshop_button, eb],
|
|
||||||
]
|
|
||||||
|
|
||||||
self.dayz_version_label = Gtk.Label(label=strings.null)
|
self.dayz_version_label = Gtk.Label(label=strings.null)
|
||||||
self.dayz_exp_version_label = Gtk.Label(label=strings.null)
|
self.dayz_exp_version_label = Gtk.Label(label=strings.null)
|
||||||
|
|
||||||
@ -169,7 +160,6 @@ class Options(Gtk.Box):
|
|||||||
api_box.add(api_links_box)
|
api_box.add(api_links_box)
|
||||||
|
|
||||||
prefs_grid = self._make_grid(pref_rows)
|
prefs_grid = self._make_grid(pref_rows)
|
||||||
mods_grid = self._make_grid(mod_rows)
|
|
||||||
version_grid = self._make_grid(version_rows)
|
version_grid = self._make_grid(version_rows)
|
||||||
|
|
||||||
col = 1
|
col = 1
|
||||||
@ -190,7 +180,6 @@ class Options(Gtk.Box):
|
|||||||
for pair in [
|
for pair in [
|
||||||
(api_box, strings.options.api_keys),
|
(api_box, strings.options.api_keys),
|
||||||
(prefs_grid, strings.options.prefs),
|
(prefs_grid, strings.options.prefs),
|
||||||
(mods_grid, strings.options.mods),
|
|
||||||
(version_grid, strings.options.version),
|
(version_grid, strings.options.version),
|
||||||
]:
|
]:
|
||||||
|
|
||||||
@ -416,9 +405,6 @@ class Options(Gtk.Box):
|
|||||||
bm = self.controller.query_config(Preferences.BM)
|
bm = self.controller.query_config(Preferences.BM)
|
||||||
|
|
||||||
steam_path = Path(default_steam_path)
|
steam_path = Path(default_steam_path)
|
||||||
# NOTE: this is a best effort guess at the most recent user
|
|
||||||
uid = find_user_id(steam_path)
|
|
||||||
self.uid = "" if uid is None else uid
|
|
||||||
|
|
||||||
self.old_steam = steam
|
self.old_steam = steam
|
||||||
self.old_bm = bm
|
self.old_bm = bm
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user