mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
* OP-5221 - updated settings for custom location of artist zip folder * OP-5221 - updated igniter for custom location of artist zip folder Introduced new function Updated data_dir only after access to Mongo (DB) * OP-5221 - pushed resolving of local folder to OpenPypeVersion Logic in OpenPypeVersion is used even in openpype_version.py * OP-5221 - updates after review * OP-5221 - fix paths should be single paths * OP-5221 - refactor to cls * OP-5221 - refactor Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> * OP-5221 - fix defaults for single paths Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> * OP-5221 - remove unwanted line Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> * OP-5221 - update look of Settings Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Working thread for update."""
|
|
from qtpy import QtCore
|
|
|
|
from .bootstrap_repos import (
|
|
BootstrapRepos,
|
|
OpenPypeVersion
|
|
)
|
|
|
|
|
|
class UpdateThread(QtCore.QThread):
|
|
"""Install Worker thread.
|
|
|
|
This class takes care of finding OpenPype version on user entered path
|
|
(or loading this path from database). If nothing is entered by user,
|
|
OpenPype will create its zip files from repositories that comes with it.
|
|
|
|
If path contains plain repositories, they are zipped and installed to
|
|
user data dir.
|
|
|
|
"""
|
|
progress = QtCore.Signal(int)
|
|
message = QtCore.Signal((str, bool))
|
|
|
|
def __init__(self, parent=None):
|
|
self._result = None
|
|
self._openpype_version = None
|
|
super().__init__(parent)
|
|
|
|
def set_version(self, openpype_version: OpenPypeVersion):
|
|
self._openpype_version = openpype_version
|
|
|
|
def result(self):
|
|
"""Result of finished installation."""
|
|
return self._result
|
|
|
|
def _set_result(self, value):
|
|
if self._result is not None:
|
|
raise AssertionError("BUG: Result was set more than once!")
|
|
self._result = value
|
|
|
|
def run(self):
|
|
"""Thread entry point.
|
|
|
|
Using :class:`BootstrapRepos` to either install OpenPype as zip files
|
|
or copy them from location specified by user or retrieved from
|
|
database.
|
|
"""
|
|
bs = BootstrapRepos(
|
|
progress_callback=self.set_progress, message=self.message)
|
|
|
|
bs.set_data_dir(OpenPypeVersion.get_local_openpype_path())
|
|
version_path = bs.install_version(self._openpype_version)
|
|
self._set_result(version_path)
|
|
|
|
def set_progress(self, progress: int) -> None:
|
|
"""Helper to set progress bar.
|
|
|
|
Args:
|
|
progress (int): Progress in percents.
|
|
|
|
"""
|
|
self.progress.emit(progress)
|