Trees | Indices | Help |
|
---|
|
1 #-*- coding: utf8 -* 2 # 3 # Max E. Kuznecov <syhpoon@syhpoon.name> 2008 4 # 5 # This file is part of XYZCommander. 6 # XYZCommander is free software: you can redistribute it and/or modify 7 # it under the terms of the GNU Lesser Public License as published by 8 # the Free Software Foundation, either version 3 of the License, or 9 # (at your option) any later version. 10 # XYZCommander is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU Lesser Public License for more details. 14 # You should have received a copy of the GNU Lesser Public License 15 # along with XYZCommander. If not, see <http://www.gnu.org/licenses/>. 16 17 from libxyz.ui import lowui 18 from libxyz.core.utils import ustring 1921 """ 22 Invalidate canvas after calling function 23 """ 24 25 def _touch(instance, *args, **kwargs): 26 _res = func(instance, *args, **kwargs) 27 instance._invalidate() 28 29 return _res30 31 return _touch 32 33 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3436 """ 37 Truncate text if its length exceeds cols 38 If backward is True, text will be truncated from the beginning 39 """ 40 41 text = ustring(text, enc) 42 43 _len = lowui.util.calc_width(text, 0, len(text)) 44 45 if _len < cols: 46 return text 47 else: 48 if backward: 49 return u"~%s" % text[-(cols - 1):] 50 else: 51 return u"%s~" % text[:cols - 1]52
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Jan 17 01:07:09 2010 | http://epydoc.sourceforge.net |