mirror of
https://projects.blender.org/blender/blender.git
synced 2025-01-22 15:32:15 -05:00
Extensions: don't attempt to sync after adding a repo in background mode
This commit is contained in:
parent
3ef073ed1d
commit
efa1f5847e
1 changed files with 13 additions and 2 deletions
|
@ -270,6 +270,11 @@ def repos_to_notify():
|
|||
|
||||
@bpy.app.handlers.persistent
|
||||
def extenion_repos_sync(*_):
|
||||
# Ignore in background mode as this is for the UI to stay in sync.
|
||||
# Automated tasks must sync explicitly.
|
||||
if bpy.app.background:
|
||||
return
|
||||
|
||||
# This is called from operators (create or an explicit call to sync)
|
||||
# so calling a modal operator is "safe".
|
||||
if (active_repo := repo_active_or_none()) is None:
|
||||
|
@ -278,8 +283,14 @@ def extenion_repos_sync(*_):
|
|||
print_debug("SYNC:", active_repo.name)
|
||||
# There may be nothing to upgrade.
|
||||
|
||||
# FIXME: don't use the operator, this is error prone.
|
||||
# The same method used to update the status-bar on startup would be preferable.
|
||||
if not active_repo.use_remote_url:
|
||||
return
|
||||
|
||||
# NOTE: both `extensions.repo_sync_all` and `bl_extension_notify.update_non_blocking` can be used here.
|
||||
# Call the modal operator in this case as this handler is called after adding a repository.
|
||||
# The operator has the benefit of showing a progress bar and reporting errors.
|
||||
# Since this function is used after adding a new repository, it's important the user is aware of any
|
||||
# errors synchronizing data as there may be connection/access issues they need to resolve.
|
||||
if not bpy.ops.extensions.repo_sync_all.poll():
|
||||
print("skipping sync, poll failed")
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue