X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b881fc787d2823bdd8a415080b82feee90804a17..edc88f7c03660c5f7c86019d1e7c11fdb582661d:/wxPython/wx/lib/fancytext.py?ds=sidebyside
diff --git a/wxPython/wx/lib/fancytext.py b/wxPython/wx/lib/fancytext.py
index 0c71055b87..0c61639f19 100644
--- a/wxPython/wx/lib/fancytext.py
+++ b/wxPython/wx/lib/fancytext.py
@@ -3,42 +3,40 @@
 # o Updated for 2.5 compatability.
 #
 
-"""FancyText -- methods for rendering XML specified text
-
+"""
+FancyText -- methods for rendering XML specified text
+
 This module exports four main methods::
-
+
     def GetExtent(str, dc=None, enclose=True)
     def GetFullExtent(str, dc=None, enclose=True)
     def RenderToBitmap(str, background=None, enclose=True)
     def RenderToDC(str, dc, x, y, enclose=True)
-
-In all cases, 'str' is an XML string. Note that start and end tags
-are only required if *enclose* is set to False. In this case the 
-text should be wrapped in FancyText tags.
+
+In all cases, 'str' is an XML string. Note that start and end tags are
+only required if *enclose* is set to False. In this case the text
+should be wrapped in FancyText tags.
 
 In addition, the module exports one class::
-
+
     class StaticFancyText(self, window, id, text, background, ...)
-
-This class works similar to StaticText except it interprets its text 
+
+This class works similar to StaticText except it interprets its text
 as FancyText.
 
-The text can supportsuperscripts and subscripts, text
-in different sizes, colors, styles, weights and
-families. It also supports a limited set of symbols,
-currently , ,  as well as greek letters in both
-upper case (...) and lower case (...).
+The text can support superscripts and subscripts, text in different
+sizes, colors, styles, weights and families. It also supports a
+limited set of symbols, currently *times*, *infinity*, *angle* as well
+as greek letters in both upper case (*Alpha* *Beta*... *Omega*) and
+lower case (*alpha* *beta*... *omega*).
 
-We can use doctest/guitest to display this string in all its marked up glory.
-
 >>> frame = wx.Frame(wx.NULL, -1, "FancyText demo", wx.DefaultPosition)
->>> sft = StaticFancyText(frame, -1, __doc__, wx.Brush("light grey", wx.SOLID))
+>>> sft = StaticFancyText(frame, -1, testText, wx.Brush("light grey", wx.SOLID))
 >>> frame.SetClientSize(sft.GetSize())
 >>> didit = frame.Show()
 >>> from guitest import PauseTests; PauseTests()
 
-
-The End"""
+"""
 
 # Copyright 2001-2003 Timothy Hochberg
 # Use as you see fit. No warantees, I cannot be held responsible, etc.
@@ -277,15 +275,15 @@ class DCRenderer(Renderer):
 
     def renderCharacterData(self, data, x, y):
         self.dc.SetTextForeground(self.getCurrentColor())
-        self.dc.DrawText(data, (x, y))
+        self.dc.DrawText(data, x, y)
 
     def start_angle(self, attrs):
         self.dc.SetFont(self.getCurrentFont())
         self.dc.SetPen(self.getCurrentPen())
         width, height, descent, leading = self.dc.GetFullTextExtent("M")
         y = self.y + self.offsets[-1]
-        self.dc.DrawLine((iround(self.x), iround(y)), (iround( self.x+width), iround(y))) 
-        self.dc.DrawLine((iround(self.x), iround(y)), (iround(self.x+width), iround(y-width)))
+        self.dc.DrawLine(iround(self.x), iround(y), iround( self.x+width), iround(y))
+        self.dc.DrawLine(iround(self.x), iround(y), iround(self.x+width), iround(y-width))
         self.updateDims(width, height, descent, leading)
       
 
@@ -301,8 +299,8 @@ class DCRenderer(Renderer):
         r = iround( 0.95 * width / 4)
         xc = (2*self.x + width) / 2
         yc = iround(y-1.5*r)
-        self.dc.DrawCircle((xc - r, yc), r)
-        self.dc.DrawCircle((xc + r, yc), r)
+        self.dc.DrawCircle(xc - r, yc, r)
+        self.dc.DrawCircle(xc + r, yc, r)
         self.updateDims(width, height, 0, 0)
 
     def start_times(self, attrs):
@@ -313,8 +311,8 @@ class DCRenderer(Renderer):
         width *= 0.8
         width = iround(width+.5)
         self.dc.SetPen(wx.Pen(self.getCurrentColor(), 1))
-        self.dc.DrawLine((iround(self.x), iround(y-width)), (iround(self.x+width-1), iround(y-1)))
-        self.dc.DrawLine((iround(self.x), iround(y-2)), (iround(self.x+width-1), iround(y-width-1)))
+        self.dc.DrawLine(iround(self.x), iround(y-width), iround(self.x+width-1), iround(y-1))
+        self.dc.DrawLine(iround(self.x), iround(y-2), iround(self.x+width-1), iround(y-width-1))
         self.updateDims(width, height, 0, 0)
 
 
@@ -403,11 +401,49 @@ renderToDC = RenderToDC
 # Test Driver
 
 def test():
+    testText = \
+"""FancyText -- methods for rendering XML specified text
+
+This module exports four main methods::
+
+    def GetExtent(str, dc=None, enclose=True)
+    def GetFullExtent(str, dc=None, enclose=True)
+    def RenderToBitmap(str, background=None, enclose=True)
+    def RenderToDC(str, dc, x, y, enclose=True)
+
+In all cases, 'str' is an XML string. Note that start and end tags
+are only required if *enclose* is set to False. In this case the 
+text should be wrapped in FancyText tags.
+
+In addition, the module exports one class::
+
+    class StaticFancyText(self, window, id, text, background, ...)
+
+This class works similar to StaticText except it interprets its text 
+as FancyText.
+
+The text can supportsuperscripts and subscripts, text
+in different sizes, colors, styles, weights and
+families. It also supports a limited set of symbols,
+currently , ,  as well as greek letters in both
+upper case (...) and lower case (...).
+
+We can use doctest/guitest to display this string in all its marked up glory.
+
+>>> frame = wx.Frame(wx.NULL, -1, "FancyText demo", wx.DefaultPosition)
+>>> sft = StaticFancyText(frame, -1, __doc__, wx.Brush("light grey", wx.SOLID))
+>>> frame.SetClientSize(sft.GetSize())
+>>> didit = frame.Show()
+>>> from guitest import PauseTests; PauseTests()
+
+
+The End"""
+
     app = wx.PySimpleApp()
     box = wx.BoxSizer(wx.VERTICAL)
     frame = wx.Frame(None, -1, "FancyText demo", wx.DefaultPosition)
     frame.SetBackgroundColour("light grey")
-    sft = StaticFancyText(frame, -1, __doc__)
+    sft = StaticFancyText(frame, -1, testText)
     box.Add(sft, 1, wx.EXPAND)
     frame.SetSizer(box)
     frame.SetAutoLayout(True)