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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2012-08-01 16:21:23 +0400
committerThomas Dinges <blender@dingto.org>2012-08-01 16:21:23 +0400
commitda4d468e989f713340a60639f0e67e9de88bc679 (patch)
treed67b179e5f2cb40c20b33820dd251953be56642e /release/scripts
parent26cc3dd7086d7e0061322f5b6f29ce10fb9d8abb (diff)
Docs / Templates:
* Added a ui_panel template with more complex layouts.
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/templates/ui_panel.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/release/scripts/templates/ui_panel.py b/release/scripts/templates/ui_panel.py
new file mode 100644
index 00000000000..095fa105efa
--- /dev/null
+++ b/release/scripts/templates/ui_panel.py
@@ -0,0 +1,56 @@
+import bpy
+
+
+class LayoutDemoPanel(bpy.types.Panel):
+ """Creates a Panel in the scene context of the properties editor"""
+ bl_label = "Layout Demo"
+ bl_idname = "SCENE_PT_layout"
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "scene"
+
+ def draw(self, context):
+ layout = self.layout
+
+ sc = context.scene
+
+ #Create a simple row.
+ layout.label(text=" Simple Row:")
+
+ row = layout.row()
+ row.prop(sc, "frame_start")
+ row.prop(sc, "frame_end")
+
+ #Create an row where the buttons are aligned to each other.
+ layout.label(text=" Aligned Row")
+
+ row = layout.row(align=True)
+ row.prop(sc, "frame_start")
+ row.prop(sc, "frame_end")
+
+ #Create two columns, by using a split layout.
+ split = layout.split()
+
+ # First column
+ col = split.column()
+ col.label(text="Column One:")
+ col.prop(sc, "frame_end")
+ col.prop(sc, "frame_start")
+
+ # Second column, aligned
+ col = split.column(align=True)
+ col.label(text="Column Two")
+ col.prop(sc, "frame_start")
+ col.prop(sc, "frame_end")
+
+
+def register():
+ bpy.utils.register_class(LayoutDemoPanel)
+
+
+def unregister():
+ bpy.utils.unregister_class(LayoutDemoPanel)
+
+
+if __name__ == "__main__":
+ register()