Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijenstina <lijenstina@gmail.com>2017-04-16 05:37:34 +0300
committerlijenstina <lijenstina@gmail.com>2017-04-16 05:37:34 +0300
commit844db32ac4e719a5ec84b028a12746fe062f3e74 (patch)
treed28960492cb8085ae5492c97c75d9631e19c31be /object_print3d_utils
parent401caf74d91d419c09eb6966b864732a84f5cbb7 (diff)
Print3D: Update panel Rename
As a part of the task T50726: Update the Panel rename code to more generic one update call was missing during register
Diffstat (limited to 'object_print3d_utils')
-rw-r--r--object_print3d_utils/__init__.py47
1 files changed, 31 insertions, 16 deletions
diff --git a/object_print3d_utils/__init__.py b/object_print3d_utils/__init__.py
index 5cf1ec53..f665f54c 100644
--- a/object_print3d_utils/__init__.py
+++ b/object_print3d_utils/__init__.py
@@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####
-# <pep8-80 compliant>
+# <pep8 compliant>
bl_info = {
"name": "3D Print Toolbox",
@@ -25,7 +25,7 @@ bl_info = {
"location": "3D View > Toolbox",
"description": "Utilities for 3D printing",
"warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
+ "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Modeling/PrintToolbox",
"support": 'OFFICIAL',
"category": "Mesh"}
@@ -118,17 +118,29 @@ class Print3DSettings(PropertyGroup):
)
-# Addons Preferences Update Panel
+# Add-ons Preferences Update Panel
+
+# Define Panel classes for updating
+panels = (
+ ui.Print3DToolBarObject,
+ ui.Print3DToolBarMesh,
+ )
+
+
def update_panel(self, context):
+ message = "3D Print Toolbox: Updating Panel locations has failed"
try:
- bpy.utils.unregister_class(ui.Print3DToolBarObject)
- bpy.utils.unregister_class(ui.Print3DToolBarMesh)
- except:
+ for panel in panels:
+ if "bl_rna" in panel.__dict__:
+ bpy.utils.unregister_class(panel)
+
+ for panel in panels:
+ panel.bl_category = context.user_preferences.addons[__name__].preferences.category
+ bpy.utils.register_class(panel)
+
+ except Exception as e:
+ print("\n[{}]\n{}\n\nError:\n{}".format(__name__, message, e))
pass
- ui.Print3DToolBarObject.bl_category = context.user_preferences.addons[__name__].preferences.category
- bpy.utils.register_class(ui.Print3DToolBarObject)
- ui.Print3DToolBarMesh.bl_category = context.user_preferences.addons[__name__].preferences.category
- bpy.utils.register_class(ui.Print3DToolBarMesh)
class printpreferences(AddonPreferences):
@@ -136,17 +148,18 @@ class printpreferences(AddonPreferences):
# when defining this in a submodule of a python package.
bl_idname = __name__
- category = bpy.props.StringProperty(
- name="Tab Category",
- description="Choose a name for the category of the panel",
- default="3D Printing",
- update=update_panel)
+ category = StringProperty(
+ name="Tab Category",
+ description="Choose a name for the category of the panel",
+ default="3D Printing",
+ update=update_panel
+ )
def draw(self, context):
-
layout = self.layout
row = layout.row()
col = row.column()
+
col.label(text="Tab Category:")
col.prop(self, "category", text="")
@@ -190,6 +203,8 @@ def register():
bpy.types.Scene.print_3d = PointerProperty(type=Print3DSettings)
+ update_panel(None, bpy.context)
+
def unregister():
for cls in classes: