diff --git a/package_manager/__init__.py b/package_manager/__init__.py index 4065716..1fb04ce 100644 --- a/package_manager/__init__.py +++ b/package_manager/__init__.py @@ -107,10 +107,6 @@ class SubprocMixin: def quit(self): """Signals the state machine to stop this operator from running.""" - try: - self.cancel(bpy.context) - except AttributeError: - pass self._state = 'QUIT' def invoke(self, context, event): @@ -160,7 +156,6 @@ class SubprocMixin: if not self.process.is_alive(): self.report_process_died() - self.cancel(context) self._finish(context) return {'CANCELLED'} @@ -177,6 +172,10 @@ class SubprocMixin: def _finish(self, context): import multiprocessing + try: + self.cancel(context) + except AttributeError: + pass global bpkg_operation_running @@ -271,7 +270,7 @@ class PACKAGE_OT_install(SubprocMixin, bpy.types.Operator): self.log.debug("Using %s as install path", install_path) import addon_utils - proc = multiprocessing.Process(target=messages.download_and_install_package, + proc = multiprocessing.Process(target=subproc.download_and_install_package, args=(self.pipe_subproc, package, install_path)) return proc diff --git a/package_manager/subproc.py b/package_manager/subproc.py index e862c57..35cd529 100644 --- a/package_manager/subproc.py +++ b/package_manager/subproc.py @@ -26,7 +26,7 @@ def download_and_install_package(pipe_to_blender, package: bpkg.Package, install pipe_to_blender.send(messages.InstallError(err)) raise - pipe_to_blender.send(Success()) + pipe_to_blender.send(messages.Success()) def uninstall_package(pipe_to_blender, package: bpkg.Package, install_path: Path): @@ -41,7 +41,7 @@ def uninstall_package(pipe_to_blender, package: bpkg.Package, install_path: Path for pkgfile in [install_path / Path(p) for p in package.files]: bpkg.utils.rm(pkgfile) - pipe_to_blender.send(Success()) + pipe_to_blender.send(messages.Success()) def refresh_repository(pipe_to_blender, repo_storage_path: Path, repository_url: str):