mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 15:12:48 +01:00
chore: drop foreground logic
This commit is contained in:
1 parent
c4818d2097
commit
1b0a9c9a69
3 files changed
+10
-33
No files matched your search
@@ -523,11 +523,11 @@ class Controller(GObject.GObject):
|
|||||||
ind = self.config_man.get_start_tab()
|
ind = self.config_man.get_start_tab()
|
||||||
self.get_servers().notebook.set_current_page(ind)
|
self.get_servers().notebook.set_current_page(ind)
|
||||||
|
|
||||||
def update_and_load_to_menu(self, raise_window: bool) -> None:
|
def update_and_load_to_menu(self) -> None:
|
||||||
self.connection_man.update_and_connect(raise_window, menu_only=True)
|
self.connection_man.update_and_connect(menu_only=True)
|
||||||
|
|
||||||
def update_and_connect(self, raise_window: bool) -> None:
|
def update_and_connect(self) -> None:
|
||||||
self.connection_man.update_and_connect(raise_window)
|
self.connection_man.update_and_connect()
|
||||||
|
|
||||||
def update_status(self) -> None:
|
def update_status(self) -> None:
|
||||||
self.mediator.preconnect.mark_finished()
|
self.mediator.preconnect.mark_finished()
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class ConnectionManager:
|
|||||||
self.controller.add_to_history(self.history, self.record)
|
self.controller.add_to_history(self.history, self.record)
|
||||||
self.controller.open_page(NotebookPage.SERVERS)
|
self.controller.open_page(NotebookPage.SERVERS)
|
||||||
|
|
||||||
def _update_mods(self, raise_window: bool, menu_only: bool = False) -> None:
|
def _update_mods(self, menu_only: bool = False) -> None:
|
||||||
prefs = self.controller.get_prefs()
|
prefs = self.controller.get_prefs()
|
||||||
config_man = self.controller.get_config_man()
|
config_man = self.controller.get_config_man()
|
||||||
key = config_man.lookup(Preferences.STEAM)
|
key = config_man.lookup(Preferences.STEAM)
|
||||||
@@ -305,10 +305,6 @@ class ConnectionManager:
|
|||||||
subscribe(key, int(mod))
|
subscribe(key, int(mod))
|
||||||
time.sleep(RATE_LIMIT_THRESHOLD)
|
time.sleep(RATE_LIMIT_THRESHOLD)
|
||||||
|
|
||||||
if raise_window is True:
|
|
||||||
logger.info("Bringing window to foreground")
|
|
||||||
GLib.idle_add(self.controller.present_window)
|
|
||||||
|
|
||||||
for title, mod, stamp, size in self.missing_mods:
|
for title, mod, stamp, size in self.missing_mods:
|
||||||
mod_path = self.workshop / mod
|
mod_path = self.workshop / mod
|
||||||
|
|
||||||
@@ -331,8 +327,8 @@ class ConnectionManager:
|
|||||||
self._connect_steam(menu_only)
|
self._connect_steam(menu_only)
|
||||||
|
|
||||||
@call_on_thread(waiting_for_mods, show_cancel=True)
|
@call_on_thread(waiting_for_mods, show_cancel=True)
|
||||||
def update_and_connect(self, raise_window: bool, menu_only: bool = False) -> None:
|
def update_and_connect(self, menu_only: bool = False) -> None:
|
||||||
if len(self.missing_mods) > 0:
|
if len(self.missing_mods) > 0:
|
||||||
self._update_mods(raise_window, menu_only)
|
self._update_mods(menu_only)
|
||||||
else:
|
else:
|
||||||
self._connect_steam(menu_only)
|
self._connect_steam(menu_only)
|
||||||
@@ -112,18 +112,6 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
tooltip_text=preconnect.connect_last_tooltip,
|
tooltip_text=preconnect.connect_last_tooltip,
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: abstract
|
|
||||||
self.raise_window = Gtk.CheckButton(
|
|
||||||
label="Foreground DZGUI while downloading",
|
|
||||||
halign=Gtk.Align.END,
|
|
||||||
hexpand=True,
|
|
||||||
valign=Gtk.Align.END,
|
|
||||||
visible=False,
|
|
||||||
has_tooltip=True,
|
|
||||||
sensitive=False,
|
|
||||||
tooltip_text="Foreground the DZGUI window after mod downloads are queued",
|
|
||||||
active=True,
|
|
||||||
)
|
|
||||||
self.button_box = Gtk.Box(
|
self.button_box = Gtk.Box(
|
||||||
orientation=Gtk.Orientation.VERTICAL,
|
orientation=Gtk.Orientation.VERTICAL,
|
||||||
valign=Gtk.Align.END,
|
valign=Gtk.Align.END,
|
||||||
@@ -133,8 +121,7 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
|
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
|
||||||
for button in self.back, self.ok, self.connect_last:
|
for button in self.back, self.ok, self.connect_last:
|
||||||
box.add(button)
|
box.add(button)
|
||||||
for el in self.raise_window, box:
|
self.button_box.add(box)
|
||||||
self.button_box.add(el)
|
|
||||||
|
|
||||||
self.back.connect("clicked", self._on_back_clicked)
|
self.back.connect("clicked", self._on_back_clicked)
|
||||||
self.ok.connect("clicked", self._on_ok_clicked)
|
self.ok.connect("clicked", self._on_ok_clicked)
|
||||||
@@ -217,8 +204,6 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
for child in widgets:
|
for child in widgets:
|
||||||
child.set_visible(True)
|
child.set_visible(True)
|
||||||
|
|
||||||
self.raise_window.set_visible(False)
|
|
||||||
self.raise_window.set_sensitive(False)
|
|
||||||
self.ok.set_sensitive(True)
|
self.ok.set_sensitive(True)
|
||||||
self.ok.set_label(preconnect.update_mods)
|
self.ok.set_label(preconnect.update_mods)
|
||||||
|
|
||||||
@@ -230,10 +215,10 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
self.ok.emit("clicked")
|
self.ok.emit("clicked")
|
||||||
|
|
||||||
def _on_connect_last_clicked(self, button: Gtk.Button) -> None:
|
def _on_connect_last_clicked(self, button: Gtk.Button) -> None:
|
||||||
self.controller.update_and_load_to_menu(self.raise_window.get_active())
|
self.controller.update_and_load_to_menu()
|
||||||
|
|
||||||
def _on_ok_clicked(self, button: Gtk.Button) -> None:
|
def _on_ok_clicked(self, button: Gtk.Button) -> None:
|
||||||
self.controller.update_and_connect(self.raise_window.get_active())
|
self.controller.update_and_connect()
|
||||||
|
|
||||||
def _on_back_clicked(self, button: Gtk.Button) -> None:
|
def _on_back_clicked(self, button: Gtk.Button) -> None:
|
||||||
self.controller.open_page(NotebookPage.SERVERS)
|
self.controller.open_page(NotebookPage.SERVERS)
|
||||||
@@ -317,10 +302,6 @@ class PreConnectionAssistant(Gtk.Box):
|
|||||||
|
|
||||||
if prereqs.required_space == 0:
|
if prereqs.required_space == 0:
|
||||||
self.ok.set_label(preconnect.connect)
|
self.ok.set_label(preconnect.connect)
|
||||||
self.raise_window.set_visible(False)
|
|
||||||
else:
|
|
||||||
self.raise_window.set_visible(True)
|
|
||||||
self.raise_window.set_sensitive(True)
|
|
||||||
|
|
||||||
pretty = number(prereqs.required_space)
|
pretty = number(prereqs.required_space)
|
||||||
suffix = f" Need to download {pretty} MiB of mod updates."
|
suffix = f" Need to download {pretty} MiB of mod updates."
|
||||||
|
|||||||
Reference in new issue
Block a user