[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49345] trunk/blender/doc/python_api/rst/ info_best_practice.rst: Documentation:

Thomas Dinges blender at dingto.org
Sun Jul 29 03:38:34 CEST 2012


Revision: 49345
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49345
Author:   dingto
Date:     2012-07-29 01:38:31 +0000 (Sun, 29 Jul 2012)
Log Message:
-----------
Documentation:
* Some UI docs for the Best Practise guide. Still WIP. 

Modified Paths:
--------------
    trunk/blender/doc/python_api/rst/info_best_practice.rst

Modified: trunk/blender/doc/python_api/rst/info_best_practice.rst
===================================================================
--- trunk/blender/doc/python_api/rst/info_best_practice.rst	2012-07-29 01:28:51 UTC (rev 49344)
+++ trunk/blender/doc/python_api/rst/info_best_practice.rst	2012-07-29 01:38:31 UTC (rev 49345)
@@ -56,9 +56,71 @@
 User Interface Layout
 =====================
 
-TODO: Thomas
+Some notes to keep in mind when writing UI layouts:
 
+* UI code is quite simple. Layout declarations are there to easily create a decent layout. 
 
+  General rule here: If you need more code for the layout declaration, then for the actual properties, you do it wrong. 
+  
+Example layouts:
+
+* layout()
+
+  The basic layout is a simple Top -> Bottom layout. 
+  
+  .. code-block:: python
+
+	 layout.prop()
+	 layout.prop()
+
+* layout.row()
+
+  Use row(), when you want more than 1 propertey in one line. 
+  
+  .. code-block:: python
+	 
+	 row = layout.row()
+	 row.prop()
+	 row.prop()
+
+* layout.column()
+
+  Use column(), when you want your properties in a column.
+  
+  .. code-block:: python
+  
+	 col = layout.column()
+	 col.prop()
+	 col.prop()
+
+* layout.split()
+
+  This can be used to create more complex layouts. For example you can split the layout and create two column() layouts next to each other.
+  Don't use split, when you simply want two properties in a row. Use row() for that.
+  
+  .. code-block:: python
+  
+	 split = layout.split()
+	 
+	 col = split.column()
+	 col.prop()
+	 col.prop()
+	 
+	 col = split.column()
+	 col.prop()
+	 col.prop()
+	 
+Declaration names:
+
+Try to only use these variable names for layout declarations:
+
+* row for a row() layout
+* col for a column() layout
+* split for a split() layout
+* flow for a column_flow() layout
+* sub for a sub layout (a column inside a column for example)
+
+
 Script Efficiency
 =================
 




More information about the Bf-blender-cvs mailing list