from qgis.PyQt import QtCore, QtGui
from qgis.core import *
from qgis.gui import *
from qgis.PyQt.QtWidgets import *


class Ui_ClassWindow(object):

    def setupUi(self, ClassWindow):
        # create NormalI window
        ClassWindow.setWindowModality(QtCore.Qt.ApplicationModal)
        ClassWindow.resize(450, 400)

        # download
        # create gridLayout
        self.gridLayout1 = QGridLayout(ClassWindow)
        self.gridLayout1.setObjectName("gridLayout1")
        # group box to input files
        self.groupBox = QGroupBox(ClassWindow)
        self.groupBox.setObjectName("groupBox")
        self.gridLayout2 = QGridLayout(self.groupBox)
        self.gridLayout2.setObjectName("gridLayout2")
        self.gridLayout1.addWidget(self.groupBox, 0, 0, 1, -1)
        # select button to download
        self.selectButton = QPushButton(ClassWindow)
        self.selectButton.setObjectName("selectButton")

        # define label (QWidget, row, column, QtAlignement)
        self.gridLayout2.addWidget(self.selectButton, 0, 0, 1, 1)

        # classification
        # group box
        self.groupBox2 = QGroupBox(ClassWindow)
        self.groupBox2.setObjectName("groupBox2")
        self.gridLayout3 = QGridLayout(self.groupBox2)
        self.gridLayout3.setObjectName("gridLayout3")
        self.gridLayout1.addWidget(self.groupBox2, 1, 0, 1, -1)

        # create label in gridLayout
        self.label_input = QLabel(ClassWindow)
        self.label_input.setObjectName("label_input")
        # define label (QWidget, row, column, QtAlignement)
        self.gridLayout3.addWidget(self.label_input, 0, 0, 1, 1)
        # combo box to classification techniques
        self.selectButton_input = QPushButton(ClassWindow)
        self.selectButton_input.setObjectName("selectButton_input")
        self.gridLayout3.addWidget(self.selectButton_input, 0, 2, 1, 1)
        self.comboboxsuperinput = QComboBox(ClassWindow)
        self.comboboxsuperinput.setObjectName("comboboxsuperinput")
        self.gridLayout3.addWidget(self.comboboxsuperinput, 0, 1, 1, 1)
        # create label in gridLayout
        self.label = QLabel(ClassWindow)
        self.label.setObjectName("label")
        # define label (QWidget, row, column, QtAlignement)
        self.gridLayout3.addWidget(self.label, 1, 0, 1, 1)
        # combo box to classification techniques
        self.comboboxsuper = QComboBox(ClassWindow)
        self.comboboxsuper.setObjectName("comboboxsuper")
        self.comboboxsuper.addItem('Supervised')
        self.comboboxsuper.addItem('Unsupervised')
        self.gridLayout3.addWidget(self.comboboxsuper, 1, 1, 1, 1)
        # create label in gridLayout
        self.label_train = QLabel(ClassWindow)
        self.label_train.setObjectName("label_train")
        self.gridLayout3.addWidget(self.label_train, 2, 0, 1, 1)
        # create select button to output file
        self.selectButton_out = QPushButton(ClassWindow)
        self.selectButton_out.setObjectName("selectButton_out")
        self.gridLayout3.addWidget(self.selectButton_out, 2, 2, 1, 1)
        self.outputLayerCombo = QComboBox(ClassWindow)
        self.outputLayerCombo.setObjectName("outputLayerCombo")
        self.gridLayout3.addWidget(self.outputLayerCombo, 2, 1, 1, 1)
        # create label in gridLayout
        self.label_classe = QLabel(ClassWindow)
        self.label_classe.setObjectName("label_classe")
        self.gridLayout3.addWidget(self.label_classe, 3, 0, 1, 1)
        # combo box to classe
        self.comboboxclasse = QComboBox(ClassWindow)
        self.comboboxclasse.setObjectName("comboboxclasse")
        self.gridLayout3.addWidget(self.comboboxclasse, 3, 1, 1, 1)
        # create label in gridLayout
        self.label_samples = QLabel(ClassWindow)
        self.label_samples.setObjectName("label_samples")
        self.gridLayout3.addWidget(self.label_samples, 4, 0, 1, 1)
        # spinbox samples
        self.samples = QSpinBox()
        self.samples.setMinimum(100)
        self.samples.setMaximum(10000000)
        self.samples.setValue(1000)
        self.samples.stepBy(1)
        self.samples.setObjectName("linex")
        self.gridLayout3.addWidget(self.samples, 4, 1, 1, 1)
        # create label method in gridLayout
        self.label_method = QLabel(ClassWindow)
        self.label_method.setObjectName("label_method")
        self.gridLayout3.addWidget(self.label_method, 5, 0, 1, 1)
        # combobox to method
        self.methodLayerCombo = QComboBox(ClassWindow)
        self.methodLayerCombo.setObjectName("methodLayerCombo")
        self.methodLayerCombo.addItem('SVM')
        self.methodLayerCombo.addItem('RF')
        self.gridLayout3.addWidget(self.methodLayerCombo, 5, 1, 1, 1)



        # button Ok, Close and Help
        self.buttonBox = QDialogButtonBox(ClassWindow)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Help | QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout1.addWidget(self.buttonBox, 6, 1, 1, 1)

        self.retranslateUi(ClassWindow)
        self.buttonBox.rejected.connect(ClassWindow.close)

    def retranslateUi(self, ClassWindow):
        ClassWindow.setWindowTitle('Classification Window')
        self.label.setText('Technique')
        self.label_input.setText('Input folder with 6 bands')
        self.label_method.setText('Method')
        self.selectButton.setText('Download Sentinel 2A images')
        self.label_train.setText('Input training areas')
        self.label_classe.setText('Classe')
        self.label_samples.setText('Number of samples')
        self.groupBox.setTitle("Download satellite images")
        self.groupBox2.setTitle("Classification")
        self.selectButton_out.setText('Browse')
        self.selectButton_input.setText('Browse')
