[gen] Added params Type.swidth and Type.sheight to allow for different sizes for the search widgets.

This commit is contained in:
Gaetan Delannay 2013-02-19 09:57:02 +01:00
parent 24089ef674
commit f6b2afc423
9 changed files with 59 additions and 50 deletions

View file

@ -396,12 +396,11 @@ class ToolMixin(BaseMixin):
res = getattr(self.appy(), toolFieldName)
return res
def truncateValue(self, value, appyType):
'''Truncates the p_value according to p_appyType width.'''
maxWidth = appyType['width']
def truncateValue(self, value, width=15):
'''Truncates the p_value according to p_width.'''
if isinstance(value, str): value = value.decode('utf-8')
if len(value) > maxWidth:
return value[:maxWidth].encode('utf-8') + '...'
if len(value) > width:
return value[:width].encode('utf-8') + '...'
return value.encode('utf-8')
def truncateText(self, text, width=15):