X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..d85004c5ae08c3ae2f66e39fc271e3761dc1366e:/wxPython/wx/lib/fancytext.py?ds=sidebyside diff --git a/wxPython/wx/lib/fancytext.py b/wxPython/wx/lib/fancytext.py index d6f751bd86..ddc45b0667 100644 --- a/wxPython/wx/lib/fancytext.py +++ b/wxPython/wx/lib/fancytext.py @@ -1,3 +1,8 @@ +# 12/02/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o Updated for 2.5 compatability. +# + """FancyText -- methods for rendering XML specified text This module exports four main methods:: @@ -34,11 +39,14 @@ We can use doctest/guitest to display this string in all its marked up glory. The End""" + # Copyright 2001-2003 Timothy Hochberg -# Use as you see fit. No warantees, I cannot be help responsible, etc. +# Use as you see fit. No warantees, I cannot be held responsible, etc. + import copy import math import sys + import wx import xml.parsers.expat @@ -269,15 +277,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) @@ -293,8 +301,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): @@ -305,8 +313,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) @@ -395,9 +403,9 @@ renderToDC = RenderToDC # Test Driver def test(): - app = wx.PyApp() + app = wx.PySimpleApp() box = wx.BoxSizer(wx.VERTICAL) - frame = wx.Frame(wx.NULL, -1, "FancyText demo", wx.DefaultPosition) + frame = wx.Frame(None, -1, "FancyText demo", wx.DefaultPosition) frame.SetBackgroundColour("light grey") sft = StaticFancyText(frame, -1, __doc__) box.Add(sft, 1, wx.EXPAND)