[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1672] trunk/py/scripts/addons/modules/ extensions_framework/ui.py: extensions_framework: minor adjustments to ui; add layout.menu() and make text/icon args optional

Doug Hammond doughammond at hamsterfight.co.uk
Wed Mar 2 23:17:10 CET 2011


Revision: 1672
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1672
Author:   dougal2
Date:     2011-03-02 22:17:09 +0000 (Wed, 02 Mar 2011)
Log Message:
-----------
extensions_framework: minor adjustments to ui; add layout.menu() and make text/icon args optional

Modified Paths:
--------------
    trunk/py/scripts/addons/modules/extensions_framework/ui.py

Modified: trunk/py/scripts/addons/modules/extensions_framework/ui.py
===================================================================
--- trunk/py/scripts/addons/modules/extensions_framework/ui.py	2011-03-02 22:09:18 UTC (rev 1671)
+++ trunk/py/scripts/addons/modules/extensions_framework/ui.py	2011-03-02 22:17:09 UTC (rev 1672)
@@ -240,11 +240,23 @@
 										else True,
 								)
 							elif current_property['type'] in ['operator']:
-								layout.operator(current_property['operator'],
-									text = current_property['text'],
-									icon = current_property['icon']
-								)
+								args = {}
+								for optional_arg in ('text', 'icon'):
+									if optional_arg in current_property_keys:
+										args.update({
+											optional_arg: current_property[optional_arg],
+										})
+								layout.operator( current_property['operator'], **args )
 							
+							elif current_property['type'] in ['menu']:
+								args = {}
+								for optional_arg in ('text', 'icon'):
+									if optional_arg in current_property_keys:
+										args.update({
+											optional_arg: current_property[optional_arg],
+										})
+								layout.menu(current_property['menu'] **args)
+							
 							elif current_property['type'] in ['text']:
 								layout.label(
 									text = current_property['name']



More information about the Bf-extensions-cvs mailing list