[wx-dev] #9729: ogl.Shape.FormatText problem

wxTrac noreply at wxsite.net
Mon Jul 14 09:53:20 PDT 2008


Ticket URL: <http://trac.wxwidgets.org/ticket/9729>

#9729: ogl.Shape.FormatText problem
----------------------------------+-----------------------------------------
 Reporter:  jimslack              |       Owner:       
     Type:  defect                |      Status:  new  
 Priority:  high                  |   Milestone:       
Component:  wxPython              |     Version:  2.8.x
 Keywords:  ogl Shape FormatText  |   Blockedby:       
    Patch:  0                     |    Blocking:       
----------------------------------+-----------------------------------------
 ogl.Shape.FormatText crashes when the shape has text regions.  The current
 code in wx\lib\ogl\_basic.py (about line 512):


 {{{
     def FormatText(self, dc, s, i = 0):
         """Reformat the given text region; defaults to formatting the
         default region.
         """
         self.ClearText(i)

         if not self._regions:
             return

         if i > len(self._regions):  ### Bug here -- should be >=
             return

         region = self._regions[i]

         ## ...
 }}}

 If there is one region, it is region 0.  If i is 1, then i is not greater
 than the number of regions, so self._regions[i] raises an IndexError.

 I have attached a demo.  Click on the line between the two shapes to raise
 the error.  With the change, everything works fine.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9729>


More information about the wx-dev mailing list