Async support: downloading, json parsing, and add-on install

Downloading, parsing index.json, and installing add-ons all now are handled asynchronously using the asyncio module. These operations will no longer block Blender, allowing them to run in the background.
This commit is contained in:
2016-06-26 17:42:21 -05:00
parent b2c34a1a7e
commit f6897e6401
2 changed files with 189 additions and 13 deletions

View File

@@ -69,7 +69,18 @@ class PackageManagerPreferences(AddonPreferences):
def draw(self, context):
layout = self.layout
layout.operator("wm.update_index", text="Update List", icon='FILE_REFRESH')
split = layout.split(percentage=1.0/3)
if (len(self.pm_addons) == 0 or networking.download_install_status in
("Processing response", "Downloading update",
"Processing failed", "Update failed")):
split.label(text=networking.download_install_status or
"Update add-on list.")
else:
split.label(text="Available add-ons:")
split.separator()
split.operator("wm.update_index", text="Update List", icon='FILE_REFRESH')
rows = 1 if len(self.pm_addons) == 0 else 4
layout.template_list("UI_UL_list", "addons_list", self, "pm_addons",
self, "pm_addons_index", rows=rows)
@@ -93,7 +104,14 @@ class PackageManagerPreferences(AddonPreferences):
else:
split.label(text="Installed: No")
split.separator()
split.separator()
if (networking.download_install_status not in
("Processing response", "Downloading update",
"Processing failed", "Update failed")):
split.label(text=networking.download_install_status)
else:
split.separator()
split.operator("wm.addon_download_install",
text="Install from Web",
icon='URL').addon = addon.module_name