def OnPaint(self, evt):
        evt.Skip(False)

        if not self.repo:
            return

        # Setup drawing context
        pdc = wx.PaintDC(self)
        try:
            dc = wx.GCDC(pdc)
        except:
            dc = pdc

        dc.BeginDrawing()
        
        # Get basic drawing context details
        size = self.GetClientSize()
        clientWidth, clientHeight = size.GetWidth(), size.GetHeight()

        # Determine which commits to draw
        x, y, width, height = self.GetUpdateRegion().GetBox()
        start_x, start_y = self.CalcUnscrolledPosition(x, y)
        start_row, end_row = max(0, start_y/LINH-1), (start_y+height)/LINH+1

        # Setup pens, brushes and fonts
        commit_pen = wx.Pen(wx.Colour(0,0,0,255), width=2)
        commit_brush = wx.Brush(wx.Colour(255,255,255,255))
        commit_font = platformspec.Font(12)

        commit_textcolor_normal = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT)
        commit_textcolor_highlight = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT)

        edge_pens = [ wx.Pen(wx.Colour(*c), width=2) for c in EDGE_COLORS ]

        background_pen = wx.NullPen
        background_brush = wx.Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))

        selection_pen = wx.NullPen
        selection_brush = wx.Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT))
        
        separator_pen = wx.Pen(wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DLIGHT), width=1)

        ref_pens = [
            wx.Pen(wx.Colour(128,128,192,255), width=1),   # REF_BRANCH
            wx.Pen(wx.Colour(0,255,0,255), width=1),       # REF_REMOTE
            wx.Pen(wx.Colour(128,128,0,255), width=1),     # REF_TAG
            wx.Pen(wx.Colour(255,128,128,255), width=1),   # REF_HEADBRANCH
            wx.Pen(wx.Colour(255,0,0,255), width=1),       # REF_DETACHEDHEAD
            wx.Pen(wx.Colour(160,160,160,255), width=1)    # REF_MODULE
        ]
        ref_brushes = [
            wx.Brush(wx.Colour(160,160,255,255)), # REF_BRANCH
            wx.Brush(wx.Colour(128,255,128,255)), # REF_REMOTE
            wx.Brush(wx.Colour(255,255,128,255)), # REF_TAG
            wx.Brush(wx.Colour(255,160,160,255)), # REF_HEADBRANCH
            wx.Brush(wx.Colour(255,128,128,255)), # REF_DETACHEDHEAD
            wx.Brush(wx.Colour(192,192,192,255))  # REF_MODULE
        ]
        ref_font = platformspec.Font(9)
        ref_textcolor = wx.Colour(0,0,0,255)

        # Draw selection
        dc.SetPen(selection_pen)
        dc.SetBrush(selection_brush)
        for row in self.selection:
            if start_row <= row <= end_row:
                x, y = self.CalcScrolledPosition(0, (row+1)*LINH)
                dc.DrawRectangle(0, y-LINH/2, clientWidth, LINH)

        # Offsets
        offx = COLW
        offy = LINH

        # Draw edges
        edges = set()
        for node,row_edges in self.rows[start_row:end_row+1]:
            edges.update(row_edges)
        for edge in edges:
            if not edge: continue

            dc.SetPen(edge_pens[edge.color % len(EDGE_COLORS)])
            if edge.style == EDGE_DIRECT:
                x1, y1 = self.CalcScrolledPosition( edge.src.x*COLW+offx, edge.src.y*LINH+offy )
                x2, y2 = self.CalcScrolledPosition( edge.dst.x*COLW+offx, edge.dst.y*LINH+offy )
                dc.DrawLine(x1, y1, x2, y2)
            elif edge.style == EDGE_BRANCH:
                x1, y1 = self.CalcScrolledPosition( edge.src.x*COLW+offx, edge.src.y*LINH+offy )
                x2, y2 = self.CalcScrolledPosition( edge.dst.x*COLW+offx, edge.src.y*LINH+offy-7 )
                x3, y3 = self.CalcScrolledPosition( edge.dst.x*COLW+offx, edge.dst.y*LINH+offy )
                dc.DrawLine(x1, y1, x2, y2)
                dc.DrawLine(x2, y2, x3, y3)
            elif edge.style == EDGE_MERGE:
                x1, y1 = self.CalcScrolledPosition( edge.src.x*COLW+offx, edge.src.y*LINH+offy )
                x2, y2 = self.CalcScrolledPosition( edge.x*COLW+offx, edge.src.y*LINH+offy-7 )
                x3, y3 = self.CalcScrolledPosition( edge.x*COLW+offx, edge.dst.y*LINH+offy+7 )
                x4, y4 = self.CalcScrolledPosition( edge.dst.x*COLW+offx, edge.dst.y*LINH+offy )
                dc.DrawLine(x1, y1, x2, y2)
                dc.DrawLine(x2, y2, x3, y3)
                dc.DrawLine(x3, y3, x4, y4)

        # Draw commits
        dc.SetPen(commit_pen)
        dc.SetBrush(commit_brush)
        for node,edges in self.rows[start_row:end_row+1]:
            # Background pen & brush
            if self.rows.index((node, edges)) in self.selection:
                commit_bg_pen = selection_pen
                commit_bg_brush = selection_brush
            else:
                commit_bg_pen = background_pen
                commit_bg_brush = background_brush

            # Draw commit circle/rectangle
            if node.style == NODE_MERGE:
                x = node.x*COLW + COMW/2 - offx
                y = node.y*LINH + offy - COMW/2   
                xx, yy = self.CalcScrolledPosition(x, y)
                dc.DrawRectangle(xx, yy, COMW, COMW)
            else:
                x = node.x*COLW + offx
                y = node.y*LINH + offy
                xx, yy = self.CalcScrolledPosition(x, y)
                dc.DrawCircle(xx, yy, COMW/2)

            # Calculate column
            if node.y < len(self.rows)-1:
                text_column = max(len(edges), len(self.rows[node.y+1][1]))
            else:
                text_column = len(edges) if len(edges) > 0 else 1

            # Draw references
            msg_offset = 0

            for refname,reftype in node.references:
                dc.SetPen(ref_pens[reftype])
                dc.SetBrush(ref_brushes[reftype])
                dc.SetFont(ref_font)
                dc.SetTextForeground(ref_textcolor)

                x = text_column*COLW + offx + msg_offset
                y = node.y*LINH + offy - LINH/2 + 1
                width,height = dc.GetTextExtent(refname)
                
                if reftype in [REF_HEADBRANCH, REF_DETACHEDHEAD, REF_MODULE]:
                    points = [
                        (x, y+LINH/2-1),
                        (x+6, y),
                        (x+10 + width, y),
                        (x+10 + width, y+LINH-3),
                        (x+6, y+LINH-3)
                    ]
                    x += 6
                    points = [ self.CalcScrolledPosition(*p) for p in points ]
                    points = [ wx.Point(*p) for p in points ]

                    dc.DrawPolygon(points)
                    msg_offset += width+14
                else:
                    xx, yy = self.CalcScrolledPosition(x, y)
                    dc.DrawRoundedRectangle(xx, yy, width + 4, LINH-2, 2)
                    msg_offset += width+8

                dc.SetPen(commit_pen)
                dc.SetBrush(commit_brush)
                xx, yy = self.CalcScrolledPosition(x+2, y+1)
                dc.DrawText(safe_unicode(refname), xx, yy)

            # Draw message
            dc.SetFont(commit_font)
            x = text_column*COLW + offx + msg_offset
            y = node.y*LINH + offy - LINH/2
            xx, yy = self.CalcScrolledPosition(x, y)
            
            if self.rows.index((node, edges)) in self.selection:
                dc.SetTextForeground(commit_textcolor_highlight)
            else:
                dc.SetTextForeground(commit_textcolor_normal)

            dc.DrawText(safe_unicode(node.commit.short_msg), xx, yy)
            
            # Draw author & date
            x = clientWidth - self.authorColumnPos
            
            dc.SetBrush(commit_bg_brush)
            
            dc.SetPen(commit_bg_pen)
            xx, yy = self.CalcScrolledPosition(x, y)
            dc.DrawRectangle(xx-4, yy, clientWidth-x+4, LINH)
            
            dc.SetPen(separator_pen)
            dc.DrawLine(xx, yy, xx, yy+LINH)
            
            dc.SetPen(commit_pen)
            dc.SetBrush(commit_brush)
            author_text = u'%s, %s' % (safe_unicode(node.commit.author_name), safe_unicode(node.commit.author_date))
            dc.DrawText(author_text, xx+4, yy)

        dc.EndDrawing()
dataset/ETHPy150Open gyim/stupidgit/stupidgit_gui/CommitList.py/CommitList.OnPaint/swapped operands of `-`