647 if self.__curTool == self.Line: |
647 if self.__curTool == self.Line: |
648 painter.drawLine(start, end) |
648 painter.drawLine(start, end) |
649 |
649 |
650 elif self.__curTool in [self.Rectangle, self.FilledRectangle, |
650 elif self.__curTool in [self.Rectangle, self.FilledRectangle, |
651 self.RectangleSelection]: |
651 self.RectangleSelection]: |
652 l = min(start.x(), end.x()) |
652 left = min(start.x(), end.x()) |
653 t = min(start.y(), end.y()) |
653 top = min(start.y(), end.y()) |
654 r = max(start.x(), end.x()) |
654 right = max(start.x(), end.x()) |
655 b = max(start.y(), end.y()) |
655 bottom = max(start.y(), end.y()) |
656 if self.__curTool == self.RectangleSelection: |
656 if self.__curTool == self.RectangleSelection: |
657 painter.setBrush(QBrush(drawColor)) |
657 painter.setBrush(QBrush(drawColor)) |
658 if self.__curTool == self.FilledRectangle: |
658 if self.__curTool == self.FilledRectangle: |
659 for y in range(t, b + 1): |
659 for y in range(top, bottom + 1): |
660 painter.drawLine(l, y, r, y) |
660 painter.drawLine(left, y, right, y) |
661 else: |
661 else: |
662 painter.drawRect(l, t, r - l, b - t) |
662 painter.drawRect(left, top, right - left, bottom - top) |
663 if self.__selecting: |
663 if self.__selecting: |
664 self.__selRect = QRect(l, t, r - l + 1, b - t + 1) |
664 self.__selRect = QRect( |
|
665 left, top, right - left + 1, bottom - top + 1) |
665 self.__selectionAvailable = True |
666 self.__selectionAvailable = True |
666 self.selectionAvailable.emit(True) |
667 self.selectionAvailable.emit(True) |
667 |
668 |
668 elif self.__curTool in [self.Circle, self.FilledCircle, |
669 elif self.__curTool in [self.Circle, self.FilledCircle, |
669 self.CircleSelection]: |
670 self.CircleSelection]: |