Documentation: Documenting every class and function.

Added a docstring to every class and function, documenting arguments and return values. Also made a couple cleanup changes. Next cleanup-related change will be moving from urllib.requests to the requests module.
This commit is contained in:
2016-06-26 22:00:03 -05:00
parent f6897e6401
commit 1cce8cda81
2 changed files with 139 additions and 56 deletions

View File

@@ -31,9 +31,10 @@ bl_info = {
import bpy
import addon_utils
from bpy.types import Operator, AddonPreferences
from bpy.props import StringProperty, BoolProperty, IntProperty, CollectionProperty
from bpy.types import AddonPreferences
from bpy.props import StringProperty, IntProperty, CollectionProperty
# Support reloading
if "bpy" in locals():
import imp
try:
@@ -43,7 +44,10 @@ if "bpy" in locals():
else:
from . import networking
class PackageManagerAddon(bpy.types.PropertyGroup):
"""PropertyGroup representing an add-on available for download."""
source = StringProperty()
name = StringProperty()
description = StringProperty()
@@ -59,15 +63,20 @@ class PackageManagerAddon(bpy.types.PropertyGroup):
module_name = StringProperty()
download_url = StringProperty()
class PackageManagerPreferences(AddonPreferences):
# this must match the addon name, use '__package__'
# when defining this in a submodule of a python package.
"""Package Manager's add-on preferences.
Entire add-on functionality is available from its preferences panel.
"""
bl_idname = __name__
pm_addons = CollectionProperty(type=PackageManagerAddon)
pm_addons_index = IntProperty()
def draw(self, context):
"""Draw preferences UI."""
layout = self.layout
split = layout.split(percentage=1.0/3)
@@ -151,15 +160,22 @@ class PackageManagerPreferences(AddonPreferences):
for i in range(4 - tot_row):
split.separator()
def register():
"""Register classes, operators, and preferences."""
networking.register()
bpy.utils.register_class(PackageManagerAddon)
bpy.utils.register_class(PackageManagerPreferences)
def unregister():
"""Unregister classes, operators, and preferences."""
networking.unregister()
bpy.utils.unregister_class(PackageManagerAddon)
bpy.utils.unregister_class(PackageManagerPreferences)
if __name__ == "__main__":
register()