# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'featureEngineeringDialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets
import tennis_image
from final import FeaturesEngineering
from resultsDialog import ResultsDialog
from warningDialog import WarningDialog
import subprocess

absolute_path_to_data = "C:\\Users\\Sara\\Desktop\\master\\atp_matches_prediction\\atp_matches_all.csv"


class FeatureEngineeringDialog(object):
    def setupUi(self, Dialog, numOfMatches):
        Dialog.setObjectName("Dialog")
        Dialog.resize(699, 665)
        Dialog.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.labelFeatureEngineering = QtWidgets.QLabel(Dialog)
        self.labelFeatureEngineering.setGeometry(QtCore.QRect(20, 30, 241, 31))
        self.labelFeatureEngineering.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.labelFeatureEngineering.setStyleSheet("font: 20pt \'.SF NS Text\';\n"
                                                   "color: rgb(80, 80, 80);")
        self.labelFeatureEngineering.setAlignment(QtCore.Qt.AlignCenter)
        self.labelFeatureEngineering.setObjectName("labelFeatureEngineering")
        self.checkBpSaved = QtWidgets.QCheckBox(Dialog)
        self.checkBpSaved.setGeometry(QtCore.QRect(50, 270, 101, 20))
        self.checkBpSaved.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkBpSaved.setObjectName("checkBpSaved")
        self.checkOverallWL = QtWidgets.QCheckBox(Dialog)
        self.checkOverallWL.setGeometry(QtCore.QRect(220, 370, 121, 20))
        self.checkOverallWL.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkOverallWL.setObjectName("checkOverallWL")
        self.check12MnthsTotal = QtWidgets.QCheckBox(Dialog)
        self.check12MnthsTotal.setGeometry(QtCore.QRect(220, 310, 211, 20))
        self.check12MnthsTotal.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.check12MnthsTotal.setObjectName("check12MnthsTotal")
        self.lineEditTrain = QtWidgets.QLineEdit(Dialog)
        self.lineEditTrain.setGeometry(QtCore.QRect(130, 490, 91, 22))
        self.lineEditTrain.setAutoFillBackground(False)
        self.lineEditTrain.setStyleSheet("background-color: rgb(207, 211, 211);\n"
                                         "color: rgb(0, 0, 0);\n"
                                         "border-style:outset;\n"
                                         "border-radius:10px;\n"
                                         "font: 75 10pt \"MS Shell Dlg 2\";")
        self.lineEditTrain.setText("")
        self.lineEditTrain.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEditTrain.setObjectName("lineEditTrain")
        self.check2ndWon = QtWidgets.QCheckBox(Dialog)
        self.check2ndWon.setGeometry(QtCore.QRect(50, 250, 121, 20))
        self.check2ndWon.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.check2ndWon.setObjectName("check2ndWon")
        self.checkAcesVsDf = QtWidgets.QCheckBox(Dialog)
        self.checkAcesVsDf.setGeometry(QtCore.QRect(50, 290, 121, 20))
        self.checkAcesVsDf.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkAcesVsDf.setObjectName("checkAcesVsDf")
        self.check1stWon = QtWidgets.QCheckBox(Dialog)
        self.check1stWon.setGeometry(QtCore.QRect(50, 230, 91, 20))
        self.check1stWon.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.check1stWon.setObjectName("check1stWon")
        self.checkAvgReturn = QtWidgets.QCheckBox(Dialog)
        self.checkAvgReturn.setGeometry(QtCore.QRect(50, 330, 121, 20))
        self.checkAvgReturn.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkAvgReturn.setObjectName("checkAvgReturn")
        self.labelImageAtp = QtWidgets.QLabel(Dialog)
        self.labelImageAtp.setGeometry(QtCore.QRect(510, 530, 171, 131))
        self.labelImageAtp.setStyleSheet("background-image: url(:/tennis/1_WSaVCrl8q_68istViASidQ.jpeg);")
        self.labelImageAtp.setText("")
        self.labelImageAtp.setPixmap(QtGui.QPixmap(":/tennis/1_WSaVCrl8q_68istViASidQ.jpeg"))
        self.labelImageAtp.setScaledContents(True)
        self.labelImageAtp.setObjectName("labelImageAtp")
        self.checkSurfaceElo = QtWidgets.QCheckBox(Dialog)
        self.checkSurfaceElo.setGeometry(QtCore.QRect(220, 230, 121, 16))
        self.checkSurfaceElo.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkSurfaceElo.setObjectName("checkSurfaceElo")
        self.labelTitleMachineLearning = QtWidgets.QLabel(Dialog)
        self.labelTitleMachineLearning.setGeometry(QtCore.QRect(10, 410, 391, 31))
        self.labelTitleMachineLearning.setFocusPolicy(QtCore.Qt.WheelFocus)
        self.labelTitleMachineLearning.setStyleSheet("font: 20pt \'.SF NS Text\';\n"
                                                     "color: rgb(80, 80, 80);")
        self.labelTitleMachineLearning.setAlignment(QtCore.Qt.AlignCenter)
        self.labelTitleMachineLearning.setObjectName("labelTitleMachineLearning")
        self.labelImageData = QtWidgets.QLabel(Dialog)
        self.labelImageData.setGeometry(QtCore.QRect(270, 10, 81, 71))
        self.labelImageData.setStyleSheet("background-image: url(:/tennis/feature-engineering.jpg);")
        self.labelImageData.setText("")
        self.labelImageData.setPixmap(QtGui.QPixmap(":/tennis/feature-engineering.jpg"))
        self.labelImageData.setScaledContents(True)
        self.labelImageData.setWordWrap(False)
        self.labelImageData.setIndent(8)
        self.labelImageData.setObjectName("labelImageData")
        self.check1stPer = QtWidgets.QCheckBox(Dialog)
        self.check1stPer.setGeometry(QtCore.QRect(50, 210, 121, 20))
        self.check1stPer.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.check1stPer.setObjectName("check1stPer")
        self.labelSelectFeatures = QtWidgets.QLabel(Dialog)
        self.labelSelectFeatures.setGeometry(QtCore.QRect(40, 140, 411, 20))
        self.labelSelectFeatures.setStyleSheet("font: 10pt \"MS Shell Dlg 2\";\n"
                                               "color: rgb(33, 33, 33);")
        self.labelSelectFeatures.setObjectName("labelSelectFeatures")
        self.RunButton = QtWidgets.QPushButton(Dialog)
        self.RunButton.setGeometry(QtCore.QRect(340, 620, 141, 31))
        self.RunButton.setStyleSheet("color: rgb(250, 255, 255);\n"
                                     "background-color: rgb(70, 187, 241);\n"
                                     "border-style:outset;\n"
                                     "border-radius:10px;\n"
                                     "font: 75 14pt \"MS Shell Dlg 2\";")
        self.RunButton.setObjectName("RunButton")
        self.labelSelectAlgorithm = QtWidgets.QLabel(Dialog)
        self.labelSelectAlgorithm.setGeometry(QtCore.QRect(40, 530, 411, 20))
        self.labelSelectAlgorithm.setStyleSheet("font: 10pt \"MS Shell Dlg 2\";\n"
                                                "color: rgb(33, 33, 33);")
        self.labelSelectAlgorithm.setObjectName("labelSelectAlgorithm")
        self.labelTrain = QtWidgets.QLabel(Dialog)
        self.labelTrain.setGeometry(QtCore.QRect(60, 490, 61, 21))
        self.labelTrain.setStyleSheet("font: 75 9pt \"MS Shell Dlg 2\";\n"
                                      "color: rgb(33, 33, 33);")
        self.labelTrain.setAlignment(QtCore.Qt.AlignCenter)
        self.labelTrain.setObjectName("labelTrain")
        self.BackButton = QtWidgets.QPushButton(Dialog)
        self.BackButton.setGeometry(QtCore.QRect(180, 620, 141, 31))
        self.BackButton.setStyleSheet("color: rgb(250, 255, 255);\n"
                                      "background-color: rgb(70, 187, 241);\n"
                                      "border-style:outset;\n"
                                      "border-radius:10px;\n"
                                      "font: 75 14pt \"MS Shell Dlg 2\";")
        self.BackButton.setObjectName("BackButton")
        self.checkTourForm = QtWidgets.QCheckBox(Dialog)
        self.checkTourForm.setGeometry(QtCore.QRect(220, 270, 101, 20))
        self.checkTourForm.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkTourForm.setObjectName("checkTourForm")
        self.checkCompleteness = QtWidgets.QCheckBox(Dialog)
        self.checkCompleteness.setGeometry(QtCore.QRect(50, 350, 91, 20))
        self.checkCompleteness.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkCompleteness.setObjectName("checkCompleteness")
        self.lineEditTest = QtWidgets.QLineEdit(Dialog)
        self.lineEditTest.setGeometry(QtCore.QRect(300, 490, 91, 22))
        self.lineEditTest.setAutoFillBackground(False)
        self.lineEditTest.setStyleSheet("background-color: rgb(207, 211, 211);\n"
                                        "color: rgb(0, 0, 0);\n"
                                        "border-style:outset;\n"
                                        "border-radius:10px;\n"
                                        "font: 75 10pt \"MS Shell Dlg 2\";")
        self.lineEditTest.setText("")
        self.lineEditTest.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEditTest.setObjectName("lineEditTest")
        self.checkServAdv = QtWidgets.QCheckBox(Dialog)
        self.checkServAdv.setGeometry(QtCore.QRect(220, 350, 151, 20))
        self.checkServAdv.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkServAdv.setObjectName("checkServAdv")
        self.labelImageData_2 = QtWidgets.QLabel(Dialog)
        self.labelImageData_2.setGeometry(QtCore.QRect(390, 390, 71, 71))
        self.labelImageData_2.setStyleSheet("background-image: url(:/tennis/machine-learning-algorithm.jpg);")
        self.labelImageData_2.setText("")
        self.labelImageData_2.setPixmap(QtGui.QPixmap(":/tennis/machine-learning-algorithm.jpg"))
        self.labelImageData_2.setScaledContents(True)
        self.labelImageData_2.setWordWrap(False)
        self.labelImageData_2.setIndent(8)
        self.labelImageData_2.setObjectName("labelImageData_2")
        self.checkOverallService = QtWidgets.QCheckBox(Dialog)
        self.checkOverallService.setGeometry(QtCore.QRect(50, 310, 111, 20))
        self.checkOverallService.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkOverallService.setObjectName("checkOverallService")
        self.checkTotalElo = QtWidgets.QCheckBox(Dialog)
        self.checkTotalElo.setGeometry(QtCore.QRect(220, 250, 121, 20))
        self.checkTotalElo.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkTotalElo.setObjectName("checkTotalElo")
        self.checkLogRank = QtWidgets.QCheckBox(Dialog)
        self.checkLogRank.setGeometry(QtCore.QRect(220, 190, 81, 20))
        self.checkLogRank.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkLogRank.setObjectName("checkLogRank")
        self.checkClutch = QtWidgets.QCheckBox(Dialog)
        self.checkClutch.setGeometry(QtCore.QRect(50, 370, 121, 20))
        self.checkClutch.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkClutch.setObjectName("checkClutch")
        self.comboBoxAlgorithm = QtWidgets.QComboBox(Dialog)
        self.comboBoxAlgorithm.setGeometry(QtCore.QRect(70, 560, 161, 22))
        self.comboBoxAlgorithm.setStyleSheet("background-color: rgb(207, 211, 211);\n"
                                             "color: rgb(0, 0, 0);\n"
                                             "border : 1px black;\n"
                                             "border-radius:10px;\n"
                                             "font: 75 10pt \"MS Shell Dlg 2\";")
        self.comboBoxAlgorithm.setObjectName("comboBoxAlgorithm")
        self.comboBoxAlgorithm.addItem("")
        self.comboBoxAlgorithm.addItem("")
        self.comboBoxAlgorithm.addItem("")
        self.comboBoxAlgorithm.addItem("")
        self.comboBoxAlgorithm.addItem("")
        self.comboBoxAlgorithm.addItem("")
        self.comboBoxAlgorithm.addItem("")
        self.checkRankPoints = QtWidgets.QCheckBox(Dialog)
        self.checkRankPoints.setGeometry(QtCore.QRect(220, 210, 121, 20))
        self.checkRankPoints.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkRankPoints.setObjectName("checkRankPoints")
        self.checkHeadToHead = QtWidgets.QCheckBox(Dialog)
        self.checkHeadToHead.setGeometry(QtCore.QRect(220, 330, 121, 20))
        self.checkHeadToHead.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkHeadToHead.setObjectName("checkHeadToHead")
        self.checkAge = QtWidgets.QCheckBox(Dialog)
        self.checkAge.setGeometry(QtCore.QRect(50, 170, 81, 20))
        self.checkAge.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkAge.setObjectName("checkAge")
        self.checkRank = QtWidgets.QCheckBox(Dialog)
        self.checkRank.setGeometry(QtCore.QRect(220, 170, 81, 20))
        self.checkRank.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkRank.setObjectName("checkRank")
        self.labelCreateDataSet = QtWidgets.QLabel(Dialog)
        self.labelCreateDataSet.setGeometry(QtCore.QRect(40, 460, 411, 20))
        self.labelCreateDataSet.setStyleSheet("font: 10pt \"MS Shell Dlg 2\";\n"
                                              "color: rgb(33, 33, 33);")
        self.labelCreateDataSet.setObjectName("labelCreateDataSet")
        self.labelTest = QtWidgets.QLabel(Dialog)
        self.labelTest.setGeometry(QtCore.QRect(230, 490, 71, 21))
        self.labelTest.setStyleSheet("font: 75 9pt \"MS Shell Dlg 2\";\n"
                                     "color: rgb(33, 33, 33);")
        self.labelTest.setAlignment(QtCore.Qt.AlignCenter)
        self.labelTest.setObjectName("labelTest")
        self.checkHeight = QtWidgets.QCheckBox(Dialog)
        self.checkHeight.setGeometry(QtCore.QRect(50, 190, 81, 20))
        self.checkHeight.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.checkHeight.setObjectName("checkHeight")
        self.check12MnthsPer = QtWidgets.QCheckBox(Dialog)
        self.check12MnthsPer.setGeometry(QtCore.QRect(220, 290, 211, 20))
        self.check12MnthsPer.setStyleSheet("font: 7pt \"MS Shell Dlg 2\";")
        self.check12MnthsPer.setObjectName("check12MnthsPer")
        self.labelNumOfMatch = QtWidgets.QLabel(Dialog)
        self.labelNumOfMatch.setGeometry(QtCore.QRect(40, 100, 411, 20))
        self.labelNumOfMatch.setStyleSheet("font: 10pt \"MS Shell Dlg 2\";\n"
                                           "color: rgb(33, 33, 33);")
        self.labelNumOfMatch.setObjectName("labelNumOfMatch")
        self.lineEditNumOfMatch = QtWidgets.QLineEdit(Dialog)
        self.lineEditNumOfMatch.setGeometry(QtCore.QRect(210, 100, 91, 22))
        self.lineEditNumOfMatch.setAutoFillBackground(False)
        self.lineEditNumOfMatch.setStyleSheet("background-color: rgb(207, 211, 211);\n"
                                              "color: rgb(0, 0, 0);\n"
                                              "border-style:outset;\n"
                                              "border-radius:10px;\n"
                                              "font: 75 10pt \"MS Shell Dlg 2\";")
        self.lineEditNumOfMatch.setText(numOfMatches)
        self.lineEditNumOfMatch.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEditNumOfMatch.setReadOnly(True)
        self.lineEditNumOfMatch.setObjectName("lineEditNumOfMatch")
        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "ATP matches prediction - ML algorithms"))
        self.labelFeatureEngineering.setText(_translate("Dialog", "Feature engineering"))
        self.checkBpSaved.setText(_translate("Dialog", "Break point saved"))
        self.checkOverallWL.setText(_translate("Dialog", "Players overall win/loss"))
        self.check12MnthsTotal.setText(_translate("Dialog", "Total matches won in last 12 months"))
        self.check2ndWon.setText(_translate("Dialog", "2nd service won"))
        self.checkAcesVsDf.setText(_translate("Dialog", "Aces vs Double Faults"))
        self.check1stWon.setText(_translate("Dialog", "1st service won"))
        self.checkAvgReturn.setText(_translate("Dialog", "Points won on return"))
        self.checkSurfaceElo.setText(_translate("Dialog", "Surface 538Elo rating"))
        self.labelTitleMachineLearning.setText(_translate("Dialog", "Machine Learning Algorithm"))
        self.check1stPer.setText(_translate("Dialog", "1st service percenatge"))
        self.labelSelectFeatures.setText(_translate("Dialog", "Select features to use: "))
        self.RunButton.setText(_translate("Dialog", "Run"))
        self.labelSelectAlgorithm.setText(_translate("Dialog", "Select algorithm to use: "))
        self.labelTrain.setText(_translate("Dialog", "Train set:"))
        self.BackButton.setText(_translate("Dialog", "Back"))
        self.checkTourForm.setText(_translate("Dialog", "Torunament form"))
        self.checkCompleteness.setText(_translate("Dialog", "Completeness"))
        self.checkServAdv.setText(_translate("Dialog", "Serve Advantage"))
        self.checkOverallService.setText(_translate("Dialog", "Points won on service"))
        self.checkTotalElo.setText(_translate("Dialog", "Total 538Elo rating"))
        self.checkLogRank.setText(_translate("Dialog", "Log Rank"))
        self.checkClutch.setText(_translate("Dialog", "\'Clutch\' factor "))
        self.comboBoxAlgorithm.setItemText(0, _translate("Dialog", "Logistic Regression"))
        self.comboBoxAlgorithm.setItemText(1, _translate("Dialog", "KFold Logistic Regression"))
        self.comboBoxAlgorithm.setItemText(2, _translate("Dialog", "XGBoost Classifier"))
        self.comboBoxAlgorithm.setItemText(3, _translate("Dialog", "Linear Discriminant Analysis"))
        self.comboBoxAlgorithm.setItemText(4, _translate("Dialog", "Gaussian NB"))
        self.comboBoxAlgorithm.setItemText(5, _translate("Dialog", "Random Forest Classifier"))
        self.comboBoxAlgorithm.setItemText(6, _translate("Dialog", "Support Vector Classifier"))
        self.checkRankPoints.setText(_translate("Dialog", "Rank points"))
        self.checkHeadToHead.setText(_translate("Dialog", "Players head to head"))
        self.checkAge.setText(_translate("Dialog", "Age"))
        self.checkRank.setText(_translate("Dialog", "Rank"))
        self.labelCreateDataSet.setText(_translate("Dialog", "Create data sets:"))
        self.labelTest.setText(_translate("Dialog", "Test set:"))
        self.checkHeight.setText(_translate("Dialog", "Height"))
        self.check12MnthsPer.setText(_translate("Dialog", "Percentage of matches won in last 12 months"))
        self.labelNumOfMatch.setText(_translate("Dialog", "Number of matches in use:"))
        self.BackButton.clicked.connect(Dialog.close)
        self.RunButton.clicked.connect(self.get_data)

    def get_data(self):
        trainSetString = self.lineEditTrain.text()
        testSetString = self.lineEditTest.text()

        trainSet = 0
        if trainSetString.isnumeric():
            trainSet = int(trainSetString)

        testSet = 0
        if testSetString.isnumeric():
            testSet = int(testSetString)

        selectedAlgorithm = self.comboBoxAlgorithm.currentIndex()

        rollingCols = []

        if self.checkOverallService.isChecked():
            rollingCols.append('player_overall_win_on_serve_per')

        if self.checkAvgReturn.isChecked():
            rollingCols.append('player_avg_return_per')

        if self.checkClutch.isChecked():
            rollingCols.append('player_clutch_factor')

        if self.checkCompleteness.isChecked():
            rollingCols.append('player_completeness')

        if self.check1stPer.isChecked():
            rollingCols.append('player_1stPer')

        if self.check1stWon.isChecked():
            rollingCols.append('player_1stWonPer')

        if self.check2ndWon.isChecked():
            rollingCols.append('player_2ndWonPer')

        if self.checkBpSaved.isChecked():
            rollingCols.append('player_bpSbpF')

        if self.checkAcesVsDf.isChecked():
            rollingCols.append('player_acesVsDf')

        featureCols = []

        if self.checkServAdv.isChecked() and self.checkOverallService.isChecked() and self.checkAvgReturn.isChecked():
            featureCols.append('player_serve_advantage')

        if self.checkAge.isChecked():
            featureCols.append('player_age')

        if self.checkHeight.isChecked():
            featureCols.append('player_ht')

        if self.checkRank.isChecked():
            featureCols.append('player_rank')

        if self.checkLogRank.isChecked():
            featureCols.append('player_log_rank')

        if self.checkRankPoints.isChecked():
            featureCols.append('player_rank_points')

        if self.checkSurfaceElo.isChecked():
            featureCols.append('surface_elo')

        if self.checkTotalElo.isChecked():
            featureCols.append('538elo')

        if self.check12MnthsPer.isChecked():
            featureCols.append('per_of_matches_won_12_months')

        if self.check12MnthsTotal.isChecked():
            featureCols.append('total_matches_12_months')

        if self.checkTourForm.isChecked():
            featureCols.append('tournament_form')

        if self.checkHeadToHead.isChecked():
            featureCols.append('headToHead')

        if len(rollingCols) == 0 and len(featureCols) == 0:
            message = "You need to select at least one feature. Please select some and try again."
            self.openWarningDialog(message)
        elif trainSet < 0 or trainSet > 100 or testSet < 0 or testSet > 100 or (trainSet + testSet) != 100:
            message = "Data sets are not in the correct format.\nPlease enter something between 0 and 100% and try again.\n" \
                      "Note that sum of train and test test needs to be 100%."
            self.openWarningDialog(message)
        else:
            featureEngineering = FeaturesEngineering(absolute_path_to_data, len(rollingCols), len(rollingCols) + len(featureCols) + 1,
                                                     rollingCols, featureCols)
            featureEngineering.createDfAndFeatures()
            score = featureEngineering.runAlgorithm(selectedAlgorithm, testSet)
            s = subprocess.getstatusoutput(f'pyrcc5 -o tennis_image.py tennis_image.qrc')
            print(s)
            self.openResultDialog(str("{:.2f}".format(score * 100)) + '%')

    def openResultDialog(self, score):
        Dialog = QtWidgets.QDialog()
        ui = ResultsDialog()
        ui.setupUi(Dialog, score)
        Dialog.show()
        Dialog.exec_()

    def openWarningDialog(self, message):
        Dialog = QtWidgets.QDialog()
        ui = WarningDialog()
        ui.setupUi(Dialog, message)
        Dialog.show()
        Dialog.exec_()

