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

# Form implementation generated from reading ui file 'GUIEliminarJugador.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
from zeep import Client 
url ="http://localhost:58999/Service/ServiceJugador.svc?wsdl"
cliente = Client(wsdl=url)

class Ui_EliminarJugador(object):
    def setupUi(self, EliminarJugador):
        EliminarJugador.setObjectName("EliminarJugador")
        EliminarJugador.resize(327, 416)
        self.centralwidget = QtWidgets.QWidget(EliminarJugador)
        self.centralwidget.setObjectName("centralwidget")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(70, 250, 55, 16))
        self.label_5.setObjectName("label_5")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(70, 80, 55, 16))
        self.label_2.setObjectName("label_2")
        self.txtContrasena = QtWidgets.QLineEdit(self.centralwidget)
        self.txtContrasena.setGeometry(QtCore.QRect(70, 160, 181, 22))
        self.txtContrasena.setObjectName("txtContrasena")
        self.txtApodo = QtWidgets.QLineEdit(self.centralwidget)
        self.txtApodo.setGeometry(QtCore.QRect(70, 210, 181, 22))
        self.txtApodo.setObjectName("txtApodo")
        self.txtCuenta = QtWidgets.QLineEdit(self.centralwidget)
        self.txtCuenta.setGeometry(QtCore.QRect(70, 100, 181, 22))
        self.txtCuenta.setObjectName("txtCuenta")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(70, 20, 55, 16))
        self.label.setObjectName("label")
        self.btnEliminar = QtWidgets.QPushButton(self.centralwidget)
        self.btnEliminar.setGeometry(QtCore.QRect(40, 340, 93, 28))
        self.btnEliminar.setObjectName("btnEliminar")
        self.txtID = QtWidgets.QLineEdit(self.centralwidget)
        self.txtID.setGeometry(QtCore.QRect(70, 40, 181, 22))
        self.txtID.setObjectName("txtID")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(70, 140, 71, 16))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(70, 190, 55, 16))
        self.label_4.setObjectName("label_4")
        self.txtEmail = QtWidgets.QLineEdit(self.centralwidget)
        self.txtEmail.setGeometry(QtCore.QRect(70, 270, 181, 22))
        self.txtEmail.setObjectName("txtEmail")
        self.btnBuscar = QtWidgets.QPushButton(self.centralwidget)
        self.btnBuscar.setGeometry(QtCore.QRect(190, 340, 93, 28))
        self.btnBuscar.setObjectName("btnBuscar")
        EliminarJugador.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(EliminarJugador)
        self.statusbar.setObjectName("statusbar")
        EliminarJugador.setStatusBar(self.statusbar)

        #Accion del boton
        self.btnEliminar.clicked.connect(self.deleteJugador)
        self.btnBuscar.clicked.connect(self.buscarJugadorid)

        self.retranslateUi(EliminarJugador)
        QtCore.QMetaObject.connectSlotsByName(EliminarJugador)

    def retranslateUi(self, EliminarJugador):
        _translate = QtCore.QCoreApplication.translate
        EliminarJugador.setWindowTitle(_translate("EliminarJugador", "Eliminar Jugador"))
        self.label_5.setText(_translate("EliminarJugador", "Email"))
        self.label_2.setText(_translate("EliminarJugador", "Cuenta"))
        self.label.setText(_translate("EliminarJugador", "ID"))
        self.btnEliminar.setText(_translate("EliminarJugador", "Eliminar"))
        self.label_3.setText(_translate("EliminarJugador", "Contraseña"))
        self.label_4.setText(_translate("EliminarJugador", "Apodo"))
        self.btnBuscar.setText(_translate("EliminarJugador", "Buscar"))

    def deleteJugador(self):
        ID = self.txtID.text()
        cliente.service.DeleteJugador(ID)
   
    def buscarJugadorid(self):
        ID = self.txtID.text()
        jugador = cliente.service.FindById(ID)
        print(jugador.Apodo)    
        
        



if __name__ == "__main__":

    import sys
    app = QtWidgets.QApplication(sys.argv)
    EliminarJugador = QtWidgets.QMainWindow()
    ui = Ui_EliminarJugador()
    ui.setupUi(EliminarJugador)
    EliminarJugador.show()
    sys.exit(app.exec_())
