

from PyQt5.QtCore import*
from PyQt5.QtGui import*
from PyQt5.QtWidgets import *
from qgis.PyQt.QtWidgets import QWidget
from qgis.PyQt import QtCore, QtGui

class Ui_ECOAL(object):
    def setupUi(self, ECOAL):
        
        # create main window
        ECOAL.setWindowModality(QtCore.Qt.ApplicationModal)
        ECOAL.resize(1000,700)      
        
        # input raster
        # create gridLayout
        self.gridLayout1 = QGridLayout(ECOAL)
        self.gridLayout1.setObjectName("gridLayout1")
        
        # create groupBox input I
        self.groupBox1 = QGroupBox(ECOAL)
        self.groupBox1.setObjectName("groupBox1")
        self.groupBox1.setTitle("Input temperature data and study zone information")
        self.gridLayout3 = QGridLayout(self.groupBox1)
        self.gridLayout3.setObjectName("gridLayout3")
        self.gridLayout1.addWidget(self.groupBox1, 0,0,1,1) 
        # input txt file
        # define label
        self.inputLabel = QLabel(ECOAL)
        self.inputLabel.setObjectName("inputLabel")
        self.gridLayout3.addWidget(self.inputLabel, 0,0,1,1)        
        # create select button to input folder
        self.selectButton = QPushButton(ECOAL)
        self.selectButton.setObjectName("selectButton")
        self.gridLayout3.addWidget(self.selectButton,0,2,1,1)
        self.inputLayerCombo = QComboBox(ECOAL)
        self.inputLayerCombo.setObjectName("inputLayerCombo")
        self.gridLayout3.addWidget(self.inputLayerCombo, 0,1,1,1)  
        self.gridLayout3.setColumnStretch(1,1) 
        
        # input mask file
        self.inputmaskLabel = QLabel(ECOAL)
        self.inputmaskLabel.setObjectName("inputmaskLabel")
        self.gridLayout3.addWidget(self.inputmaskLabel, 1,0,1,1)        
        # create select button to input folder
        self.selectmaskButton = QPushButton(ECOAL)
        self.selectmaskButton.setObjectName("selectmaskButton")
        self.gridLayout3.addWidget(self.selectmaskButton,1,2,1,1)
        self.inputmaskCombo = QComboBox(ECOAL)
        self.inputmaskCombo.setObjectName("inputmaskCombo")
        self.gridLayout3.addWidget(self.inputmaskCombo, 1,1,1,1)  
        self.gridLayout3.setColumnStretch(1,1)    
        
        # create groupBox input II
        self.groupBox3 = QGroupBox(ECOAL)
        self.groupBox3.setObjectName("groupBox1")
        self.groupBox3.setTitle("Input coordinates information")
        self.gridLayout4 = QGridLayout(self.groupBox3)
        self.gridLayout4.setObjectName("gridLayout4")
        self.gridLayout1.addWidget(self.groupBox3, 1,0,1,1)         
        
        # input shp points
        #self.inputshpLabel = QLabel(ECOAL)
        #self.inputshpLabel.setObjectName("inputshpLabel")
        #self.gridLayout4.addWidget(self.inputshpLabel, 0,0,1,1)        
        # create select button to input folder
        self.checkshpbox = QRadioButton(ECOAL)
        self.checkshpbox.setObjectName("checkshpbox")
        self.checkshpbox.setChecked(True)  
        self.checkshpbox.setText('Input SHP points') 
        self.gridLayout4.addWidget(self.checkshpbox,0,0,1,1)
        self.selectshpButton = QPushButton(ECOAL)
        self.selectshpButton.setObjectName("selectshpButton")
        self.gridLayout4.addWidget(self.selectshpButton,0,2,1,1)
        self.inputshpCombo = QComboBox(ECOAL)
        self.inputshpCombo.setObjectName("inputshpCombo")
        self.gridLayout4.addWidget(self.inputshpCombo, 0,1,1,1)  
        self.gridLayout4.setColumnStretch(1,1)  
        
        # input txt with coordinates
        #self.inputtxtLabel = QLabel(ECOAL)
        #self.inputtxtLabel.setObjectName("inputtxtLabel")
        #self.gridLayout4.addWidget(self.inputtxtLabel, 1,0,1,1)        
        # create select button to input folder
        self.checktxtbox = QRadioButton(ECOAL)
        self.checktxtbox.setObjectName("checktxtbox")
        self.checktxtbox.setChecked(False)  
        self.checktxtbox.setText('Input TXT coordinate points') 
        self.gridLayout4.addWidget(self.checktxtbox,1,0,1,1)        
        self.selecttxtButton = QPushButton(ECOAL)
        self.selecttxtButton.setObjectName("selecttxtButton")
        self.gridLayout4.addWidget(self.selecttxtButton,1,2,1,1)
        self.inputtxtCombo = QComboBox(ECOAL)
        self.inputtxtCombo.setObjectName("inputtxtCombo")
        self.gridLayout4.addWidget(self.inputtxtCombo, 1,1,1,1)  
        self.gridLayout4.setColumnStretch(1,1)          

        # create groupBox output
        self.groupBox2 = QGroupBox(ECOAL)
        self.groupBox2.setObjectName("groupBox2")
        self.groupBox2.setTitle("Output")
        self.gridLayout4 = QGridLayout(self.groupBox2)
        self.gridLayout4.setObjectName("gridLayout4")
        self.gridLayout1.addWidget(self.groupBox2, 2,0,1,1)    
        
        # ouput tif images
        self.outputLabel = QLabel(ECOAL)
        self.outputLabel.setObjectName("outputLabel")
        self.gridLayout4.addWidget(self.outputLabel, 0,0,1,1)        
        # create select button to input folder
        self.selectoutButton = QPushButton(ECOAL)
        self.selectoutButton.setObjectName("selectoutButton")
        self.gridLayout4.addWidget(self.selectoutButton,0,2,1,1)
        self.outputCombo = QComboBox(ECOAL)
        self.outputCombo.setObjectName("outputCombo")
        self.gridLayout4.addWidget(self.outputCombo, 0,1,1,1)  
        self.gridLayout4.setColumnStretch(1,1)   
        
        # create groupBox video
        self.player = Phonon.VideoPlayer(ECOAL)
        self.play_pause = QPushButton("Play",ECOAL)
        self.play_pause.setObjectName("play_pause")  
        
        #self.groupBox5 = QGroupBox(ECOAL)
        #self.groupBox5.setObjectName("groupBox5")
        #self.groupBox5.setTitle("Video")
        #self.gridLayout5 = QGridLayout(self.groupBox5)
        #self.gridLayout5.setObjectName("gridLayout4")
        
        self.gridLayout1.addWidget(self.play_pause, 0,1,1,1)   
        self.gridLayout1.addWidget(self.player, 1,1,1,1) 
        #self.gridLayout1.addWidget(self.groupBox5, 0,1,1,1)  
        
        # input for point shapefile
        self.selectshp = QPushButton(ECOAL)
        self.selectshp.setObjectName("selectshp")
        self.gridLayout1.addWidget(self.selectshp,2,3,1,1)
        self.inputshppointCombo = QComboBox(ECOAL)
        self.inputshppointCombo.setObjectName("inputshppointCombo")
        self.gridLayout1.addWidget(self.inputshppointCombo, 2,2,1,1)  
        self.inputpointLabel = QLabel(ECOAL)
        self.inputpointLabel.setObjectName("inputpointLabel")
        self.gridLayout1.addWidget(self.inputpointLabel, 2,1,1,1)           
        self.gridLayout1.setColumnStretch(1,1)   
        
        # add point to plot
        self.plot = QPushButton("Plot",ECOAL)
        self.plot.setObjectName("plot")   
        self.gridLayout1.addWidget(self.plot, 3,1,1,1)
 
        # add image
        #self.groupBox4 = QImage(ECOAL)
        #self.groupBox4.loadFromData()
        #self.movieimg = QImage(ECOAL)
        #self.imagelbl = QLabel(ECOAL)
        #self.imagelbl.setAlignment(QtCore.Qt.AlignCenter)
        #self.imagelbl.setPixmap(QPixmap.fromImage(self.movieimg))
        
        #self.gridLayout1.addWidget(self.imagelbl, 1,4,1,1)          
        
        # button Ok, Close and Help
        self.buttonBox = QDialogButtonBox(ECOAL)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok|QDialogButtonBox.Cancel|QDialogButtonBox.Help)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout1.addWidget(self.buttonBox, 4, 0, 1, -1)          
        
        self.retranslateUi(ECOAL)
        self.buttonBox.rejected.connect(ECOAL.close)
    
    def retranslateUi(self, ECOAL):
        ECOAL.setWindowTitle("GIS-ECOAL")
        self.inputLabel.setText( 'Input temperature data folder:')
        self.selectButton.setText( 'Browse') 
        self.inputmaskLabel.setText( 'Input mask:')
        self.inputpointLabel.setText( 'Input point shp:')
        self.selectmaskButton.setText( 'Browse')  
        #self.inputshpLabel.setText( 'Input shp points:')
        self.selectshpButton.setText( 'Browse')
        self.selectshp.setText( 'Browse')
        #self.inputtxtLabel.setText( 'Input coordinates (txt file):')
        self.selecttxtButton.setText( 'Browse')         
        self.outputLabel.setText( 'Output tif images:')
        self.selectoutButton.setText( 'Browse')            
        
      