Manual merge of soc-2009-kazanbas branch:
[blender.git] / release / ui / space_info.py
index bfe051b..7162716 100644 (file)
@@ -2,13 +2,14 @@
 import bpy
 
 class INFO_HT_header(bpy.types.Header):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
 
        def draw(self, context):
                layout = self.layout
                
                st = context.space_data
-               rd = context.scene.render_data
+               scene = context.scene
+               rd = scene.render_data
 
                row = layout.row(align=True)
                row.template_header()
@@ -33,9 +34,11 @@ class INFO_HT_header(bpy.types.Header):
 
                layout.template_operator_search()
                layout.template_running_jobs()
+
+               layout.itemL(text=scene.statistics())
                        
 class INFO_MT_file(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "File"
 
        def draw(self, context):
@@ -56,6 +59,10 @@ class INFO_MT_file(bpy.types.Menu):
                layout.itemO("wm.save_as_mainfile", text="Save As...")
                layout.itemO("screen.userpref_show", text="User Preferences...")
 
+               layout.itemS()
+               layout.operator_context = "INVOKE_AREA"
+               layout.itemO("wm.link_append", text="Link")
+               layout.item_booleanO("wm.link_append", "link", False, text="Append")
                layout.itemS()
 
                layout.itemM("INFO_MT_file_import")
@@ -71,16 +78,18 @@ class INFO_MT_file(bpy.types.Menu):
                layout.itemO("wm.exit_blender", text="Quit")
 
 class INFO_MT_file_import(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "Import"
 
        def draw(self, context):
                layout = self.layout
+               
                layout.itemO("import.3ds", text="3DS")
                layout.itemO("import.obj", text="OBJ")
 
+
 class INFO_MT_file_export(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "Export"
 
        def draw(self, context):
@@ -92,8 +101,9 @@ class INFO_MT_file_export(bpy.types.Menu):
                layout.itemO("export.ply", text="PLY")
                layout.itemO("export.x3d", text="X3D")
 
+
 class INFO_MT_file_external_data(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "External Data"
 
        def draw(self, context):
@@ -110,7 +120,7 @@ class INFO_MT_file_external_data(bpy.types.Menu):
                layout.itemO("file.find_missing_files")
 
 class INFO_MT_add(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "Add"
 
        def draw(self, context):
@@ -118,25 +128,25 @@ class INFO_MT_add(bpy.types.Menu):
 
                layout.operator_context = "EXEC_SCREEN"
 
-               layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
-               layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
-               layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
-               layout.item_menu_enumO( "OBJECT_OT_metaball_add", "type", 'META', icon='ICON_OUTLINER_OB_META')
-               layout.itemO("OBJECT_OT_text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
+               layout.item_menu_enumO("object.mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
+               layout.item_menu_enumO("object.curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
+               layout.item_menu_enumO("object.surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
+               layout.item_menu_enumO("object.metaball_add", "type", 'META', text="Metaball", icon='ICON_OUTLINER_OB_META')
+               layout.itemO("object.text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
 
                layout.itemS()
 
-               layout.itemO("OBJECT_OT_armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
-               layout.item_enumO("OBJECT_OT_object_add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
-               layout.item_enumO("OBJECT_OT_object_add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')
+               layout.itemO("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
+               layout.item_enumO("object.add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
+               layout.item_enumO("object.add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')
 
                layout.itemS()
 
-               layout.item_enumO("OBJECT_OT_object_add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
-               layout.item_enumO("OBJECT_OT_object_add", "type", 'LAMP', icon='ICON_OUTLINER_OB_LAMP')
+               layout.item_enumO("object.add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
+               layout.item_menu_enumO("object.lamp_add", "type", 'LAMP', text="Lamp", icon='ICON_OUTLINER_OB_LAMP')
 
 class INFO_MT_game(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "Game"
 
        def draw(self, context):
@@ -154,7 +164,7 @@ class INFO_MT_game(bpy.types.Menu):
                layout.itemR(gs, "deprecation_warnings")
 
 class INFO_MT_render(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "Render"
 
        def draw(self, context):
@@ -170,7 +180,7 @@ class INFO_MT_render(bpy.types.Menu):
                layout.itemO("screen.render_view_show")
 
 class INFO_MT_help(bpy.types.Menu):
-       __space_type__ = "INFO"
+       __space_type__ = 'INFO'
        __label__ = "Help"
 
        def draw(self, context):
@@ -185,6 +195,9 @@ class INFO_MT_help(bpy.types.Menu):
                layout.itemO("help.blender_eshop")
                layout.itemO("help.developer_community")
                layout.itemO("help.user_community")
+               layout.itemS()
+               layout.itemO("help.operator_cheat_sheet")
+               
 
 bpy.types.register(INFO_HT_header)
 bpy.types.register(INFO_MT_file)
@@ -243,10 +256,37 @@ class HELP_OT_user_community(HelpOperator):
        __label__ = "User Community"
        __URL__ = 'http://www.blender.org/community/user-community/'
 
+class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
+       __idname__ = "help.operator_cheat_sheet"
+       __label__ = "Operator Cheet Sheet (new textblock)"
+       def execute(self, context):
+               op_strings = []
+               tot = 0
+               for op_module_name in dir(bpy.ops):
+                       op_module = getattr(bpy.ops, op_module_name)
+                       for op_submodule_name in dir(op_module):
+                               op = getattr(op_module, op_submodule_name)
+                               text = repr(op)
+                               if text.startswith('bpy.ops.'):
+                                       op_strings.append(text)
+                                       tot += 1
+                       
+                       op_strings.append('')
+               
+               bpy.ops.text.new() # XXX - assumes new text is always at the end!
+               textblock = bpy.data.texts[-1]
+               textblock.write('# %d Operators\n\n' % tot)
+               textblock.write('\n'.join(op_strings))
+               textblock.name = "OperatorList.txt"
+               print("See OperatorList.txt textblock")
+               return ('FINISHED',)
+
+
 bpy.ops.add(HELP_OT_manual)
 bpy.ops.add(HELP_OT_release_logs)
 bpy.ops.add(HELP_OT_blender_website)
 bpy.ops.add(HELP_OT_blender_eshop)
 bpy.ops.add(HELP_OT_developer_community)
 bpy.ops.add(HELP_OT_user_community)
+bpy.ops.add(HELP_OT_operator_cheat_sheet)