[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29720] trunk/blender: - changed recent commit from William to have enum in user preferences as an expanded enum (like it was before)

Campbell Barton ideasman42 at gmail.com
Sat Jun 26 22:00:45 CEST 2010


Revision: 29720
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29720
Author:   campbellbarton
Date:     2010-06-26 22:00:45 +0200 (Sat, 26 Jun 2010)

Log Message:
-----------
- changed recent commit from William to have enum in user preferences as an expanded enum (like it was before)
- rename 'no_bg' argument to 'emboss' (and negated)
- added 'emboss' option for operator buttons.
- Addon UI Layout slight modifications, changed enable/disable buttons for checkbox, grey out text of disabled addons to make it obvious at a glance whats enabled.
- column expanded enums now align text to the left.
- renamed ui_item_enum_row to ui_item_enum_expand since its used for columns and rows.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/release/scripts/ui/space_userpref_keymap.py
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/source/blender/editors/interface/interface_layout.c
    trunk/blender/source/blender/makesrna/intern/rna_ui_api.c

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2010-06-26 19:17:48 UTC (rev 29719)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2010-06-26 20:00:45 UTC (rev 29720)
@@ -533,13 +533,16 @@
 
         theme = context.user_preferences.themes[0]
 
+        split_themes = layout.split(percentage=0.2)
+        split_themes.prop(theme, "theme_area", expand=True)
+        
         split = layout.split(percentage=0.4)
-        split.prop(theme, "theme_area", text="")
         
+        
         layout.separator()
         layout.separator()
         
-        split = layout.split()
+        split = split_themes.split()
 
         if theme.theme_area == 'USER_INTERFACE':
             col = split.column()
@@ -737,7 +740,7 @@
         sub.label(text="Presets:")
         subrow = sub.row(align=True)
         subrow.menu("USERPREF_MT_interaction_presets", text=bpy.types.USERPREF_MT_interaction_presets.bl_label)
-        subrow.operator("wm.interaction_preset_add", text="", icon="ZOOMIN")
+        subrow.operator("wm.interaction_preset_add", text="", icon='ZOOMIN')
         sub.separator()
 
         sub.label(text="Mouse:")
@@ -883,28 +886,17 @@
                 column = box.column()
                 row = column.row()
 
-                # Arrow #
-                # If there are Infos or UI is expanded
-                if info["expanded"]:
-                    row.operator("wm.addon_expand", icon="TRIA_DOWN").module = module_name
-                elif info["author"] or info["version"] or info["wiki_url"] or info["location"]:
-                    row.operator("wm.addon_expand", icon="TRIA_RIGHT").module = module_name
-                else:
-                    # Else, block UI
-                    arrow = row.column()
-                    arrow.enabled = False
-                    arrow.operator("wm.addon_expand", icon="TRIA_RIGHT").module = module_name
+                row.operator("wm.addon_expand", icon='TRIA_DOWN' if info["expanded"] else 'TRIA_RIGHT', emboss=False).module = module_name
 
-                row.label(text=info["name"])
-                
-                if is_enabled: operator = "wm.addon_disable"
-                else: operator = "wm.addon_enable"
+                rowsub = row.row()
+                rowsub.active = is_enabled
+                rowsub.label(text=info["name"], icon='ERROR' if info["warning"] else 'BLENDER')
 
-                if info["warning"]: button_icon='ERROR'
-                else: button_icon='BLENDER'
+                if is_enabled:
+                    row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
+                else:
+                    row.operator("wm.addon_enable", icon='CHECKBOX_DEHLT', text="", emboss=False).module = module_name
 
-                row.operator(operator, icon=button_icon).module = module_name
-
                 # Expanded UI (only if additional infos are available)
                 if info["expanded"]:
                     if info["description"]:
@@ -957,7 +949,7 @@
                 column = box.column()
                 row = column.row()
 
-                row.label(text=ext, icon="ERROR")
+                row.label(text=ext, icon='ERROR')
                 row.operator("wm.addon_disable").module = ext
 
 from bpy.props import *

Modified: trunk/blender/release/scripts/ui/space_userpref_keymap.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref_keymap.py	2010-06-26 19:17:48 UTC (rev 29719)
+++ trunk/blender/release/scripts/ui/space_userpref_keymap.py	2010-06-26 20:00:45 UTC (rev 29720)
@@ -167,7 +167,7 @@
         col = self.indented_layout(layout, level)
 
         row = col.row()
-        row.prop(km, "children_expanded", text="", no_bg=True)
+        row.prop(km, "children_expanded", text="", emboss=False)
         row.label(text=km.name)
 
         row.label()
@@ -186,7 +186,7 @@
                 # equal in hierarchy to the other children categories
                 subcol = self.indented_layout(col, level + 1)
                 subrow = subcol.row()
-                subrow.prop(km, "items_expanded", text="", no_bg=True)
+                subrow.prop(km, "items_expanded", text="", emboss=False)
                 subrow.label(text="%s (Global)" % km.name)
             else:
                 km.items_expanded = True
@@ -227,11 +227,11 @@
 
         # header bar
         row = split.row()
-        row.prop(kmi, "expanded", text="", no_bg=True)
+        row.prop(kmi, "expanded", text="", emboss=False)
 
         row = split.row()
         row.enabled = km.user_defined
-        row.prop(kmi, "active", text="", no_bg=True)
+        row.prop(kmi, "active", text="", emboss=False)
 
         if km.modal:
             row.prop(kmi, "propvalue", text="")

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2010-06-26 19:17:48 UTC (rev 29719)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2010-06-26 20:00:45 UTC (rev 29720)
@@ -2125,7 +2125,7 @@
             layout.active = view.display_background_images
             box = layout.box()
             row = box.row(align=True)
-            row.prop(bg, "show_expanded", text="", no_bg=True)
+            row.prop(bg, "show_expanded", text="", emboss=False)
             row.label(text=getattr(bg.image, "name", "Not Set"))
             row.operator("view3d.remove_background_image", text="", icon='X').index = i
 

Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c	2010-06-26 19:17:48 UTC (rev 29719)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c	2010-06-26 20:00:45 UTC (rev 29720)
@@ -436,8 +436,9 @@
 	uiBlockSetCurLayout(block, layout);
 }
 
-static void ui_item_enum_row(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only)
+static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only)
 {
+	uiBut *but;
 	EnumPropertyItem *item;
 	const char *identifier;
 	char *name;
@@ -457,11 +458,14 @@
 		itemw= ui_text_icon_width(block->curlayout, name, icon, 0);
 
 		if(icon && strcmp(name, "") != 0 && !icon_only)
-			uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+			but= uiDefIconTextButR(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
 		else if(icon)
-			uiDefIconButR(block, ROW, 0, icon, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+			but= uiDefIconButR(block, ROW, 0, icon, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
 		else
-			uiDefButR(block, ROW, 0, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+			but= uiDefButR(block, ROW, 0, name, 0, 0, itemw, h, ptr, identifier, -1, 0, value, -1, -1, NULL);
+
+		if(ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
+			but->flag |= UI_TEXT_LEFT;
 	}
 	uiBlockSetCurLayout(block, layout);
 
@@ -609,6 +613,9 @@
 
 	w= ui_text_icon_width(layout, name, icon, 0);
 
+	if (flag & UI_ITEM_R_NO_BG)
+		uiBlockSetEmboss(block, UI_EMBOSSN);
+
 	if(icon && strcmp(name, "") != 0)
 		but= uiDefIconTextButO(block, BUT, ot->idname, context, icon, (char*)name, 0, 0, w, UI_UNIT_Y, NULL);
 	else if(icon)
@@ -619,7 +626,10 @@
 	/* text alignment for toolbar buttons */
 	if((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
 		but->flag |= UI_TEXT_LEFT;
-	
+
+	if (flag & UI_ITEM_R_NO_BG)
+		uiBlockSetEmboss(block, UI_EMBOSS);
+
 	/* assign properties */
 	if(properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
 		PointerRNA *opptr= uiButGetOperatorPtrRNA(but);
@@ -941,7 +951,7 @@
 	}
 	/* expanded enum */
 	else if(type == PROP_ENUM && expand)
-		ui_item_enum_row(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
+		ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only);
 	/* property with separate label */
 	else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
 		but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);

Modified: trunk/blender/source/blender/makesrna/intern/rna_ui_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ui_api.c	2010-06-26 19:17:48 UTC (rev 29719)
+++ trunk/blender/source/blender/makesrna/intern/rna_ui_api.c	2010-06-26 20:00:45 UTC (rev 29720)
@@ -35,7 +35,7 @@
 
 #ifdef RNA_RUNTIME
 
-static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, char *propname, char *name, int icon, int expand, int slider, int toggle, int icon_only, int event, int full_event, int no_bg, int index)
+static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, char *propname, char *name, int icon, int expand, int slider, int toggle, int icon_only, int event, int full_event, int emboss, int index)
 {
 	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
 	int flag= 0;
@@ -51,14 +51,16 @@
 	flag |= (icon_only)? UI_ITEM_R_ICON_ONLY: 0;
 	flag |= (event)? UI_ITEM_R_EVENT: 0;
 	flag |= (full_event)? UI_ITEM_R_FULL_EVENT: 0;
-	flag |= (no_bg)? UI_ITEM_R_NO_BG: 0;
+	flag |= (emboss)? 0: UI_ITEM_R_NO_BG;
 
 	uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
 }
 
-static PointerRNA rna_uiItemO(uiLayout *layout, char *opname, char *name, int icon)
+static PointerRNA rna_uiItemO(uiLayout *layout, char *opname, char *name, int icon, int emboss)
 {
-	return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), UI_ITEM_O_RETURN_PROPS);
+	int flag= UI_ITEM_O_RETURN_PROPS;
+	flag |= (emboss)? 0: UI_ITEM_R_NO_BG;
+	return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
 }
 
 #else
@@ -85,7 +87,7 @@
 {
 	PropertyRNA *parm;
 	parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator.");
-	RNA_def_property_flag(parm, PROP_REQUIRED);	
+	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list