Compare commits

...
8 changed files with 64 additions and 6 deletions

No files matched your search

+4
View File
@@ -111,6 +111,10 @@ class Emitter(GObject.GObject):
def check_toggled(self, label: str, state: bool) -> None: def check_toggled(self, label: str, state: bool) -> None:
pass pass
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=())
def servers_timed_out(self) -> None:
pass
@GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object,)) @GObject.Signal(flags=GObject.SignalFlags.RUN_LAST, arg_types=(object,))
def servers_loaded(self, tag: "ServerTab") -> None: def servers_loaded(self, tag: "ServerTab") -> None:
pass pass
+3
View File
@@ -92,6 +92,7 @@ class ServerModelManager:
job = Servers.query_api job = Servers.query_api
params = Servers.params params = Servers.params
servers = [] servers = []
with ThreadPoolExecutor() as executor: with ThreadPoolExecutor() as executor:
futures = [executor.submit(job, key, APPID_DAYZ, param) for param in params] futures = [executor.submit(job, key, APPID_DAYZ, param) for param in params]
for future in as_completed(futures): for future in as_completed(futures):
@@ -414,6 +415,8 @@ class ServerModelManager:
# TODO: disable map, keyword, and filter widgets if model is None # TODO: disable map, keyword, and filter widgets if model is None
# signal driven (servers_empty, servers_failed_to_load) # signal driven (servers_empty, servers_failed_to_load)
self.emitter.emit("servers_timed_out")
if self.preserve_on_fail is False: if self.preserve_on_fail is False:
self.tv.set_model(None) self.tv.set_model(None)
filter_man = self.tv.get_filter_man() filter_man = self.tv.get_filter_man()
+7
View File
@@ -17,3 +17,10 @@ fullscreen_eventbox = "This option is not available on Steam Deck."
save_button = "Save" save_button = "Save"
api_failed = "API validation failed" api_failed = "API validation failed"
flatpak_label = "Flatpak client"
flatpak_standard = "Standard"
flatpak_container = "Containerized (flatpak-spawn --host)"
flatpak_info = (
"Containerized mode is used on certain distributions. May have side effects."
)
+2 -1
View File
@@ -70,7 +70,8 @@ checkbox_steam_shortcut = (
( (
"This creates a standalone copy of DZGUI and adds it to Steam. " "This creates a standalone copy of DZGUI and adds it to Steam. "
"You <b>must restart Steam</b> for the shortcut to appear. This will not replace or update existing shortcuts. " "You <b>must restart Steam</b> for the shortcut to appear. This will not replace or update existing shortcuts. "
"If you update DZGUI when it is launched via Steam, updates will be applied to the Steam version." "If you update DZGUI when it is launched via Steam, updates will be applied to the Steam version. "
"Not available if you selected the Flatpak client as your Steam default."
), ),
) )
checkbox_start_menu = ( checkbox_start_menu = (
+10 -4
View File
@@ -163,18 +163,24 @@ class RefreshButton(IconTextButton):
self.set_tooltip_text(atomic_buttons.refresh_tooltip) self.set_tooltip_text(atomic_buttons.refresh_tooltip)
self.connect("clicked", self._on_refresh_clicked) self.connect("clicked", self._on_refresh_clicked)
emitter.connect("servers_loaded", self.start_decrement) emitter.connect("servers_loaded", self._on_load)
emitter.connect("servers_timed_out", self._on_timeout)
def _on_timeout(self, emitter: "Emitter") -> None:
self.is_clicked = True
self.start_decrement()
def _on_load(self, emitter: "Emitter", tab: "ServerTab") -> None:
self.start_decrement()
def _on_refresh_clicked(self, button: Self) -> None: def _on_refresh_clicked(self, button: Self) -> None:
"""Spawned in a thread""" """Spawned in a thread"""
if self.controller.get_active_treeview().is_loaded() is False:
return
self.is_clicked = True self.is_clicked = True
self.controller.refresh_tree() self.controller.refresh_tree()
# TODO: get server tab enum # TODO: get server tab enum
# if LAN tab, reload existing entries in place # if LAN tab, reload existing entries in place
def start_decrement(self, emitter: "Emitter", tab: "ServerTab") -> None: def start_decrement(self) -> None:
if self.is_clicked is False: if self.is_clicked is False:
return return
if self.loading: if self.loading:
+7
View File
@@ -12,6 +12,7 @@ from dzgui.const.constants import (
APP_NAME, APP_NAME,
APP_NAME_LOWER, APP_NAME_LOWER,
HERO_PATH, HERO_PATH,
FLATPAK_STEAM_PATH,
LEGACY_CONFIG_PATH, LEGACY_CONFIG_PATH,
) )
from dzgui.const.boilerplate import config_boilerplate from dzgui.const.boilerplate import config_boilerplate
@@ -624,6 +625,12 @@ class ShortcutCreationPage(OptionalPageMixin, EnumeratedWizardPage): # type: ig
self.add_start(self.checks_area) self.add_start(self.checks_area)
self.show_all() self.show_all()
self.connect("map", self._on_map) self.connect("map", self._on_map)
self.connect("map", self._toggle_checkbox)
def _toggle_checkbox(self, page: "EnumeratedWizardPage") -> None:
if FLATPAK_STEAM_PATH in str(self.steam_path):
self.steam_checkbox.set_active(False)
self.steam_checkbox.set_sensitive(False)
def _on_start_menu_toggled(self, button: Gtk.CheckButton) -> None: def _on_start_menu_toggled(self, button: Gtk.CheckButton) -> None:
state = button.get_active() state = button.get_active()
+31
View File
@@ -9,6 +9,9 @@ from dzgui.const.constants import (
APPID_DAYZ_EXP, APPID_DAYZ_EXP,
APPNAME_DAYZ, APPNAME_DAYZ,
APPNAME_DAYZ_EXP_HUMAN, APPNAME_DAYZ_EXP_HUMAN,
FLATPAK_RUN_CMD,
FLATPAK_SANDBOX,
FLATPAK_STEAM_PATH,
NO_EXPAND, NO_EXPAND,
NO_FILL, NO_FILL,
NO_PADDING, NO_PADDING,
@@ -246,6 +249,27 @@ class ToggleField(Gtk.Box):
el.set_sensitive(state) el.set_sensitive(state)
class FlatpakToggleField(ToggleField):
def __init__(
self,
controller: "Controller",
) -> None:
super().__init__(
controller,
first_option=options.flatpak_standard,
second_option=options.flatpak_container,
context=Preferences.CLIENT,
)
self.add(InfoEventBox(options.flatpak_info, self.controller))
self.controller = controller
self.radio1.connect("toggled", self._on_radio_toggled, Preferences.CLIENT)
def _on_radio_toggled(self, button: Gtk.RadioButton, context: Preferences) -> None:
cmd = FLATPAK_RUN_CMD if self.radio1.get_active() else FLATPAK_SANDBOX
print(context)
self.controller.update_config(context, cmd)
class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
def __init__(self, controller: "Controller"): def __init__(self, controller: "Controller"):
super().__init__( super().__init__(
@@ -274,6 +298,7 @@ class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
self.player_box.set_halign(Gtk.Align.START) self.player_box.set_halign(Gtk.Align.START)
self.player_box.get_children()[0].set_width_chars(30) # type: ignore self.player_box.get_children()[0].set_width_chars(30) # type: ignore
self.flatpak_toggle = FlatpakToggleField(self.controller)
self.fullscreen_toggle = ToggleField( self.fullscreen_toggle = ToggleField(
self.controller, self.controller,
strings.options.last_used, strings.options.last_used,
@@ -309,6 +334,12 @@ class Options(ScrollableMixin, Gtk.ScrolledWindow): # type: ignore
[LeftLabel(options.start_tab), start_tab_hbox], [LeftLabel(options.start_tab), start_tab_hbox],
[LeftLabel(strings.options.name), self.player_box], [LeftLabel(strings.options.name), self.player_box],
] ]
default = self.controller.query_config(Preferences.DEFAULT)
if FLATPAK_STEAM_PATH in default:
pref_rows.insert(
0,
[LeftLabel(options.flatpak_label), self.flatpak_toggle],
)
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)
-1
View File
@@ -6,7 +6,6 @@ from dzgui.const.constants import (
FLATPAK_ROOT_PATH, FLATPAK_ROOT_PATH,
FLATPAK_RUN_CMD, FLATPAK_RUN_CMD,
FLATPAK_SANDBOX, FLATPAK_SANDBOX,
STEAM_CMD,
) )
from dzgui.init import proc from dzgui.init import proc