Exemplo n.º 1
0
    def paintEvent(self, event):
        painter = QPainter(self)
        width = self.width()
        height = self.height()

        painter.fillRect(0, 0, width, height, self.color)

        draw_rect(painter, 0, 0, width, height, 1, Qt.black)
Exemplo n.º 2
0
    def paintEvent(self, event):
        painter = QPainter(self)
        width = self.width()
        height = self.height()

        painter.fillRect(0, 0, width, height, QColor(245, 245, 245))

        draw_rect(painter, 0, 0, width, height, 1, QColor(190, 190, 190))

        filled_bar_width = int(round(float(width - self.border * 2 - 1) * self.value / self.max_value + 1))

        painter.fillRect(self.border, self.border, filled_bar_width, height - self.border * 2, self.gradient)
Exemplo n.º 3
0
    def paintEvent(self, _event):
        painter = QPainter(self)
        width = self.width()
        height = self.height()

        if self.on:
            fill_color = self.brightness_colors[self.brightness]
        else:
            fill_color = self.background_color

        if self.style == 'rectangular':
            painter.fillRect(0, 0, width, height, fill_color)
            draw_rect(painter, 0, 0, width, height, 1, self.border_color)
        elif self.style == 'circular':
            painter.setPen(self.border_color)
            painter.setBrush(fill_color)
            painter.drawEllipse(1, 1, width - 2, height - 2)
Exemplo n.º 4
0
    def paintEvent(self, event):
        painter = QPainter(self)

        if self.main_ui.combo_interpolation.currentIndex() == 0:
            scale_mode = Qt.SmoothTransformation
        else:
            scale_mode = Qt.FastTransformation

        painter.drawImage(
            event.rect(),
            self.image.scaledToWidth(self.width * self.image_pixel_size,
                                     scale_mode))

        if self.agc_roi_from != None and self.agc_roi_to != None and not self.image_is_16bit:
            from_x, from_y, to_x, to_y = self.agc_roi_from.x(
            ), self.agc_roi_from.y(), self.agc_roi_to.x(), self.agc_roi_to.y()
            draw_rect(
                painter,
                from_x * self.image_pixel_size + self.image_pixel_size // 2,
                from_y * self.image_pixel_size + self.image_pixel_size // 2,
                (to_x - from_x) * self.image_pixel_size + 1,
                (to_y - from_y) * self.image_pixel_size + 1, 1, Qt.green)

            self.main_ui.update_agc_roi_label()

        if self.spotmeter_roi_from != None and self.spotmeter_roi_to != None:
            pen = QPen()
            pen.setColor(Qt.white)
            pen.setWidth(1)
            painter.setPen(pen)

            from_x, from_y, to_x, to_y = self.spotmeter_roi_from.x(
            ), self.spotmeter_roi_from.y(), self.spotmeter_roi_to.x(
            ), self.spotmeter_roi_to.y()

            from_x = from_x * self.image_pixel_size + self.image_pixel_size // 2 + 1
            from_y = from_y * self.image_pixel_size + self.image_pixel_size // 2 + 1
            to_x = to_x * self.image_pixel_size + self.image_pixel_size // 2 - 1
            to_y = to_y * self.image_pixel_size + self.image_pixel_size // 2 - 1

            cross_x = from_x + (to_x - from_x) / 2.0
            cross_y = from_y + (to_y - from_y) / 2.0

            if to_x - from_x > self.image_pixel_size or to_y - from_y > self.image_pixel_size:
                lines = [
                    QLineF(from_x, from_y, from_x + self.crosshair_width,
                           from_y),
                    QLineF(from_x, from_y, from_x,
                           from_y + self.crosshair_width),
                    QLineF(to_x, to_y, to_x, to_y - self.crosshair_width),
                    QLineF(to_x, to_y, to_x - self.crosshair_width, to_y),
                    QLineF(from_x, to_y, from_x, to_y - self.crosshair_width),
                    QLineF(from_x, to_y, from_x + self.crosshair_width, to_y),
                    QLineF(to_x, from_y, to_x, from_y + self.crosshair_width),
                    QLineF(to_x, from_y, to_x - self.crosshair_width, from_y)
                ]
                painter.drawLines(lines)

            lines = [
                QLineF(cross_x - self.crosshair_width, cross_y,
                       cross_x + self.crosshair_width, cross_y),
                QLineF(cross_x, cross_y - self.crosshair_width, cross_x,
                       cross_y + self.crosshair_width)
            ]
            painter.drawLines(lines)

            self.main_ui.update_spotmeter_roi_label()
Exemplo n.º 5
0
    def paintEvent(self, _event):
        painter = QPainter(self)

        draw_rect(painter, 0, 0, self.width(), self.height(), 1,
                  self.outline_color)