[gen] Buttons can now be stretched to fit the size of the inner label.

This commit is contained in:
Gaetan Delannay 2014-04-20 19:22:40 +02:00
parent 2b1fc85512
commit 822e1a7c63
32 changed files with 91 additions and 61 deletions

View file

@ -1352,4 +1352,15 @@ class ToolMixin(BaseMixin):
"s.parentNode.insertBefore(ga, s);\n" \
"})();\n" % gaId
return code
def getButtonWidth(self, label):
'''Determine button width, in pixels, corresponding to the button
p_label.'''
l = len(label)
if l < 10:
width = '130px'
else:
# Consider 1 char = 6 pixels wide.
width = '%dpx' % (130 + ((l-10)*4))
return 'width:%s' % width
# ------------------------------------------------------------------------------