[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2769] branches/geodesic_domes/ geodesic_domes/third_domes_panel.py: added multi label fuction for multi line text for help menu abd prop to control the wrap
james bond
thekilon at yahoo.co.uk
Mon Dec 12 19:10:46 CET 2011
Revision: 2769
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2769
Author: kilon
Date: 2011-12-12 18:10:46 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
added multi label fuction for multi line text for help menu abd prop to control the wrap
Modified Paths:
--------------
branches/geodesic_domes/geodesic_domes/third_domes_panel.py
Modified: branches/geodesic_domes/geodesic_domes/third_domes_panel.py
===================================================================
--- branches/geodesic_domes/geodesic_domes/third_domes_panel.py 2011-12-12 17:19:57 UTC (rev 2768)
+++ branches/geodesic_domes/geodesic_domes/third_domes_panel.py 2011-12-12 18:10:46 UTC (rev 2769)
@@ -29,6 +29,8 @@
bpy.types.Scene.geodesic_not_yet_called = BoolProperty(name="geodesic_not_called",default = True)
+bpy.types.Scene.gd_help_text_width = IntProperty(name = "Text Width" , description = "The width above which the text wraps" , default = 20 , max = 180 , min = 1)
+
class Geodesic_Domes_Operator_Panel(bpy.types.Panel):
"""start a GD object here"""
bl_label = "Geodesic Domes"
@@ -587,11 +589,35 @@
row = layout.row()
row.prop(self,"fmeshname")
row = layout.row()
-
+
+ #help menu GUI
elif which_mainpages == "Help":
- row = layout.row()
- row.label(text="Help goes here")
+ import textwrap
+ # a function that allows for multiple labels with text that wraps
+ # you can allow the user to set where the text wraps with the
+ # text_width parameter
+ # other parameters are ui : here you usually pass layout
+ # text: is a list with each index representing a line of text
+
+ def multi_label(text, ui,text_width=40):
+ for x in range(0,len(text)):
+ el = textwrap.wrap(text[x], width = text_width )
+
+ for y in range(0,len(el)):
+ ui.label(text=el[y])
+
+ box = layout.box()
+ help_text = ["Help text is put here",
+ " line 1",
+ "line 2",
+ "line 3",
+ "line 4",
+ ".etc"]
+ text_width = bpy.context.scene.gd_help_text_width
+ box.prop(context.scene,"gd_help_text_width",slider=True)
+ multi_label(help_text,box, text_width)
+
def execute(self, context):
global last_generated_object, last_imported_mesh, basegeodesic, imported_hubmesh_to_use
#default superformparam = [3, 10, 10, 10, 1, 1, 4, 10, 10, 10, 1, 1, 0, 0, 0.0, 0.0, 0, 0]]
More information about the Bf-extensions-cvs
mailing list