#!/usr/bin/env python
#
# Copyright (C) 2020 IOFactory
#
# Author: Luis Galdos <luis.galdos@iofactory.es>
#

from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import Qt


def dialog_error(parent, title, msg):
    dlg = QMessageBox(parent)
    dlg.setObjectName('ErrorDialog')
    dlg.setIcon(QMessageBox.Critical)
    dlg.setText(f'<b>{title}</b>')
    dlg.setInformativeText(msg)
    dlg.setWindowTitle("Error")
    dlg.setStandardButtons(QMessageBox.Ok)
    #dlg.setDetailedText("The details are as follows:")

    btn = dlg.buttons()[0]
    btn.setObjectName('Button')
    btn.setIcon(QIcon())
    btn.setFixedSize(70, 30)
    btn.setFocusPolicy(Qt.NoFocus)

    dlg.exec_()
