~qbzr-dev/qbzr/0.20

« back to all changes in this revision

Viewing changes to annotate.py

  • Committer: Lukas Lalinsky
  • Date: 2007-07-29 08:26:02 UTC
  • Revision ID: lalinsky@gmail.com-20070729082602-a0oamwwtocb12z09
annotate.py: Move the lines by one pixel, it looks better on Windows.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    def paintEvent(self, event):
46
46
        w = self.width()
47
47
        h = self.height()
48
 
        y = -self.verticalScrollBar().value()
 
48
        y = 1 - self.verticalScrollBar().value()
49
49
        painter = QtGui.QPainter(self.viewport())
50
50
        painter.setClipRect(event.rect())
 
51
        painter.setPen(QtGui.QColor(150, 150, 150))
51
52
        for pos, length, col in self.blocks:
52
53
            y1 = y + self.line_height * pos
53
54
            y2 = y1 + self.line_height * length
56
57
            if y2 >= 0:
57
58
                if y1 >= 0:
58
59
                    painter.fillRect(0, y1, w, y2, col)
59
 
                    painter.setPen(col.dark(150))
60
60
                    painter.drawLine(0, y1, w, y1)
61
61
                else:
62
62
                    painter.fillRect(0, 0, w, y2, col)