- panel python template
authorCampbell Barton <ideasman42@gmail.com>
Sat, 23 Jan 2010 18:51:56 +0000 (18:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 23 Jan 2010 18:51:56 +0000 (18:51 +0000)
- nicer syntax to capitalize words

release/scripts/modules/bpy/utils.py
release/scripts/templates/panel_simple.py [new file with mode: 0644]

index 90ba9ba4c716c56010ecf65f35d19702835c6efd..855751a07438526f389129943bc7c9bcfaf59104 100644 (file)
@@ -75,8 +75,8 @@ def display_name(name):
 
     name_base = name_base.replace("_", " ")
 
-    if name_base.lower() == name_base:
-        return ' '.join([w[0].upper() + w[1:] for w in name_base.split()])
+    if name_base.islower():
+        return name_base.capitalize()
     else:
         return name_base
 
diff --git a/release/scripts/templates/panel_simple.py b/release/scripts/templates/panel_simple.py
new file mode 100644 (file)
index 0000000..fd05e50
--- /dev/null
@@ -0,0 +1,22 @@
+import bpy
+
+class OBJECT_PT_hello(bpy.types.Panel):
+    bl_label = "Hello World Panel"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_context = "object"
+    
+    def draw(self, context):
+        layout = self.layout
+        
+        obj = context.object
+
+        row = layout.row()
+        row.label(text="Hello world!", icon='WORLD_DATA')
+
+        row = layout.row()
+        row.label(text="Active object is: " + obj.name)
+        row = layout.row()
+        row.prop(obj, "name")
+
+bpy.types.register(OBJECT_PT_hello)