36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
import bpy
|
|
from . import pkg_ops
|
|
|
|
class USERPREF_PT_packages(bpy.types.Panel):
|
|
bl_label = "Package Management"
|
|
bl_space_type = 'USER_PREFERENCES'
|
|
bl_region_type = 'WINDOW'
|
|
bl_options = {'HIDE_HEADER'}
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
userpref = context.user_preferences
|
|
return (userpref.active_section == 'PACKAGES')
|
|
|
|
def draw(self, context):
|
|
wm = context.window_manager
|
|
# pm = wm.package_manager
|
|
# see comment in __init__.py
|
|
pm_settings = wm.package_manager_settings
|
|
# pm_last_code = wm.pm_last_response_code
|
|
layout = self.layout
|
|
|
|
row = layout.row()
|
|
row.prop(pm_settings, "url")
|
|
row.operator(pkg_ops.PACKAGE_OT_fetch.bl_idname, text="Fetch")
|
|
|
|
row = layout.row()
|
|
# just a demonstration
|
|
row.label(text="Last response: %s" % pkg_ops.PACKAGE_OT_fetch.last_response)
|
|
|
|
def register():
|
|
bpy.utils.register_class(USERPREF_PT_packages)
|
|
|
|
def unregister():
|
|
bpy.utils.unregister_class(USERPREF_PT_packages)
|