Send repolist to blender and list contents
This commit is contained in:
@@ -258,6 +258,7 @@ class BPKG_OT_refresh(SubprocMixin, bpy.types.Operator):
|
||||
subproc.SubprocError: self._subproc_error,
|
||||
subproc.DownloadError: self._subproc_download_error,
|
||||
subproc.Success: self._subproc_success,
|
||||
subproc.Result: self._subproc_result,
|
||||
subproc.Aborted: self._subproc_aborted,
|
||||
}
|
||||
|
||||
@@ -285,6 +286,12 @@ class BPKG_OT_refresh(SubprocMixin, bpy.types.Operator):
|
||||
self.report({'INFO'}, 'Package list retrieved successfully')
|
||||
self.quit()
|
||||
|
||||
def _subproc_result(self, result: subproc.Result):
|
||||
prefs = bpy.context.user_preferences.addons[__package__].preferences
|
||||
prefs['repo'] = result.data
|
||||
self.report({'INFO'}, 'Package list retrieved successfully')
|
||||
self.quit()
|
||||
|
||||
def _subproc_aborted(self, aborted: subproc.Aborted):
|
||||
self.report({'ERROR'}, 'Package list retrieval aborted per your request')
|
||||
self.quit()
|
||||
@@ -322,6 +329,40 @@ class BPKG_OT_hang(SubprocMixin, bpy.types.Operator):
|
||||
def report_process_died(self):
|
||||
self.report({'ERROR'}, 'Process died, exit code %s' % self.process.exitcode)
|
||||
|
||||
class USERPREF_PT_packages(bpy.types.Panel):
|
||||
bl_label = "Package Management"
|
||||
bl_space_type = 'USER_PREFERENCES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
log = logging.getLogger(__name__ + '.USERPREF_PT_packages')
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'PACKAGES')
|
||||
|
||||
def draw(self, context):
|
||||
repo = context.user_preferences.addons[__package__].preferences['repo']
|
||||
layout = self.layout
|
||||
|
||||
# top = layout.row()
|
||||
# top.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
|
||||
# top.prop(
|
||||
|
||||
def draw_package(layout):
|
||||
pass
|
||||
|
||||
for pkg in repo['packages']:
|
||||
row = layout.row()
|
||||
|
||||
pkgbox = row.box()
|
||||
left = pkgbox.split(.7)
|
||||
row1 = left.row()
|
||||
row2 = left.row()
|
||||
row1.label(text=pkg['bl_info'].get('name', "MISSING NAME"))
|
||||
row2.label(text=pkg['bl_info'].get('description', "MISSING DESCRIPTION"))
|
||||
|
||||
|
||||
class PackageManagerPreferences(bpy.types.AddonPreferences):
|
||||
bl_idname = __package__
|
||||
@@ -348,6 +389,7 @@ def register():
|
||||
bpy.utils.register_class(BPKG_OT_install)
|
||||
bpy.utils.register_class(BPKG_OT_refresh)
|
||||
bpy.utils.register_class(BPKG_OT_hang)
|
||||
bpy.utils.register_class(USERPREF_PT_packages)
|
||||
bpy.utils.register_class(PackageManagerPreferences)
|
||||
|
||||
|
||||
@@ -355,4 +397,5 @@ def unregister():
|
||||
bpy.utils.unregister_class(BPKG_OT_install)
|
||||
bpy.utils.unregister_class(BPKG_OT_refresh)
|
||||
bpy.utils.unregister_class(BPKG_OT_hang)
|
||||
bpy.utils.unregister_class(USERPREF_PT_packages)
|
||||
bpy.utils.unregister_class(PackageManagerPreferences)
|
||||
|
Reference in New Issue
Block a user