Bug fix: Don't infinite loop on notifications with too many characters without a space
This commit is contained in:
parent
e2d5b3316e
commit
2799a66acb
1 changed files with 9 additions and 1 deletions
8
toast.py
8
toast.py
|
@ -345,6 +345,14 @@ class PesterToast(QtGui.QWidget, DefaultToast):
|
|||
while metric.width(text, curspace) < maxwidth:
|
||||
lastspace = curspace
|
||||
curspace = text.find(" ", lastspace+1)
|
||||
if curspace == -1:
|
||||
break
|
||||
if (metric.width(text[:lastspace]) > maxwidth) or \
|
||||
len(text[:lastspace]) < 1:
|
||||
for i in xrange(len(text)):
|
||||
if metric.width(text[:i]) > maxwidth:
|
||||
lastspace = i-1
|
||||
break
|
||||
ret.append(text[:lastspace])
|
||||
text = text[lastspace+1:]
|
||||
ret.append(text)
|
||||
|
|
Loading…
Reference in a new issue