(self, painter)
paint error popup
paint error popup
paint error popup
def paint_error(self, painter):
        """ paint error popup
        """
        brdr_col = QColor('#444')
        back_col = QColor('#222')
        painter.setPen(Qt.red)
        back_rect = self.viewport().rect()
        back_rect.setWidth(back_rect.width() / 4)
        back_rect.setHeight(back_rect.height() / 4)
        screen_x = self.viewport().width() / 2
        screen_x -= back_rect.width() / 2
        screen_y = self.viewport().height() / 2
        screen_y -= back_rect.height() / 2
        painter.fillRect(0, 0,
                         self.viewport().width(),
                         self.viewport().height(), QColor('#99000000'))
        painter.fillRect(screen_x - 1, screen_y - 1,
                         back_rect.width() + 2,
                         back_rect.height() + 2, brdr_col)
        painter.fillRect(screen_x, screen_y, back_rect.width(),
                         back_rect.height(), back_col)
        qtext_align = QTextOption(Qt.AlignVCenter | Qt.AlignHCenter)
        text_rect = QRectF(screen_x + 10, screen_y + 10,
                           back_rect.width() - 20,
                           back_rect.height() - 20)
        painter.drawText(text_rect, self._error_message, option=qtext_align)
def paint_error ( self , painter ) : brdr_col = QColor ( '#444' ) back_col = QColor ( '#222' ) painter . setPen ( Qt . red ) back_rect = self . viewport ( ) . rect ( ) back_rect . setWidth ( back_rect . width ( ) / 4 ) back_rect . setHeight ( back_rect . height ( ) / 4 ) screen_x = self . viewport ( ) . width ( ) / 2 screen_x -= back_rect . width ( ) / 2 screen_y = self . viewport ( ) . height ( ) / 2 screen_y -= back_rect . height ( ) / 2 painter . fillRect ( 0 , 0 , self . viewport ( ) . width ( ) , self . viewport ( ) . height ( ) , QColor ( '#99000000' ) ) painter . fillRect ( screen_x - 1 , screen_y - 1 , back_rect . width ( ) + 2 , back_rect . height ( ) + 2 , brdr_col ) painter . fillRect ( screen_x , screen_y , back_rect . width ( ) , back_rect . height ( ) , back_col ) qtext_align = QTextOption ( Qt . AlignVCenter | Qt . AlignHCenter ) text_rect = QRectF ( screen_x + 10 , screen_y + 10 , back_rect . width ( ) - 20 , back_rect . height ( ) - 20 ) painter . drawText ( text_rect , self . _error_message , option = qtext_align )