diff --git a/bottles/backend/managers/component.py b/bottles/backend/managers/component.py index 9065f7f337f..ba4bfba239a 100644 --- a/bottles/backend/managers/component.py +++ b/bottles/backend/managers/component.py @@ -44,10 +44,9 @@ # noinspection PyTypeChecker class ComponentManager: - def __init__(self, manager, offline: bool = False): + def __init__(self, manager): self.__manager = manager - self.__repo = manager.repository_manager.get_repo("components", offline) - self.__utils_conn = manager.utils_conn + self.__repo = manager.repository_manager.get_repo("components") @lru_cache def get_component(self, name: str, plain: bool = False) -> dict: @@ -58,9 +57,6 @@ def fetch_catalog(self) -> dict: Fetch all components from the Bottles repository, mark the installed ones and return a dict with the catalog. """ - if not self.__utils_conn.check_connection(): - return {} - catalog = { "runtimes": {}, "wine": {}, diff --git a/bottles/backend/managers/dependency.py b/bottles/backend/managers/dependency.py index 0c95dfc8dbf..29084a02d64 100644 --- a/bottles/backend/managers/dependency.py +++ b/bottles/backend/managers/dependency.py @@ -43,10 +43,9 @@ class DependencyManager: - def __init__(self, manager, offline: bool = False): + def __init__(self, manager): self.__manager = manager - self.__repo = manager.repository_manager.get_repo("dependencies", offline) - self.__utils_conn = manager.utils_conn + self.__repo = manager.repository_manager.get_repo("dependencies") @lru_cache def get_dependency(self, name: str, plain: bool = False) -> str | dict | bool: @@ -59,8 +58,6 @@ def fetch_catalog(self) -> dict: and return these as a dictionary. It also returns an empty dictionary if there are no dependencies or fails to fetch them. """ - if not self.__utils_conn.check_connection(): - return {} catalog = {} index = self.__repo.catalog diff --git a/bottles/backend/managers/installer.py b/bottles/backend/managers/installer.py index 5bf63a53786..bee8140797a 100644 --- a/bottles/backend/managers/installer.py +++ b/bottles/backend/managers/installer.py @@ -36,10 +36,9 @@ class InstallerManager: - def __init__(self, manager, offline: bool = False): + def __init__(self, manager): self.__manager = manager - self.__repo = manager.repository_manager.get_repo("installers", offline) - self.__utils_conn = manager.utils_conn + self.__repo = manager.repository_manager.get_repo("installers") self.__component_manager = manager.component_manager self.__local_resources = {} @@ -68,8 +67,6 @@ def fetch_catalog(self) -> dict: """Fetch the installers catalog from the repository""" catalog = {} index = self.__repo.catalog - if not self.__utils_conn.check_connection(): - return {} for installer in index.items(): catalog[installer[0]] = installer[1] diff --git a/bottles/backend/managers/manager.py b/bottles/backend/managers/manager.py index fb4504d1c6d..915fce417ce 100644 --- a/bottles/backend/managers/manager.py +++ b/bottles/backend/managers/manager.py @@ -53,7 +53,6 @@ from bottles.backend.models.samples import Samples from bottles.backend.state import SignalManager, Signals, Events, EventManager from bottles.backend.utils import yaml -from bottles.backend.utils.connection import ConnectionUtils from bottles.backend.utils.file import FileUtils from bottles.backend.utils.generic import sort_by_version from bottles.backend.utils.gpu import GPUUtils @@ -106,7 +105,6 @@ class Manager(metaclass=Singleton): def __init__( self, g_settings: Any = None, - check_connection: bool = True, is_cli: bool = False, **kwargs, ): @@ -117,14 +115,8 @@ def __init__( # common variables self.is_cli = is_cli self.settings = g_settings or GSettingsStub - self.utils_conn = ConnectionUtils( - force_offline=self.is_cli or self.settings.get_boolean("force-offline") - ) self.data_mgr = DataManager() - _offline = True - - if check_connection: - _offline = not self.utils_conn.check_connection() + _offline = False # validating user-defined Paths.bottles if user_bottles_path := self.data_mgr.get(UserDataKeys.CustomBottlesPath): @@ -137,17 +129,14 @@ def __init__( ) # sub-managers - self.repository_manager = RepositoryManager(get_index=not _offline) - if self.repository_manager.aborted_connections > 0: - self.utils_conn.status = False - _offline = True + self.repository_manager = RepositoryManager() times["RepositoryManager"] = time.time() self.versioning_manager = VersioningManager(self) times["VersioningManager"] = time.time() - self.component_manager = ComponentManager(self, _offline) - self.installer_manager = InstallerManager(self, _offline) - self.dependency_manager = DependencyManager(self, _offline) + self.component_manager = ComponentManager(self) + self.installer_manager = InstallerManager(self) + self.dependency_manager = DependencyManager(self) self.import_manager = ImportManager(self) times["ImportManager"] = time.time() self.steam_manager = SteamManager() @@ -420,25 +409,7 @@ def check_runners(self, install_latest: bool = True) -> bool: if len(tmp_runners) == 0 and install_latest: logging.warning("No managed runners found.") - - if self.utils_conn.check_connection(): - # if connected, install the latest runner from repository - try: - if not self.settings.get_boolean("release-candidate"): - tmp_runners = [] - for runner in self.supported_wine_runners.items(): - if runner[1]["Channel"] not in ["rc", "unstable"]: - tmp_runners.append(runner) - break - runner_name = next(iter(tmp_runners))[0] - else: - tmp_runners = self.supported_wine_runners - runner_name = next(iter(tmp_runners)) - self.component_manager.install("runner", runner_name) - except StopIteration: - return False - else: - return False + return False return True @@ -451,13 +422,6 @@ def check_runtimes(self, install_latest: bool = True) -> bool: runtimes = os.listdir(Paths.runtimes) if len(runtimes) == 0: - if install_latest and self.utils_conn.check_connection(): - logging.warning("No runtime found.") - try: - version = next(iter(self.supported_runtimes)) - return self.component_manager.install("runtime", version) - except StopIteration: - return False return False runtime = runtimes[0] # runtimes cannot be more than one @@ -480,15 +444,6 @@ def check_winebridge( winebridge = os.listdir(Paths.winebridge) if len(winebridge) == 0 or update: - if install_latest and self.utils_conn.check_connection(): - logging.warning("No WineBridge found.") - try: - version = next(iter(self.supported_winebridge)) - self.component_manager.install("winebridge", version) - self.winebridge_available = [version] - return True - except StopIteration: - return False return False version_file = os.path.join(Paths.winebridge, "VERSION") @@ -637,26 +592,7 @@ def __check_component( if len(component["available"]) == 0 and install_latest: logging.warning(f"No {component_type} found.") - - if self.utils_conn.check_connection(): - # if connected, install the latest component from repository - try: - if not self.settings.get_boolean("release-candidate"): - tmp_components = [] - for cpnt in component["supported"].items(): - if cpnt[1]["Channel"] not in ["rc", "unstable"]: - tmp_components.append(cpnt) - break - component_version = next(iter(tmp_components))[0] - else: - tmp_components = component["supported"] - component_version = next(iter(tmp_components)) - self.component_manager.install(component_type, component_version) - component["available"] = [component_version] - except StopIteration: - return False - else: - return False + return False try: return sort_by_version(component["available"]) diff --git a/bottles/backend/managers/repository.py b/bottles/backend/managers/repository.py index 78da3401f7d..41401ccb11d 100644 --- a/bottles/backend/managers/repository.py +++ b/bottles/backend/managers/repository.py @@ -50,19 +50,18 @@ class RepositoryManager: }, } - def __init__(self, get_index=True): + def __init__(self): self.do_get_index = True self.aborted_connections = 0 SignalManager.connect(Signals.ForceStopNetworking, self.__stop_index) self.__check_personals() - if get_index: - self.__get_index() + self.__get_index() - def get_repo(self, name: str, offline: bool = False): + def get_repo(self, name: str): if name in self.__repositories: repo = self.__repositories[name] - return repo["cls"](repo["url"], repo["index"], offline=offline) + return repo["cls"](repo["url"], repo["index"]) logging.error(f"Repository {name} not found") diff --git a/bottles/backend/utils/connection.py b/bottles/backend/utils/connection.py deleted file mode 100644 index acc84a33636..00000000000 --- a/bottles/backend/utils/connection.py +++ /dev/null @@ -1,110 +0,0 @@ -# connection.py -# -# Copyright 2022 brombinmirko -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, in version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -import os -from datetime import datetime -from gettext import gettext as _ - -import pycurl - -from bottles.backend.logger import Logger -from bottles.backend.models.result import Result -from bottles.backend.state import SignalManager, Signals, Notification - -logging = Logger() - - -class ConnectionUtils: - """ - This class is used to check the connection, pinging the official - Bottle's website. If the connection is offline, the user will be - notified and False will be returned, otherwise True. - """ - - _status: bool | None = None - last_check = None - - def __init__(self, force_offline=False, **kwargs): - super().__init__(**kwargs) - self.force_offline = force_offline - self.do_check_connection = True - self.aborted_connections = 0 - SignalManager.connect(Signals.ForceStopNetworking, self.stop_check) - - @property - def status(self) -> bool | None: - return self._status - - @status.setter - def status(self, value: bool): - if value is None: - logging.error("Cannot set network status to None") - return - self._status = value - SignalManager.send(Signals.NetworkStatusChanged, Result(status=self.status)) - - def __curl_progress(self, _download_t, _download_d, _upload_t, _upload_d): - if self.do_check_connection: - return pycurl.E_OK - else: - self.aborted_connections += 1 - return pycurl.E_ABORTED_BY_CALLBACK - - def stop_check(self, res: Result): - if res.status: - self.do_check_connection = False - - def check_connection(self, show_notification=False) -> bool | None: - """check network status, send result through signal NetworkReady and return""" - if self.force_offline or "FORCE_OFFLINE" in os.environ: - logging.info("Forcing offline mode") - self.status = False - return False - - try: - c = pycurl.Curl() - c.setopt(c.URL, "https://ping.usebottles.com") - c.setopt(c.FOLLOWLOCATION, True) - c.setopt(c.NOBODY, True) - c.setopt(c.NOPROGRESS, False) - c.setopt(c.XFERINFOFUNCTION, self.__curl_progress) - c.perform() - - if c.getinfo(pycurl.HTTP_CODE) != 200: - raise Exception("Connection status: offline …") - - self.last_check = datetime.now() - self.status = True - except Exception: - logging.warning("Connection status: offline …") - if show_notification: - SignalManager.send( - Signals.GNotification, - Result( - True, - Notification( - title="Bottles", - text=_("You are offline, unable to download."), - image="network-wireless-disabled-symbolic", - ), - ), - ) - self.last_check = datetime.now() - self.status = False - finally: - self.do_check_connection = True - return self.status diff --git a/bottles/backend/utils/meson.build b/bottles/backend/utils/meson.build index 5af7b7011d2..776b2196004 100644 --- a/bottles/backend/utils/meson.build +++ b/bottles/backend/utils/meson.build @@ -21,7 +21,6 @@ bottles_sources = [ 'yaml.py', 'nvidia.py', 'threading.py', - 'connection.py', 'gsettings_stub.py', 'json.py', 'singleton.py' diff --git a/bottles/frontend/bottles.gresource.xml b/bottles/frontend/bottles.gresource.xml index de4e8a76360..d863a66926f 100644 --- a/bottles/frontend/bottles.gresource.xml +++ b/bottles/frontend/bottles.gresource.xml @@ -7,7 +7,6 @@ window.ui new-bottle-dialog.ui bottles-list-view.ui - loading-view.ui bottle-row.ui check-row.ui task-row.ui diff --git a/bottles/frontend/bottles_list_view.py b/bottles/frontend/bottles_list_view.py index e2cffa18c25..5c5d04d3a5c 100644 --- a/bottles/frontend/bottles_list_view.py +++ b/bottles/frontend/bottles_list_view.py @@ -142,12 +142,11 @@ class BottlesListView(Adw.Bin): # endregion - def __init__(self, window, arg_bottle=None, **kwargs): + def __init__(self, window, **kwargs): super().__init__(**kwargs) # common variables and references self.window = window - self.arg_bottle = arg_bottle # connect signals self.btn_create.connect("clicked", self.window.show_add_view) diff --git a/bottles/frontend/details_dependencies_view.py b/bottles/frontend/details_dependencies_view.py index 41cc42ce427..30e8412c4d8 100644 --- a/bottles/frontend/details_dependencies_view.py +++ b/bottles/frontend/details_dependencies_view.py @@ -64,9 +64,6 @@ def __init__(self, details, config: BottleConfig, **kwargs): ) self.btn_help.connect("clicked", open_doc_url, "bottles/dependencies") - if not self.manager.utils_conn.status: - self.stack.set_visible_child_name("page_offline") - self.spinner_loading.start() def __search_dependencies(self, *_args): @@ -100,9 +97,6 @@ def update(self, _widget=False, config: BottleConfig | None = None): self.config = config # Not sure if it's the best place to make this check - if not self.manager.utils_conn.status: - return - self.stack.set_visible_child_name("page_loading") def new_dependency(dependency, plain=False): diff --git a/bottles/frontend/loading-view.blp b/bottles/frontend/loading-view.blp deleted file mode 100644 index 5967a8d55e9..00000000000 --- a/bottles/frontend/loading-view.blp +++ /dev/null @@ -1,45 +0,0 @@ -using Gtk 4.0; -using Adw 1; - -template $LoadingView: Adw.Bin { - WindowHandle { - hexpand: true; - vexpand: true; - - Box { - orientation: vertical; - - Adw.StatusPage loading_status_page { - title: _("Starting up…"); - hexpand: true; - vexpand: true; - } - - Button btn_go_offline { - margin-bottom: 20; - valign: center; - halign: center; - label: _("Continue Offline"); - - styles [ - "destructive-action", - "pill", - ] - } - - Label label_fetched { - styles [ - "dim-label", - ] - } - - Label label_downloading { - margin-bottom: 20; - - styles [ - "dim-label", - ] - } - } - } -} diff --git a/bottles/frontend/loading_view.py b/bottles/frontend/loading_view.py deleted file mode 100644 index 330f26ac469..00000000000 --- a/bottles/frontend/loading_view.py +++ /dev/null @@ -1,57 +0,0 @@ -# loading_view.py -# -# Copyright 2025 The Bottles Contributors -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, in version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -from gettext import gettext as _ - -from gi.repository import Gtk, Adw - -from bottles.backend.models.result import Result -from bottles.backend.state import SignalManager, Signals -from bottles.frontend.gtk import GtkUtils -from bottles.frontend.params import APP_ID - - -@Gtk.Template(resource_path="/com/usebottles/bottles/loading-view.ui") -class LoadingView(Adw.Bin): - __gtype_name__ = "LoadingView" - __fetched = 0 - - # region widgets - label_fetched = Gtk.Template.Child() - label_downloading = Gtk.Template.Child() - btn_go_offline = Gtk.Template.Child() - loading_status_page = Gtk.Template.Child() - # endregion - - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.loading_status_page.set_icon_name(APP_ID) - self.btn_go_offline.connect("clicked", self.go_offline) - - @GtkUtils.run_in_main_loop - def add_fetched(self, res: Result): - total: int = res.data - self.__fetched += 1 - self.label_downloading.set_text( - _("Downloading ~{0} of packages…").format("20kb") - ) - self.label_fetched.set_text( - _("Fetched {0} of {1} packages").format(self.__fetched, total) - ) - - def go_offline(self, _widget): - SignalManager.send(Signals.ForceStopNetworking, Result(status=True)) diff --git a/bottles/frontend/meson.build b/bottles/frontend/meson.build index 5bf84dd5d2c..cd847cf4c78 100644 --- a/bottles/frontend/meson.build +++ b/bottles/frontend/meson.build @@ -51,7 +51,6 @@ blueprints = custom_target('blueprints', 'library-view.blp', 'bottle-row.blp', 'bottles-list-view.blp', - 'loading-view.blp', 'local-resource-row.blp', 'new-bottle-dialog.blp', 'onboard-dialog.blp', @@ -112,7 +111,6 @@ bottles_sources = [ 'bottle_details_view.py', 'preferences.py', 'importer_view.py', - 'loading_view.py', 'bottle_details_page.py', 'details_installers_view.py', 'details_dependencies_view.py', diff --git a/bottles/frontend/preferences.py b/bottles/frontend/preferences.py index 3fe92492773..f58a056e2e5 100644 --- a/bottles/frontend/preferences.py +++ b/bottles/frontend/preferences.py @@ -163,10 +163,6 @@ def __init__(self, window, **kwargs): self.dlls_stack.set_visible_child_name("dlls_loading") self.dlls_spinner.start() - if not self.manager.utils_conn.status: - self.installers_stack.set_visible_child_name("installers_offline") - self.dlls_stack.set_visible_child_name("dlls_offline") - RunAsync(self.ui_update) # connect signals @@ -195,16 +191,15 @@ def empty_list(self): self.__registry = [] def ui_update(self): - if self.manager.utils_conn.status: - EventManager.wait(Events.ComponentsOrganizing) - GLib.idle_add(self.empty_list) - GLib.idle_add(self.populate_runners_list) - GLib.idle_add(self.populate_dxvk_list) - GLib.idle_add(self.populate_vkd3d_list) - GLib.idle_add(self.populate_nvapi_list) - GLib.idle_add(self.populate_latencyflex_list) - - GLib.idle_add(self.dlls_stack.set_visible_child_name, "dlls_list") + EventManager.wait(Events.ComponentsOrganizing) + GLib.idle_add(self.empty_list) + GLib.idle_add(self.populate_runners_list) + GLib.idle_add(self.populate_dxvk_list) + GLib.idle_add(self.populate_vkd3d_list) + GLib.idle_add(self.populate_nvapi_list) + GLib.idle_add(self.populate_latencyflex_list) + + GLib.idle_add(self.dlls_stack.set_visible_child_name, "dlls_list") def __toggle_night(self, widget, state): if self.settings.get_boolean("dark-theme"): diff --git a/bottles/frontend/window.blp b/bottles/frontend/window.blp index cc3bf7155f2..eecec42e124 100644 --- a/bottles/frontend/window.blp +++ b/bottles/frontend/window.blp @@ -61,9 +61,7 @@ template $BottlesWindow: Adw.ApplicationWindow { SearchBar searchbar {} - Adw.ViewStack stack_main { - vexpand: true; - } + Adw.ViewStack stack_main {} Adw.ViewSwitcherBar view_switcher_bar { stack: stack_main; diff --git a/bottles/frontend/window.py b/bottles/frontend/window.py index c627e8de9b2..634ffe6f475 100644 --- a/bottles/frontend/window.py +++ b/bottles/frontend/window.py @@ -30,7 +30,6 @@ from bottles.backend.models.config import BottleConfig from bottles.backend.models.result import Result from bottles.backend.state import SignalManager, Signals, Notification -from bottles.backend.utils.connection import ConnectionUtils from bottles.backend.utils.threading import RunAsync from bottles.frontend.operation import TaskSyncer from bottles.frontend.params import APP_ID, BASE_ID, PROFILE @@ -39,7 +38,6 @@ from bottles.frontend.importer_view import ImporterView from bottles.frontend.library_view import LibraryView from bottles.frontend.bottles_list_view import BottlesListView -from bottles.frontend.loading_view import LoadingView from bottles.frontend.new_bottle_dialog import NewBottleDialog from bottles.frontend.preferences import PreferencesWindow from bottles.frontend.crash_report_dialog import CrashReportDialog @@ -71,6 +69,7 @@ class BottlesWindow(Adw.ApplicationWindow): previous_page = "" settings = Gio.Settings.new(BASE_ID) argument_executed = False + manager = Manager(settings) def __init__(self, arg_bottle, **kwargs): width = self.settings.get_int("window-width") @@ -78,10 +77,6 @@ def __init__(self, arg_bottle, **kwargs): super().__init__(**kwargs, default_width=width, default_height=height) - self.utils_conn = ConnectionUtils( - force_offline=self.settings.get_boolean("force-offline") - ) - self.manager = None self.arg_bottle = arg_bottle self.app = kwargs.get("application") self.set_icon_name(APP_ID) @@ -125,14 +120,65 @@ def response(dialog, response, *args): logging.error("https://usebottles.com/download/") return - # Loading view - self.page_loading = LoadingView() + tmp_runners = [ + x for x in self.manager.runners_available if not x.startswith("sys-") + ] + if len(tmp_runners) == 0: + self.show_onboard_view() + + # Pages + self.page_details = BottleDetailsView(self) + self.page_list = BottlesListView(self) + self.page_importer = ImporterView(self) + self.page_library = LibraryView(self) + + self.main_leaf.append(self.page_details) + self.main_leaf.append(self.page_importer) + + self.main_leaf.get_page(self.page_details).set_navigatable(False) + self.main_leaf.get_page(self.page_importer).set_navigatable(False) + + self.stack_main.add_titled( + child=self.page_list, name="page_list", title=_("Bottles") + ).set_icon_name(f"{APP_ID}-symbolic") + self.stack_main.add_titled( + child=self.page_library, name="page_library", title=_("Library") + ).set_icon_name("library-symbolic") + + self.page_list.search_bar.set_key_capture_widget(self) + self.btn_search.bind_property( + "active", + self.page_list.search_bar, + "search-mode-enabled", + GObject.BindingFlags.BIDIRECTIONAL, + ) + + self.stack_main.set_visible_child_name("page_list") + + self.settings.bind( + "startup-view", + self.stack_main, + "visible-child-name", + Gio.SettingsBindFlags.DEFAULT, + ) + + self.lock_ui(False) + + user_defined_bottles_path = self.manager.data_mgr.get( + UserDataKeys.CustomBottlesPath + ) + if user_defined_bottles_path and Paths.bottles != user_defined_bottles_path: + dialog = Adw.MessageDialog.new( + self, + _("Custom Bottles Path not Found"), + _( + "Falling back to default path. No bottles from the given path will be listed." + ), + ) + dialog.add_response("cancel", _("_Dismiss")) + dialog.present() - # Populate stack - self.stack_main.add_named( - child=self.page_loading, name="page_loading" - ).set_visible(False) - self.headerbar.add_css_class("flat") + self.check_crash_log() # Signal connections self.btn_donate.connect( @@ -141,7 +187,6 @@ def response(dialog, response, *args): "https://usebottles.com/funding/", ) self.btn_add.connect("clicked", self.show_add_view) - self.btn_noconnection.connect("clicked", self.check_for_connection) self.stack_main.connect("notify::visible-child", self.__on_page_changed) # backend signal handlers @@ -159,7 +204,6 @@ def response(dialog, response, *args): SignalManager.connect(Signals.GNotification, self.g_notification_handler) SignalManager.connect(Signals.GShowUri, self.g_show_uri_handler) - self.__on_start() logging.info( "Bottles Started!", ) @@ -192,109 +236,6 @@ def title(self, title, subtitle: str = ""): self.view_switcher_title.set_title(title) self.view_switcher_title.set_subtitle(subtitle) - def check_for_connection(self, status): - """ - This method checks if the client has an internet connection. - If true, the manager checks will be performed, unlocking all the - features locked for no internet connection. - """ - if self.utils_conn.check_connection(): - self.manager.checks(install_latest=False, first_run=True) - - def __on_start(self): - """ - This method is called before the window is shown. This check if there - is at least one local runner installed. If not, the user will be - prompted with the onboard dialog. - """ - - @GtkUtils.run_in_main_loop - def set_manager(result: Manager, error=None): - self.manager = result - - tmp_runners = [ - x for x in self.manager.runners_available if not x.startswith("sys-") - ] - if len(tmp_runners) == 0: - self.show_onboard_view() - - # Pages - self.page_details = BottleDetailsView(self) - self.page_list = BottlesListView(self, arg_bottle=self.arg_bottle) - self.page_importer = ImporterView(self) - self.page_library = LibraryView(self) - - self.main_leaf.append(self.page_details) - self.main_leaf.append(self.page_importer) - - self.main_leaf.get_page(self.page_details).set_navigatable(False) - self.main_leaf.get_page(self.page_importer).set_navigatable(False) - - self.stack_main.add_titled( - child=self.page_list, name="page_list", title=_("Bottles") - ).set_icon_name(f"{APP_ID}-symbolic") - self.stack_main.add_titled( - child=self.page_library, name="page_library", title=_("Library") - ).set_icon_name("library-symbolic") - - self.page_list.search_bar.set_key_capture_widget(self) - self.btn_search.bind_property( - "active", - self.page_list.search_bar, - "search-mode-enabled", - GObject.BindingFlags.BIDIRECTIONAL, - ) - - if ( - self.stack_main.get_child_by_name( - self.settings.get_string("startup-view") - ) - is None - ): - self.stack_main.set_visible_child_name("page_list") - - self.settings.bind( - "startup-view", - self.stack_main, - "visible-child-name", - Gio.SettingsBindFlags.DEFAULT, - ) - - self.lock_ui(False) - self.headerbar.get_style_context().remove_class("flat") - - user_defined_bottles_path = self.manager.data_mgr.get( - UserDataKeys.CustomBottlesPath - ) - if user_defined_bottles_path and Paths.bottles != user_defined_bottles_path: - dialog = Adw.MessageDialog.new( - self, - _("Custom Bottles Path not Found"), - _( - "Falling back to default path. No bottles from the given path will be listed." - ), - ) - dialog.add_response("cancel", _("_Dismiss")) - dialog.present() - - def get_manager(): - if self.utils_conn.check_connection(): - SignalManager.connect( - Signals.RepositoryFetched, self.page_loading.add_fetched - ) - - # do not redo connection if aborted connection - mng = Manager( - g_settings=self.settings, - check_connection=self.utils_conn.aborted_connections == 0, - ) - return mng - - self.show_loading_view() - RunAsync(get_manager, callback=set_manager) - - self.check_crash_log() - def send_notification(self, title, text, image="", ignore_user=False): """ This method is used to send a notification to the user using @@ -318,10 +259,6 @@ def show_details_view(self, widget=False, config: BottleConfig | None = None): self.main_leaf.set_visible_child(self.page_details) self.page_details.set_config(config or BottleConfig()) - def show_loading_view(self, widget=False): - self.lock_ui() - self.stack_main.set_visible_child_name("page_loading") - def show_onboard_view(self, widget=False): onboard_window = OnboardDialog(self) onboard_window.present()