SF.net SVN: fclient:[719] trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-25 07:03:07
|
Revision: 719
http://fclient.svn.sourceforge.net/fclient/?rev=719&view=rev
Author: jUrner
Date: 2008-07-25 07:03:16 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
new method to trunc a string
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-21 13:15:55 UTC (rev 718)
+++ trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-25 07:03:16 UTC (rev 719)
@@ -107,3 +107,21 @@
#****************************************************************************
#
#****************************************************************************
+def truncateString(n, qString, ellipsis):
+ """truncates a string from the right
+ @param n: size to truncate the string to
+ @param qString: string to truncate
+ @param ellispsis: (QString) ellipsis to be used for replacement chars
+ """
+ if qString.count() <= n:
+ return qString
+ ellipsis = QtCore.QString(ellipsis)
+ if n < ellipsis.count():
+ ellipsis.truncate(n)
+ return ellipsis
+ n = n - ellipsis.count()
+ if n < 0:
+ n = 0
+ qString.truncate(n)
+ return qString + ellipsis
+
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|