[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29716] trunk/blender/release/scripts/ui/ space_userpref.py: minor changes to Williams commit to be a bit less verbose.

Campbell Barton ideasman42 at gmail.com
Sat Jun 26 19:24:01 CEST 2010


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

Log Message:
-----------
minor changes to Williams commit to be a bit less verbose.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_userpref.py

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2010-06-26 17:12:55 UTC (rev 29715)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2010-06-26 17:24:01 UTC (rev 29716)
@@ -21,41 +21,7 @@
 import os
 import shutil
 
-def ui_theme_layout_general(split, themedata):
 
-    row = split.row()
-
-    subsplit = row.split(percentage=0.95) 
-    
-    padding = subsplit.split(percentage=0.15)
-    colsub1 = padding.column()
-    colsub1 = padding.column()
-    
-    subsplit = row.split(percentage=0.85) 
-    
-    padding = subsplit.split(percentage=0.15)
-    colsub2 = padding.column()
-    colsub2 = padding.column()
-
-#    for i, attr in enumerate(dir(themedata)):
-    props_color = []
-    props_other = []
-    for i, prop in enumerate(themedata.rna_type.properties):
-        if prop.subtype == 'COLOR':
-            props_color.append(prop)
-        else:
-            props_other.append(prop)
-    
-    for props_ls in props_color, props_other:
-        for i, prop in enumerate(props_ls):
-            attr = prop.identifier
-            if attr == "rna_type":
-                continue
-            if not i % 2:  
-                colsub1.row().prop(themedata, attr)
-            else:
-                colsub2.row().prop(themedata, attr)
-
 def ui_items_general(col, context):
     """ General UI Theme Settings (User Interface)
     """
@@ -524,6 +490,40 @@
     bl_region_type = 'WINDOW'
     bl_show_header = False
 
+    @staticmethod
+    def _theme_generic(split, themedata):
+
+        row = split.row()
+
+        subsplit = row.split(percentage=0.95) 
+        
+        padding = subsplit.split(percentage=0.15)
+        colsub1 = padding.column()
+        colsub1 = padding.column()
+        
+        subsplit = row.split(percentage=0.85) 
+        
+        padding = subsplit.split(percentage=0.15)
+        colsub2 = padding.column()
+        colsub2 = padding.column()
+
+        props_color = []
+        props_other = []
+
+        for i, prop in enumerate(themedata.rna_type.properties):
+            attr = prop.identifier
+            if attr == "rna_type":
+                continue
+
+            if prop.subtype == 'COLOR':
+                props_color.append(prop.identifier)
+            else:
+                props_other.append(prop.identifier)
+
+        for props_ls in props_color, props_other:
+            for i, attr in enumerate(props_ls):
+                (colsub2 if i % 2 else colsub1).row().prop(themedata, attr)
+
     def poll(self, context):
         userpref = context.user_preferences
         return (userpref.active_section == 'THEMES')
@@ -643,89 +643,10 @@
             layout.separator()
             layout.separator()
 
+        else:
+            self._theme_generic(split, getattr(theme, theme.theme_area.lower()))
 
-        elif theme.theme_area == 'VIEW_3D':
-            v3d = theme.view_3d
-            
-            ui_theme_layout_general(split, v3d)
 
-        elif theme.theme_area == 'GRAPH_EDITOR':
-            graph = theme.graph_editor
-            
-            ui_theme_layout_general(split, graph)
-
-        elif theme.theme_area == 'FILE_BROWSER':
-            file_browse = theme.file_browser
-            
-            ui_theme_layout_general(split, file_browse)
-
-        elif theme.theme_area == 'NLA_EDITOR':
-            nla = theme.nla_editor
-            
-            ui_theme_layout_general(split, nla)
-
-        elif theme.theme_area == 'DOPESHEET_EDITOR':
-            dope = theme.dopesheet_editor
-            
-            ui_theme_layout_general(split, dope)
-            
-        elif theme.theme_area == 'IMAGE_EDITOR':
-            image = theme.image_editor
-            
-            ui_theme_layout_general(split, image)
-
-        elif theme.theme_area == 'SEQUENCE_EDITOR':
-            seq = theme.sequence_editor
-            
-            ui_theme_layout_general(split, seq)
-
-        elif theme.theme_area == 'PROPERTIES':
-            prop = theme.properties
-            
-            ui_theme_layout_general(split, prop)
-
-        elif theme.theme_area == 'TEXT_EDITOR':
-            text = theme.text_editor
-            
-            ui_theme_layout_general(split, text)
-
-        elif theme.theme_area == 'TIMELINE':
-            time = theme.timeline
-            
-            ui_theme_layout_general(split, time)
-
-        elif theme.theme_area == 'NODE_EDITOR':
-            node = theme.node_editor
-            
-            ui_theme_layout_general(split, node)
-
-        elif theme.theme_area == 'LOGIC_EDITOR':
-            logic = theme.logic_editor
-            
-            ui_theme_layout_general(split, logic)
-
-        elif theme.theme_area == 'OUTLINER':
-            out = theme.outliner
-
-            ui_theme_layout_general(split, out)
-
-        elif theme.theme_area == 'INFO':
-            info = theme.info
-            
-            ui_theme_layout_general(split, info)
-
-        elif theme.theme_area == 'USER_PREFERENCES':
-            prefs = theme.user_preferences
-            
-            ui_theme_layout_general(split, prefs)
-           
-        elif theme.theme_area == 'CONSOLE':
-            console = theme.console
-            
-            ui_theme_layout_general(split, console)
-            
-            
-
 class USERPREF_PT_file(bpy.types.Panel):
     bl_space_type = 'USER_PREFERENCES'
     bl_label = "Files"





More information about the Bf-blender-cvs mailing list