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