1f6d1aa5eb7d4c31960e7b2aba04d94439956a49,cellprofiler/gui/metadatactrl.py,MetadataControl,OnPaint,#MetadataControl#Any#,341

Before Change


        for i, token in enumerate(self.__tokens):
            if isinstance(token, self.MetadataToken):
                if start < i:
                    text = self.get_text(start, i)
                    dc.TextBackground = background_color
                    dc.DrawText(text, loc, self.padding)
                    loc += dc.GetTextExtent(text)[0]
                dc.TextBackground = metadata_color
                dc.DrawText(token.value, loc, self.padding)
                loc += dc.GetTextExtent(token.value)[0]
                start = i+1
        if start < len(self.__tokens):
            text = self.get_text(start)
            dc.TextBackground = background_color
            dc.DrawText(text, loc, self.padding)

After Change


            self.__tokens.insert(index, token)
        self.on_token_change()
    
    def OnPaint(self, event):
        dc = wx.GCDC(wx.BufferedPaintDC(self))
        dc.GraphicsContext.PushState()
        try:
            dc.BackgroundMode = wx.SOLID
            background_color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)
            metadata_color = get_primary_outline_color()
            dc.Background = wx.Brush(background_color)
            dc.Font = self.Font
            dc.Clear()
            if self.native_border:
                renderer = wx.RendererNative.Get()
                style = 0
                if self.FindFocus() == self:
                    style |= wx.CONTROL_FOCUSED | wx.CONTROL_CURRENT
                if not self.Enabled:
                    style |= wx.CONTROL_DISABLED
                renderer.DrawTextCtrl(self, dc, (0, 0, 
                                                 self.ClientSize[0], 
                                                 self.ClientSize[1]),
                                      style)
                dc.SetClippingRect((self.padding, self.padding, 
                                    self.ClientSize[0] - 2*self.padding,
                                    self.ClientSize[1] - 2*self.padding))
            loc = self.xoffset
            for i, token in enumerate(self.__tokens):
                if isinstance(token, self.MetadataToken):
                    dc.TextBackground = metadata_color
                    text = token.value
                else:
                    text = self.get_text(i, i+1)
                    dc.TextBackground = background_color
                dc.DrawText(text, loc, self.padding)
                loc += self.GetTextExtent(text)[0]
        finally:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: CellProfiler/CellProfiler
Commit Name: 1f6d1aa5eb7d4c31960e7b2aba04d94439956a49
Time: 2010-07-06
Author: leek@1fc53939-2000-0410-845c-e8453a809027
File Name: cellprofiler/gui/metadatactrl.py
Class Name: MetadataControl
Method Name: OnPaint


Project Name: CellProfiler/CellProfiler
Commit Name: 01444cc8270b4517efcb2060d2814e025325d5f1
Time: 2010-11-18
Author: leek@1fc53939-2000-0410-845c-e8453a809027
File Name: cellprofiler/gui/metadatactrl.py
Class Name: MetadataControl
Method Name: OnPaint


Project Name: CellProfiler/CellProfiler
Commit Name: 01444cc8270b4517efcb2060d2814e025325d5f1
Time: 2010-11-18
Author: leek@1fc53939-2000-0410-845c-e8453a809027
File Name: cellprofiler/gui/metadatactrl.py
Class Name: MetadataControl
Method Name: hit_test


Project Name: CellProfiler/CellProfiler
Commit Name: 1f6d1aa5eb7d4c31960e7b2aba04d94439956a49
Time: 2010-07-06
Author: leek@1fc53939-2000-0410-845c-e8453a809027
File Name: cellprofiler/gui/metadatactrl.py
Class Name: MetadataControl
Method Name: OnPaint