[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2415] branches/geodesic_domes/ funnylayout.py: An example how to build 'strange' (but nice) GUI
Thomas Dinges
blender at dingto.org
Mon Oct 10 17:56:02 CEST 2011
Hi, what is that?
I don't remember that the bf-extensions repo is a playground for funny
tests. Or does this has any use?
Thomas
Am 10.10.2011 17:53, schrieb Peter K.H. Gragert:
> Revision: 2415
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2415
> Author: pkhg
> Date: 2011-10-10 15:53:33 +0000 (Mon, 10 Oct 2011)
> Log Message:
> -----------
> An example how to build 'strange' (but nice) GUI
>
> Added Paths:
> -----------
> branches/geodesic_domes/funnylayout.py
>
> Added: branches/geodesic_domes/funnylayout.py
> ===================================================================
> --- branches/geodesic_domes/funnylayout.py (rev 0)
> +++ branches/geodesic_domes/funnylayout.py 2011-10-10 15:53:33 UTC (rev 2415)
> @@ -0,0 +1,89 @@
> +#http://blenderartists.org/forum/showthread.php?t=210513&p=1799525&viewfull=1#post1799525
> +#http://blenderartists.org/forum/showthread.php?210513-blender-2.56-UI-scripting
> +#----------------------------------------------------------
> +# File layout.py
> +#----------------------------------------------------------
> +import bpy
> +from bpy.props import IntProperty
> +
> +class LayoutPanel(bpy.types.Panel):
> + bl_label = "Panel with funny layout"
> + bl_space_type = "VIEW_3D"
> + bl_region_type = "TOOL_PROPS"
> +
> + def draw(self, context):
> + layout = self.layout
> +
> + layout.label("First row")
> + row = layout.row(align=True)
> + row.alignment = 'EXPAND'
> + row.operator("object.button", text="1").mode = 1
> + row.operator("object.button", text="2", icon='MESH_DATA').mode = 2
> + row.operator("object.button", icon='LAMP_DATA')
> +
> + row = layout.row(align=False)
> + row.alignment = 'LEFT'
> + row.operator("object.button", text="4").mode = 4
> + row.operator("object.button", text="", icon='MATERIAL').mode =5
> + row.operator("object.button", text="6", icon='BLENDER').mode=6
> + row.operator("object.button", text="7", icon='WORLD').mode=7
> +
> + layout.label("Third row", icon='TEXT')
> + row = layout.row()
> + row.alignment = 'RIGHT'
> + row.operator("object.button", text="8").mode=8
> + row.operator("object.button", text="9", icon='SCENE').mode=9
> + row.operator("object.button", text="10", icon='BRUSH_INFLATE').mode=10
> + #etc for the other object.buttons calls mode = ....
> + layout.label("Fourth row", icon='ACTION')
> + row = layout.row()
> + box = row.box()
> + box.operator("object.button", text="11", emboss=False)
> + box.operator("object.button", text="12", emboss=False)
> + col = row.column()
> + subrow = col.row()
> + subrow.operator("object.button", text="13")
> + subrow.operator("object.button", text="14")
> + subrow = col.row(align=True)
> + subrow.operator("object.button", text="15")
> + subrow.operator("object.button", text="16")
> + box = row.box()
> + box.operator("object.button", text="17")
> + box.separator()
> + box.operator("object.button", text="18")
> + box.operator("object.button", text="19")
> +
> + layout.label("Fifth row")
> + row = layout.row()
> + split = row.split(percentage=0.25)
> + col = split.column()
> + col.operator("object.button", text="21")
> + col.operator("object.button", text="22")
> + split = split.split(percentage=0.3)
> + col = split.column()
> + col.operator("object.button", text="23")
> + split = split.split(percentage=0.5)
> + col = split.column()
> + col.operator("object.button", text="24")
> + col.operator("object.button", text="25")
> +
> +
> +class OBJECT_OT_Button(bpy.types.Operator):
> + bl_idname = "object.button"
> + bl_label = "Button"
> + mode = IntProperty(name="mode",min =-100, max =20,soft_max=10,default =-99)
> + def execute(self, context):
> + print("Hello world!")
> + print(self.mode)
> + return{'FINISHED'}
> +
> +def register():
> + bpy.utils.register_module(__name__)
> + pass
> +
> +def unregister():
> + bpy.utils.unregister_module(__name__)
> + pass
> +
> +if __name__ == "__main__":
> + register()
>
> _______________________________________________
> Bf-extensions-cvs mailing list
> Bf-extensions-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-extensions-cvs
--
Thomas Dinges
Blender Developer, Artist and Musician
www.dingto.org
More information about the Bf-extensions-cvs
mailing list