ui/ImageView.py
def redraw(self):
        """
        Redraw scene with all necessary components
        :return: None
        """
        self.clear()
        self.refit()
        self.scene().setBackgroundBrush(QColor(0, 0, 0))
        if self.pixmap_src:  # Image loaded, draw image + relevant components
            self.draw_pixmap(self.pixmap_src)

            self.draw_ancillary_data()

            if self.enabled_observations:
                for uuid, enabled in self.enabled_observations.items():
                    if not enabled:
                        continue
                    for box in self.observation_map[uuid].metadata['boxes']:
                        box_item = self.draw_bounding_box(box, self.observation_map[uuid].metadata['box_manager'])
                        if self.selected_box == box:
                            box_item.set_highlighted(True)
                        if self.hovered_box == box:
                            self.draw_drag_corners(box_item)

            # Draw crosshairs
            self.scene().addLine(self.mouse_hline, self.mouse_line_pen)
            self.scene().addLine(self.mouse_vline, self.mouse_line_pen)
            self.setCursor(Qt.BlankCursor)

            drag_rect = self.calc_drag_rect()
            if drag_rect:  # Drag rectangle should be drawn
                top_left = self.get_scene_rel_point(QPointF(drag_rect.x(), drag_rect.y()))
                scaled_size = drag_rect.size() * self.pixmap_scalar
                self.scene().addRect(QRectF(top_left, scaled_size), QColor(0, 255, 0))
        else:  # No image loaded
            text_item = self.scene().addText('No image loaded.', QFont('Courier New'))
            text_item.setDefaultTextColor(QColor(255, 255, 255))
            text_item.setPos(self.width() / 2 - text_item.boundingRect().width() / 2,
                             self.height() / 2 - text_item.boundingRect().height() / 2)
            self.setCursor(Qt.ArrowCursor)

        Redraw scene with all necessary components
        :return: None
        
Redraw scene with all necessary components
Redraw scene with all necessary components
def redraw(self):
        self.clear()
        self.refit()
        self.scene().setBackgroundBrush(QColor(0, 0, 0))
        if self.pixmap_src:  
            self.draw_pixmap(self.pixmap_src)
            self.draw_ancillary_data()
            if self.enabled_observations:
                for uuid, enabled in self.enabled_observations.items():
                    if not enabled:
                        continue
                    for box in self.observation_map[uuid].metadata['boxes']:
                        box_item = self.draw_bounding_box(box, self.observation_map[uuid].metadata['box_manager'])
                        if self.selected_box == box:
                            box_item.set_highlighted(True)
                        if self.hovered_box == box:
                            self.draw_drag_corners(box_item)
            self.scene().addLine(self.mouse_hline, self.mouse_line_pen)
            self.scene().addLine(self.mouse_vline, self.mouse_line_pen)
            self.setCursor(Qt.BlankCursor)
            drag_rect = self.calc_drag_rect()
            if drag_rect:  
                top_left = self.get_scene_rel_point(QPointF(drag_rect.x(), drag_rect.y()))
                scaled_size = drag_rect.size() * self.pixmap_scalar
                self.scene().addRect(QRectF(top_left, scaled_size), QColor(0, 255, 0))
        else:  
            text_item = self.scene().addText('No image loaded.', QFont('Courier New'))
            text_item.setDefaultTextColor(QColor(255, 255, 255))
            text_item.setPos(self.width() / 2 - text_item.boundingRect().width() / 2,
                             self.height() / 2 - text_item.boundingRect().height() / 2)
            self.setCursor(Qt.ArrowCursor)
def redraw ( self ) : self . clear ( ) self . refit ( ) self . scene ( ) . setBackgroundBrush ( QColor ( 0 , 0 , 0 ) ) if self . pixmap_src : self . draw_pixmap ( self . pixmap_src ) self . draw_ancillary_data ( ) if self . enabled_observations : for uuid , enabled in self . enabled_observations . items ( ) : if not enabled : continue for box in self . observation_map [ uuid ] . metadata [ 'boxes' ] : box_item = self . draw_bounding_box ( box , self . observation_map [ uuid ] . metadata [ 'box_manager' ] ) if self . selected_box == box : box_item . set_highlighted ( True ) if self . hovered_box == box : self . draw_drag_corners ( box_item ) self . scene ( ) . addLine ( self . mouse_hline , self . mouse_line_pen ) self . scene ( ) . addLine ( self . mouse_vline , self . mouse_line_pen ) self . setCursor ( Qt . BlankCursor ) drag_rect = self . calc_drag_rect ( ) if drag_rect : top_left = self . get_scene_rel_point ( QPointF ( drag_rect . x ( ) , drag_rect . y ( ) ) ) scaled_size = drag_rect . size ( ) * self . pixmap_scalar self . scene ( ) . addRect ( QRectF ( top_left , scaled_size ) , QColor ( 0 , 255 , 0 ) ) else : text_item = self . scene ( ) . addText ( 'No image loaded.' , QFont ( 'Courier New' ) ) text_item . setDefaultTextColor ( QColor ( 255 , 255 , 255 ) ) text_item . setPos ( self . width ( ) / 2 - text_item . boundingRect ( ) . width ( ) / 2 , self . height ( ) / 2 - text_item . boundingRect ( ) . height ( ) / 2 ) self . setCursor ( Qt . ArrowCursor )
Redraw scene with all necessary components
Redraw scene with all necessary components
"""
        Redraw scene with all necessary components
        :return: None
        """ # Image loaded, draw image + relevant components # Draw crosshairs # Drag rectangle should be drawn # No image loaded
None
self