Improving comment text drawing method
authorlaurent
Fri, 24 Jul 2009 11:18:07 +0200
changeset 386 2049a2bd8017
parent 385 373635372b93
child 387 fcae4e40f296
Improving comment text drawing method
graphics/GraphicCommons.py
--- a/graphics/GraphicCommons.py	Fri Jul 24 11:13:03 2009 +0200
+++ b/graphics/GraphicCommons.py	Fri Jul 24 11:18:07 2009 +0200
@@ -2777,21 +2777,22 @@
                 wordwidth, wordheight = dc.GetTextExtent(test)
                 if y + wordheight > self.Pos.y + self.Size[1] - 10:
                     break
-                if wordwidth < self.Size[0] - 20 and i < len(words) - 1:
-                    linetext = test
-                    first = False
+                if wordwidth < self.Size[0] - 20:
+                    if i < len(words) - 1:
+                        linetext = test
+                        first = False
+                    else:
+                        dc.DrawText(test, self.Pos.x + 10, y)
+                        y += wordheight + 5
                 else:
-                    if wordwidth < self.Size[0] - 20 and i == len(words) - 1:
-                        dc.DrawText(test, self.Pos.x + 10, y)
+                    dc.DrawText(linetext, self.Pos.x + 10, y)
+                    if i == len(words) - 1:
+                        y += wordheight + 5
+                        if y + wordheight > self.Pos.y + self.Size[1] - 10:
+                            break
+                        dc.DrawText(word, self.Pos.x + 10, y)
                     else:
-                        dc.DrawText(linetext, self.Pos.x + 10, y)
-                        if i == len(words) - 1:
-                            y += wordheight + 5
-                            if y + wordheight > self.Pos.y + self.Size[1] - 10:
-                                break
-                            dc.DrawText(word, self.Pos.x + 10, y)
-                        else:
-                            linetext = word
+                        linetext = word
                     y += wordheight + 5
             if y + wordheight > self.Pos.y + self.Size[1] - 10:
                 break