Skip to content

Commit

Permalink
should fix #788
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin committed Dec 14, 2021
1 parent 6df8748 commit b4da9b9
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 65 deletions.
2 changes: 1 addition & 1 deletion AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.12.14-treviso-1
2021.12.14-treviso-2
2 changes: 1 addition & 1 deletion data/com.usebottles.bottles.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<display_length compare="ge">768</display_length>
</requires>
<releases>
<release version="2021.12.14-treviso-1" date="2021-11-28">
<release version="2021.12.14-treviso-2" date="2021-11-28">
<description>
<p>News</p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions src/backend/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}].")

Expand Down Expand Up @@ -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")
Expand Down
74 changes: 23 additions & 51 deletions src/backend/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ui/about.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<property name="window-position">center-on-parent</property>
<property name="type-hint">dialog</property>
<property name="program-name">Bottles</property>
<property name="version">2021.12.14-treviso-1</property>
<property name="version">2021.12.14-treviso-2</property>
<property name="copyright" translatable="yes">© 2017-2021 - Bottles Developers</property>
<property name="comments" translatable="yes">Easily manage wineprefix using environments</property>
<property name="website">https://usebottles.com</property>
Expand Down
2 changes: 1 addition & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions src/widgets/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit b4da9b9

Please sign in to comment.