From b4da9b938c1be5c04883086c296ace610a67b017 Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Tue, 14 Dec 2021 16:57:45 +0100 Subject: [PATCH] should fix #788 --- AppImageBuilder.yml | 2 +- VERSION | 2 +- data/com.usebottles.bottles.appdata.xml.in | 2 +- debian/changelog | 2 +- src/backend/component.py | 9 ++- src/backend/manager.py | 74 +++++++--------------- src/params.py | 2 +- src/ui/about.ui | 2 +- src/utils.py | 2 +- src/widgets/component.py | 10 ++- 10 files changed, 42 insertions(+), 65 deletions(-) diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml index 8b128b31b0..f917aea32e 100644 --- a/AppImageBuilder.yml +++ b/AppImageBuilder.yml @@ -46,7 +46,7 @@ AppDir: id: com.usebottles.bottles name: Bottles icon: com.usebottles.bottles - version: 2021.12.14-treviso-1 + version: 2021.12.14-treviso-2 # Set the python executable as entry point exec: usr/bin/python3.9 # Set the application main script path as argument. Use '$@' to forward CLI parameters diff --git a/VERSION b/VERSION index 3549c09002..2da280cc14 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2021.12.14-treviso-1 \ No newline at end of file +2021.12.14-treviso-2 \ No newline at end of file diff --git a/data/com.usebottles.bottles.appdata.xml.in b/data/com.usebottles.bottles.appdata.xml.in index f10cea0b52..211eca860c 100644 --- a/data/com.usebottles.bottles.appdata.xml.in +++ b/data/com.usebottles.bottles.appdata.xml.in @@ -82,7 +82,7 @@ 768 - +

News

    diff --git a/debian/changelog b/debian/changelog index 825b648ea4..ca605aaf43 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -com.usebottles.bottles (2021.12.14-treviso-1) precise; urgency=low +com.usebottles.bottles (2021.12.14-treviso-2) precise; urgency=low * A status page is now shown when there are no programs/states/installers * The Versioning feature is now available diff --git a/src/backend/component.py b/src/backend/component.py index 68f8d3bc01..ee30b55b02 100644 --- a/src/backend/component.py +++ b/src/backend/component.py @@ -25,6 +25,7 @@ from gi.repository import GLib from typing import Union +from .result import Result from ..operation import OperationManager from .globals import Paths, BottlesRepositories from ..utils import UtilsLogger, UtilsFiles, RunAsync @@ -381,8 +382,8 @@ def install( ''' manifest = self.get_component(component_type, component_name) - if not manifest and not isinstance(func, bool): - return func(failed=True) + if not manifest: + return Result(False) logging.info(f"Installing component: [{component_name}].") @@ -444,9 +445,7 @@ def install( self.__manager.organize_components() - # Execute a method at the end if passed - if after: - GLib.idle_add(after) + return Result(True) def __post_rename(self, component_type: str, post: dict): source = post.get("source") diff --git a/src/backend/manager.py b/src/backend/manager.py index afffc04b6e..5e83950e82 100644 --- a/src/backend/manager.py +++ b/src/backend/manager.py @@ -259,7 +259,7 @@ def remove_program(self, config: BottleConfig, program_name: str): Runner.run_uninstaller(config, uuid) - def check_runners(self, install_latest: bool = True, after=False) -> bool: + def check_runners(self, install_latest: bool = True) -> bool: ''' This function checks for installed Bottles and system runners and appends them to the runners_available list. If there are no runners @@ -330,8 +330,7 @@ def check_runners(self, install_latest: bool = True, after=False) -> bool: runner_name = next(iter(tmp_runners)) self.component_manager.install( component_type="runner", - component_name=runner_name, - after=after + component_name=runner_name ) except StopIteration: return False @@ -347,8 +346,7 @@ def check_runners(self, install_latest: bool = True, after=False) -> bool: def check_dxvk( self, - install_latest: bool = True, - no_async: bool = False + install_latest: bool = True ) -> bool: ''' This function check for installed DXVKs and appends them to the @@ -373,19 +371,11 @@ def check_dxvk( # if connected, install latest dxvk from repository try: dxvk_version = next(iter(self.supported_dxvk)) - if no_async: - self.component_manager.install( - component_type="dxvk", - component_name=dxvk_version, - checks=False - ) - else: - RunAsync( - task_func=self.component_manager.install, - component_type="dxvk", - component_name=dxvk_version, - checks=False - ) + self.component_manager.install( + component_type="dxvk", + component_name=dxvk_version, + checks=False + ) except StopIteration: return False else: @@ -394,8 +384,7 @@ def check_dxvk( def check_vkd3d( self, - install_latest: bool = True, - no_async: bool = False + install_latest: bool = True ) -> bool: ''' This function check for installed VKD3Ds and appends them to the @@ -421,19 +410,11 @@ def check_vkd3d( # if connected, install latest vkd3d from repository try: vkd3d_version = next(iter(self.supported_vkd3d)) - if no_async: - self.component_manager.install( - component_type="vkd3d", - component_name=vkd3d_version, - checks=False - ) - else: - RunAsync( - task_func=self.component_manager.install, - component_type="vkd3d", - component_name=vkd3d_version, - checks=False - ) + self.component_manager.install( + component_type="vkd3d", + component_name=vkd3d_version, + checks=False + ) except StopIteration: return False else: @@ -442,8 +423,7 @@ def check_vkd3d( def check_nvapi( self, - install_latest: bool = True, - no_async: bool = False + install_latest: bool = True ) -> bool: ''' This function checks for installed NVAPIs and appends them to the @@ -469,19 +449,11 @@ def check_nvapi( # if connected, install latest nvapi from repository try: nvapi_version = next(iter(self.supported_nvapi)) - if no_async: - self.component_manager.install( - component_type="nvapi", - component_name=nvapi_version, - checks=False - ) - else: - RunAsync( - task_func=self.component_manager.install, - component_type="nvapi", - component_name=nvapi_version, - checks=False - ) + self.component_manager.install( + component_type="nvapi", + component_name=nvapi_version, + checks=False + ) except StopIteration: return False else: @@ -946,9 +918,9 @@ def log_update(message): logging.error("Missing essential components. Installing…") log_update(_("Missing essential components. Installing…")) self.check_runners() - self.check_dxvk(no_async=True) - self.check_vkd3d(no_async=True) - self.check_nvapi(no_async=True) + self.check_dxvk() + self.check_vkd3d() + self.check_nvapi() self.organize_components() # default components versions if not specified diff --git a/src/params.py b/src/params.py index c291887c77..145c679640 100644 --- a/src/params.py +++ b/src/params.py @@ -2,7 +2,7 @@ APP_NAME = "Bottles" APP_NAME_LOWER = APP_NAME.lower() APP_ID = "com.usebottles.bottles" -VERSION = "2021.12.14-treviso-1" +VERSION = "2021.12.14-treviso-2" # Internal settings not user editable ANIM_DURATION = 120 diff --git a/src/ui/about.ui b/src/ui/about.ui index f2d7fd4f2b..bcefccb9bc 100644 --- a/src/ui/about.ui +++ b/src/ui/about.ui @@ -7,7 +7,7 @@ center-on-parent dialog Bottles - 2021.12.14-treviso-1 + 2021.12.14-treviso-2 © 2017-2021 - Bottles Developers Easily manage wineprefix using environments https://usebottles.com diff --git a/src/utils.py b/src/utils.py index b26e5ae8ee..7e13870beb 100644 --- a/src/utils.py +++ b/src/utils.py @@ -313,7 +313,7 @@ def __init__(self, task_func, callback=None, *args, **kwargs): self.source_id = None self.stop_request = threading.Event() - # assert threading.current_thread() is threading.main_thread() + assert threading.current_thread() is threading.main_thread() super(RunAsync, self).__init__( target=self.__target, args=args, kwargs=kwargs) diff --git a/src/widgets/component.py b/src/widgets/component.py index ac4e331310..8132050ad8 100644 --- a/src/widgets/component.py +++ b/src/widgets/component.py @@ -63,6 +63,12 @@ def __init__(self, window, component, component_type, **kwargs): self.btn_browse.connect('pressed', self.run_browse) def download(self, widget): + def install_finished(result, error=False): + if result: + return self.set_installed() + + return self.update_status(failed=True) + self.btn_err.set_visible(False) self.btn_download.set_visible(False) self.box_download_status.set_visible(True) @@ -72,10 +78,10 @@ def download(self, widget): RunAsync( task_func=self.component_manager.install, + callback=install_finished, component_type=self.component_type, component_name=self.name, - func=self.update_status, - after=self.set_installed + func=self.update_status ) def run_browse(self, widget):