81 lines
2.7 KiB
Python
81 lines
2.7 KiB
Python
|
# ====================== BEGIN GPL LICENSE BLOCK ======================
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 3
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
#
|
||
|
# ======================= END GPL LICENSE BLOCK ========================
|
||
|
|
||
|
bl_info = {
|
||
|
"name": "Package Manager",
|
||
|
"author": "Peter Cassetta",
|
||
|
"version": (1, 0),
|
||
|
"blender": (2, 77, 0),
|
||
|
"location": "User Preferences > Add-ons > System: Package Manager",
|
||
|
"description": "Download new add-ons and update current ones",
|
||
|
"support": 'TESTING',
|
||
|
"warning": "Early development",
|
||
|
"wiki_url": "",
|
||
|
"category": "System",
|
||
|
}
|
||
|
|
||
|
|
||
|
import bpy
|
||
|
from bpy.types import Operator, AddonPreferences
|
||
|
from bpy.props import StringProperty, BoolProperty, IntProperty, CollectionProperty
|
||
|
|
||
|
from . import networking
|
||
|
|
||
|
class PackageManagerAddon(bpy.types.PropertyGroup):
|
||
|
source = StringProperty()
|
||
|
name = StringProperty()
|
||
|
description = StringProperty()
|
||
|
author = StringProperty()
|
||
|
wiki_url = StringProperty()
|
||
|
tracker_url = StringProperty()
|
||
|
location = StringProperty()
|
||
|
category = StringProperty()
|
||
|
version = StringProperty()
|
||
|
blender = StringProperty()
|
||
|
warning = StringProperty()
|
||
|
support = StringProperty()
|
||
|
filename = StringProperty()
|
||
|
|
||
|
class PackageManagerPreferences(AddonPreferences):
|
||
|
# this must match the addon name, use '__package__'
|
||
|
# when defining this in a submodule of a python package.
|
||
|
bl_idname = __name__
|
||
|
|
||
|
pm_addons = CollectionProperty(type=PackageManagerAddon)
|
||
|
|
||
|
pm_addons_index = IntProperty()
|
||
|
|
||
|
def draw(self, context):
|
||
|
layout = self.layout
|
||
|
layout.operator("wm.update_index", text="Update List", icon='FILE_REFRESH')
|
||
|
rows = 1 if len(self.pm_addons) == 0 else 6
|
||
|
layout.template_list("UI_UL_list", "addons_list", self, "pm_addons",
|
||
|
self, "pm_addons_index", rows=rows)
|
||
|
|
||
|
def register():
|
||
|
networking.register()
|
||
|
bpy.utils.register_class(PackageManagerAddon)
|
||
|
bpy.utils.register_class(PackageManagerPreferences)
|
||
|
|
||
|
def unregister():
|
||
|
networking.unregister()
|
||
|
bpy.utils.unregister_class(PackageManagerAddon)
|
||
|
bpy.utils.unregister_class(PackageManagerPreferences)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
register()
|