From f1035f7765e08bdb80cb0f3ced0b1a543838eefc Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Sun, 7 Jan 2024 23:22:55 +0100 Subject: [PATCH] Fix exception when changing install path in preferences --- CHANGELOG.md | 3 ++- minigalaxy/ui/preferences.py | 5 +++-- minigalaxy/ui/window.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 040273fc..21f5b55e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ **1.2.6** -- Fix error detection & reporting on wineprefix creation failure +- Fix changing the install path causing an exception +- Fix error detection & reporting on wineprefix creation failure (thanks to LeXofLeviafan) **1.2.5** - Fix filtering for installed games diff --git a/minigalaxy/ui/preferences.py b/minigalaxy/ui/preferences.py index 9e5e8bf8..41c78d57 100644 --- a/minigalaxy/ui/preferences.py +++ b/minigalaxy/ui/preferences.py @@ -27,10 +27,11 @@ class Preferences(Gtk.Dialog): button_cancel = Gtk.Template.Child() button_save = Gtk.Template.Child() - def __init__(self, parent, config: Config): + def __init__(self, parent, config: Config, download_manager: DownloadManager): Gtk.Dialog.__init__(self, title=_("Preferences"), parent=parent, modal=True) self.parent = parent self.config = config + self.download_manager = download_manager self.__set_locale_list() self.__set_language_list() @@ -199,7 +200,7 @@ def save_pressed(self, button): # Only change the install_dir is it was actually changed if self.button_file_chooser.get_filename() != self.config.install_dir: if self.__save_install_dir_choice(): - DownloadManager.cancel_all_downloads() + self.download_manager.cancel_all_downloads() self.parent.reset_library() else: self.parent.show_error(_("{} isn't a usable path").format(self.button_file_chooser.get_filename())) diff --git a/minigalaxy/ui/window.py b/minigalaxy/ui/window.py index 20fb2977..9558cdca 100644 --- a/minigalaxy/ui/window.py +++ b/minigalaxy/ui/window.py @@ -42,6 +42,7 @@ def __init__(self, config: Config, api: 'Api', download_manager: DownloadManager self.api = api self.config = config + self.download_manager = download_manager self.search_string = "" self.offline = False @@ -95,7 +96,7 @@ def filter_library(self, switch, _=""): @Gtk.Template.Callback("on_menu_preferences_clicked") def show_preferences(self, button): - preferences_window = Preferences(self, self.config) + preferences_window = Preferences(parent=self, config=self.config, download_manager=self.download_manager) preferences_window.run() preferences_window.destroy()