"""
Module for creation of the Dialog to select the user Role
"""

from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

#from layout import MainWindow
import utils.globalSettings as globalSettings
from utils.commonFunctions import *

USER_SELECT = False

class userDisplay(QWidget):
    """Module for creation of the Dialog to select the user Role"""
    def __init__(self):
        """Create the widget with the Dialog to select the user role"""
        super().__init__()

        LANGUAGE_PACK_USER_DISPLAY = globalSettings.LANGUAGE_SETTINGS.languagePack["userDisplay"]

        self.setWindowTitle(LANGUAGE_PACK_USER_DISPLAY["title"])
        #self.setWindowTitle("Nutzerrollenauswahl")
        #self.setFixedSize(500, 450)
        #self.setWindowFlag(Qt.FramelessWindowHint)

        layout = QVBoxLayout()

        self.headline = QLabel(LANGUAGE_PACK_USER_DISPLAY["title"])
        #self.headline = QLabel("Nutzerrollenauswahl")
        self.headline.setAlignment(Qt.AlignCenter)
        font = self.headline.font()
        font.setPointSize(20)
        self.headline.setFont(font)

        layout.addWidget(self.headline)

        self.subtext = QLabel(LANGUAGE_PACK_USER_DISPLAY["labelDialog"])
        self.subtext.setAlignment(Qt.AlignCenter)
        font = self.subtext.font()
        font.setPointSize(10)
        self.subtext.setFont(font)

        layout.addWidget(self.subtext)

        self.set_user_button_advanced = QPushButtonCustom(LANGUAGE_PACK_USER_DISPLAY["labelAdvanced"], 
            LANGUAGE_PACK_USER_DISPLAY["tooltipAdvanced"])
        self.set_user_button_programmer = QPushButtonCustom(LANGUAGE_PACK_USER_DISPLAY["labelProgrammer"], 
            LANGUAGE_PACK_USER_DISPLAY["tooltipProgrammer"])
        self.set_user_button_mechanic = QPushButtonCustom(LANGUAGE_PACK_USER_DISPLAY["labelMechanic"], 
            LANGUAGE_PACK_USER_DISPLAY["tooltipMechanic"])

        self.set_user_button_advanced.setToolTip("")
        self.set_user_button_programmer.setToolTip("")
        self.set_user_button_mechanic.setToolTip("")

        button_list = [self.set_user_button_advanced, self.set_user_button_programmer, self.set_user_button_mechanic]

        for button in button_list:
            button.setMinimumSize(100, 100)
            layout.addWidget(button)

        self.setLayout(layout)
    
