Esempio n. 1
0
class Main(QMainWindow, Ui_Main):
    def __init__(self, parent=None):
        super(Main, self).__init__(parent)
        self.setupUI(self)

        self.cad = Cadastro()
        self.tela_inicial.pushButton.clicked.connect(self.abrirTelaCadastro)
        self.tela_inicial.pushButton_2.clicked.connect(self.abrirTelaBuscar)

        self.tela_cadastro.pushButton.clicked.connect(self.botaoCadastra)
        self.tela_buscar.pushButton.clicked.connect(self.botaoBusca)
        self.tela_buscar.pushButton_2.clicked.connect(self.botaoVoltar)

    def botaoCadastra(self):
        nome = self.tela_cadastro.lineEdit.text()
        endereco = self.tela_cadastro.lineEdit_2.text()
        cpf = self.tela_cadastro.lineEdit_3.text()
        nascimento = self.tela_cadastro.lineEdit_4.text()
        if not (nome == '' or endereco == '' or cpf == '' or nascimento == ''):
            p = Pessoa(nome, endereco, cpf, nascimento)
            if self.cad.cadastra(p):
                QMessageBox.information(None, 'POOII',
                                        'Cadastro realizado com sucesso!')
                self.tela_cadastro.lineEdit.setText('')
                self.tela_cadastro.lineEdit_2.setText('')
                self.tela_cadastro.lineEdit_3.setText('')
                self.tela_cadastro.lineEdit_4.setText('')
            else:
                QMessageBox.information(
                    None, 'POOII',
                    'O CPF informado já está cadastrado na base de dados!')
        else:
            QMessageBox.information(None, 'POOII',
                                    'Todos os valores devem ser preenchidos!')

        self.QtStack.setCurrentIndex(0)

    def botaoBusca(self):

        cpf = self.tela_buscar.lineEdit.text()
        pessoa = self.cad.busca(cpf)
        if pessoa is not None:
            self.tela_buscar.lineEdit_2.setText(pessoa.nome)
            self.tela_buscar.lineEdit_3.setText(pessoa.endereco)
            self.tela_buscar.lineEdit_4.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None, 'POOII', 'CPF não encontrado!')

    def botaoVoltar(self):
        self.tela_buscar.lineEdit.setText('')
        self.tela_buscar.lineEdit_2.setText('')
        self.tela_buscar.lineEdit_3.setText('')
        self.tela_buscar.lineEdit_4.setText('')
        self.QtStack.setCurrentIndex(0)

    def abrirTelaCadastro(self):
        self.QtStack.setCurrentIndex(1)

    def abrirTelaBuscar(self):
        self.QtStack.setCurrentIndex(2)
Esempio n. 2
0
class Main(Ui_MultWindow):
    def setupUi(self, Main):
        super().setupUi(Main)
        self.cadastro = Cadastro()
        self.mainScreen.pushButtonScreenRegister.clicked.connect(
            self.buttonScreenRegister)
        self.mainScreen.pushButtonScreenSearch.clicked.connect(
            self.buttonScreenSearch)

        self.registerScreen.pushButtonRegister.clicked.connect(
            self.buttonRegister)
        self.searchScreen.pushButtonSearch.clicked.connect(self.buttonSearch)
        self.searchScreen.pushButtonReturn.clicked.connect(
            self.returnMainScreen)

    def returnMainScreen(self):
        self.QtStack.setCurrentIndex(0)

    def buttonScreenRegister(self):
        self.QtStack.setCurrentIndex(1)

    def buttonScreenSearch(self):
        self.QtStack.setCurrentIndex(2)

    def buttonRegister(self):
        nome = self.registerScreen.lineEditNameIn.text()
        endereco = self.registerScreen.lineEditCityIn.text()
        cpf = self.registerScreen.lineEditCpfIn.text()
        nascimento = self.registerScreen.lineEditDateIn.text()

        if not (nome == '' or endereco == '' or cpf == '' or nascimento == ''):
            p = Pessoa(nome, endereco, cpf, nascimento)
            if (self.cadastro.cadastrar(p)):
                QMessageBox.information(None, "POOII",
                                        "Cadastro realizado com sucesso!")
                self.registerScreen.lineEditNameIn.setText('')
                self.registerScreen.lineEditCityIn.setText('')
                self.registerScreen.lineEditDateIn.setText('')
                self.registerScreen.lineEditCpfIn.setText('')
            else:
                QMessageBox.information(None, "POOII", "CPF invalido!")
        else:
            QMessageBox.information(None, "POOII",
                                    "Todos os valores devem ser preenchidos!")

        self.returnMainScreen()

    def buttonSearch(self):
        cpf = self.searchScreen.lineEditCpfSearch.text()
        pessoa = self.cadastro.busca(cpf)
        if (pessoa):
            self.searchScreen.lineEditNameOut.setText(pessoa.nome)
            self.searchScreen.lineEditCityOut.setText(pessoa.endereco)
            self.searchScreen.lineEditDateOut.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None, "POOII", "CPF não encontrado!")
Esempio n. 3
0
    def __init__(self, parent=None):
        super(Main, self).__init__(parent)
        self.setupUI(self)

        self.cad = Cadastro()
        self.tela_inicial.pushButton.clicked.connect(self.abrirTelaCadastro)
        self.tela_inicial.pushButton_2.clicked.connect(self.abrirTelaBuscar)

        self.tela_cadastro.pushButton.clicked.connect(self.botaoCadastra)
        self.tela_buscar.pushButton.clicked.connect(self.botaoBusca)
        self.tela_buscar.pushButton_2.clicked.connect(self.botaoVoltar)
Esempio n. 4
0
    def setupUi(self, Main):
        super().setupUi(Main)
        self.cadastro = Cadastro()
        self.mainScreen.pushButtonScreenRegister.clicked.connect(
            self.buttonScreenRegister)
        self.mainScreen.pushButtonScreenSearch.clicked.connect(
            self.buttonScreenSearch)

        self.registerScreen.pushButtonRegister.clicked.connect(
            self.buttonRegister)
        self.searchScreen.pushButtonSearch.clicked.connect(self.buttonSearch)
        self.searchScreen.pushButtonReturn.clicked.connect(
            self.returnMainScreen)
Esempio n. 5
0
class Main(QMainWindow, Ui_Main):
    def __init__(self, parent=None):
        super(Main, self).__init__(parent)
        self.setupUI(self)

        self.cad = Cadastro()
        self.tela_inicial.button_cadastrar.clicked.connect(
            self.abrirTelaCadastro)
        self.tela_inicial.button_buscar.clicked.connect(self.abrirTelaBuscar)

        self.tela_cadastro.pushButton.clicked.connect(self.botaoCadastra)
        self.tela_busca.button_buscar.clicked.connect(self.botaoBusca)

    def botaoCadastra(self):
        nome = self.tela_cadastro.line_nome.text()
        endereco = self.tela_cadastro.line_endereco.text()
        cpf = self.tela_cadastro.line_cpf.text()
        nascimento = self.tela_cadastro.lineEdit_4.text()
        if not ((nome == '') or (endereco == '') or (cpf == '') or
                (nascimento == '')):
            p = Pessoa(nome, endereco, cpf, nascimento)
            if (self.cad.cadastra(p)):
                QMessageBox.information(None, 'POOII', 'Cadastro Realizado!')
                self.tela_cadastro.line_nome.setText('')
                self.tela_cadastro.line_endereco.setText('')
                self.tela_cadastro.line_cpf.setText('')
                self.tela_cadastro.lineEdit_4.setText('')
            else:
                QMessageBox.information(None, 'POOII',
                                        'O CPF ja esta cadastrado')
        else:
            QMessageBox.information(None, 'POOII',
                                    'Todos os valores devem ser informados!')
        self.QtStack.setCurrentIndex(0)

    def botaoBusca(self):
        cpf = self.tela_busca.line_cpf_busca.text()
        pessoa = self.cad.busca(cpf)
        if (pessoa != None):
            self.tela_busca.line_result_nome.setText(pessoa.nome)
            self.tela_busca.line_result_end.setText(pessoa.endereco)
            self.tela_busca.line_result_nasc.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None, 'POOII', 'CPF não encontrado')

    def abrirTelaCadastro(self):
        self.QtStack.setCurrentIndex(1)

    def abrirTelaBuscar(self):
        self.QtStack.setCurrentIndex(2)
Esempio n. 6
0
    def Controle(self, opcao, opcao2):

        cad = Cadastro()
        relatorio = Relatorio()


        if opcao == 1:
            if opcao2 == 1:
                self.__lstcliente.append(cad.cadastraPessoa())
            elif opcao2 == 2:
                self.__lstfornecedor.append(cad.cadastraFornecedor())
            elif opcao2 == 3:
                self.__lstproduto.append(cad.cadastraProduto())
            elif opcao2 == 4:
                self.__lstvenda.append(cad.cadastraVenda())
            elif opcao2 == 5:
                self.__lstcompra.append(cad.cadastraCompra())
        elif opcao == 2:
            if opcao2 == 1:
                relatorio.apagar(self.__lstfornecedor, self.__lstproduto, self.__lstcompra)
            elif opcao2 == 2:
                relatorio.areceber(self.__lstcliente, self.__lstvenda, self.__lstproduto)
            elif opcao2 == 3:
                relatorio.vendasprod(self.__lstproduto, self.__lstvenda)
            elif opcao2 == 4:
                relatorio.estoque(self.__lstproduto, self.__lstvenda, self.__lstcompra)
            elif opcao2 == 5:
                relatorio.estoque(self.__lstproduto, self.__lstvenda, self.__lstcompra)
                relatorio.apagar(self.__lstfornecedor, self.__lstproduto, self.__lstcompra)
                relatorio.areceber(self.__lstcliente, self.__lstvenda, self.__lstproduto)
                relatorio.vendasprod(self.__lstproduto, self.__lstvenda)
        elif opcao == 3:
            self.__lstcliente = cad.PopularBancoCliente()
            self.__lstfornecedor = cad.PopularBancoFornecedor()
            self.__lstproduto = cad.PopularBancoProduto()
            self.__lstcompra = cad.PopularBancoCompra()
            self.__lstvenda = cad.PopularBancoVenda()
Esempio n. 7
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(547, 586)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label_titulo_cadastro = QtWidgets.QLabel(self.centralwidget)
        self.label_titulo_cadastro.setGeometry(QtCore.QRect(170, 0, 221, 61))
        font = QtGui.QFont()
        font.setPointSize(16)
        self.label_titulo_cadastro.setFont(font)
        self.label_titulo_cadastro.setObjectName("label_titulo_cadastro")
        self.label_name = QtWidgets.QLabel(self.centralwidget)
        self.label_name.setGeometry(QtCore.QRect(40, 90, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_name.setFont(font)
        self.label_name.setObjectName("label_name")
        self.label_endereco = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco.setGeometry(QtCore.QRect(40, 130, 71, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_endereco.setFont(font)
        self.label_endereco.setObjectName("label_endereco")
        self.label_cpf = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf.setGeometry(QtCore.QRect(40, 170, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_cpf.setFont(font)
        self.label_cpf.setObjectName("label_cpf")
        self.label_nascimento = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento.setGeometry(QtCore.QRect(40, 210, 151, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_nascimento.setFont(font)
        self.label_nascimento.setObjectName("label_nascimento")
        self.input_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.input_nome.setGeometry(QtCore.QRect(220, 80, 281, 31))
        self.input_nome.setObjectName("input_nome")
        self.input_endereco = QtWidgets.QLineEdit(self.centralwidget)
        self.input_endereco.setGeometry(QtCore.QRect(220, 120, 281, 31))
        self.input_endereco.setObjectName("input_endereco")
        self.input_cpf = QtWidgets.QLineEdit(self.centralwidget)
        self.input_cpf.setGeometry(QtCore.QRect(220, 160, 281, 31))
        self.input_cpf.setObjectName("input_cpf")
        self.input_nascimento = QtWidgets.QLineEdit(self.centralwidget)
        self.input_nascimento.setGeometry(QtCore.QRect(220, 200, 281, 31))
        self.input_nascimento.setObjectName("input_nascimento")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 310, 541, 21))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.button_cadastrar = QtWidgets.QPushButton(self.centralwidget)
        self.button_cadastrar.setGeometry(QtCore.QRect(220, 260, 101, 28))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.button_cadastrar.setFont(font)
        self.button_cadastrar.setObjectName("button_cadastrar")
        self.label_titulo_busca = QtWidgets.QLabel(self.centralwidget)
        self.label_titulo_busca.setGeometry(QtCore.QRect(250, 340, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(16)
        self.label_titulo_busca.setFont(font)
        self.label_titulo_busca.setObjectName("label_titulo_busca")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(50, 390, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.search_cpf = QtWidgets.QLineEdit(self.centralwidget)
        self.search_cpf.setGeometry(QtCore.QRect(130, 380, 171, 28))
        self.search_cpf.setObjectName("search_cpf")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(40, 450, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(40, 490, 91, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(40, 530, 151, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.output_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.output_nome.setGeometry(QtCore.QRect(220, 440, 281, 28))
        self.output_nome.setObjectName("output_nome")
        self.output_endereco = QtWidgets.QLineEdit(self.centralwidget)
        self.output_endereco.setGeometry(QtCore.QRect(220, 480, 281, 28))
        self.output_endereco.setObjectName("output_endereco")
        self.output_nascimento = QtWidgets.QLineEdit(self.centralwidget)
        self.output_nascimento.setGeometry(QtCore.QRect(220, 520, 281, 28))
        self.output_nascimento.setObjectName("output_nascimento")
        self.button_buscar = QtWidgets.QPushButton(self.centralwidget)
        self.button_buscar.setGeometry(QtCore.QRect(340, 380, 81, 28))
        self.button_buscar.setObjectName("button_buscar")
        self.label_titulo_cadastro.raise_()
        self.label_name.raise_()
        self.label_cpf.raise_()
        self.label_nascimento.raise_()
        self.label_endereco.raise_()
        self.input_nome.raise_()
        self.input_endereco.raise_()
        self.input_cpf.raise_()
        self.input_nascimento.raise_()
        self.line.raise_()
        self.button_cadastrar.raise_()
        self.label_titulo_busca.raise_()
        self.label.raise_()
        self.search_cpf.raise_()
        self.label_2.raise_()
        self.label_3.raise_()
        self.label_4.raise_()
        self.output_nome.raise_()
        self.output_endereco.raise_()
        self.output_nascimento.raise_()
        self.button_buscar.raise_()
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

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

        # Modificações
        self.cad = Cadastro()
        self.button_cadastrar.clicked.connect(self.botaoCadastra)
        self.button_buscar.clicked.connect(self.botaoBusca)
Esempio n. 8
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(547, 586)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label_titulo_cadastro = QtWidgets.QLabel(self.centralwidget)
        self.label_titulo_cadastro.setGeometry(QtCore.QRect(170, 0, 221, 61))
        font = QtGui.QFont()
        font.setPointSize(16)
        self.label_titulo_cadastro.setFont(font)
        self.label_titulo_cadastro.setObjectName("label_titulo_cadastro")
        self.label_name = QtWidgets.QLabel(self.centralwidget)
        self.label_name.setGeometry(QtCore.QRect(40, 90, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_name.setFont(font)
        self.label_name.setObjectName("label_name")
        self.label_endereco = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco.setGeometry(QtCore.QRect(40, 130, 71, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_endereco.setFont(font)
        self.label_endereco.setObjectName("label_endereco")
        self.label_cpf = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf.setGeometry(QtCore.QRect(40, 170, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_cpf.setFont(font)
        self.label_cpf.setObjectName("label_cpf")
        self.label_nascimento = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento.setGeometry(QtCore.QRect(40, 210, 151, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_nascimento.setFont(font)
        self.label_nascimento.setObjectName("label_nascimento")
        self.input_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.input_nome.setGeometry(QtCore.QRect(220, 80, 281, 31))
        self.input_nome.setObjectName("input_nome")
        self.input_endereco = QtWidgets.QLineEdit(self.centralwidget)
        self.input_endereco.setGeometry(QtCore.QRect(220, 120, 281, 31))
        self.input_endereco.setObjectName("input_endereco")
        self.input_cpf = QtWidgets.QLineEdit(self.centralwidget)
        self.input_cpf.setGeometry(QtCore.QRect(220, 160, 281, 31))
        self.input_cpf.setObjectName("input_cpf")
        self.input_nascimento = QtWidgets.QLineEdit(self.centralwidget)
        self.input_nascimento.setGeometry(QtCore.QRect(220, 200, 281, 31))
        self.input_nascimento.setObjectName("input_nascimento")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 310, 541, 21))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.button_cadastrar = QtWidgets.QPushButton(self.centralwidget)
        self.button_cadastrar.setGeometry(QtCore.QRect(220, 260, 101, 28))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.button_cadastrar.setFont(font)
        self.button_cadastrar.setObjectName("button_cadastrar")
        self.label_titulo_busca = QtWidgets.QLabel(self.centralwidget)
        self.label_titulo_busca.setGeometry(QtCore.QRect(250, 340, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(16)
        self.label_titulo_busca.setFont(font)
        self.label_titulo_busca.setObjectName("label_titulo_busca")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(50, 390, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.search_cpf = QtWidgets.QLineEdit(self.centralwidget)
        self.search_cpf.setGeometry(QtCore.QRect(130, 380, 171, 28))
        self.search_cpf.setObjectName("search_cpf")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(40, 450, 58, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(40, 490, 91, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(40, 530, 151, 16))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.output_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.output_nome.setGeometry(QtCore.QRect(220, 440, 281, 28))
        self.output_nome.setObjectName("output_nome")
        self.output_endereco = QtWidgets.QLineEdit(self.centralwidget)
        self.output_endereco.setGeometry(QtCore.QRect(220, 480, 281, 28))
        self.output_endereco.setObjectName("output_endereco")
        self.output_nascimento = QtWidgets.QLineEdit(self.centralwidget)
        self.output_nascimento.setGeometry(QtCore.QRect(220, 520, 281, 28))
        self.output_nascimento.setObjectName("output_nascimento")
        self.button_buscar = QtWidgets.QPushButton(self.centralwidget)
        self.button_buscar.setGeometry(QtCore.QRect(340, 380, 81, 28))
        self.button_buscar.setObjectName("button_buscar")
        self.label_titulo_cadastro.raise_()
        self.label_name.raise_()
        self.label_cpf.raise_()
        self.label_nascimento.raise_()
        self.label_endereco.raise_()
        self.input_nome.raise_()
        self.input_endereco.raise_()
        self.input_cpf.raise_()
        self.input_nascimento.raise_()
        self.line.raise_()
        self.button_cadastrar.raise_()
        self.label_titulo_busca.raise_()
        self.label.raise_()
        self.search_cpf.raise_()
        self.label_2.raise_()
        self.label_3.raise_()
        self.label_4.raise_()
        self.output_nome.raise_()
        self.output_endereco.raise_()
        self.output_nascimento.raise_()
        self.button_buscar.raise_()
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

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

        # Modificações
        self.cad = Cadastro()
        self.button_cadastrar.clicked.connect(self.botaoCadastra)
        self.button_buscar.clicked.connect(self.botaoBusca)


    def botaoCadastra(self): 
        nome = self.input_nome.text()
        endereco = self.input_endereco.text()
        cpf = self.input_cpf.text()
        nascimento = self.input_nascimento.text()

        if not(nome == '' or endereco == '' or cpf == '' or nascimento == ''):
            p = Pessoa(nome, endereco, cpf, nascimento)

            if (self.cad.cadastra(p)):
                QMessageBox.information(None, "POOII", "Cadastro realizado com sucesso!!")
                self.input_nome.setText('')
                self.input_endereco.setText('')
                self.input_cpf.setText('')
                self.input_nascimento.setText('')
            else:
                QMessageBox.information(None, "POOII", "O CPF informado já existe!!")
        else:
            QMessageBox.information(None, "POOII", "Todos os valores devem ser preenchidos!!")


    def botaoBusca(self):
        cpf = self.search_cpf.text()
        pessoa = self.cad.busca(cpf)

        if (pessoa):
            self.output_nome.setText(pessoa.nome)
            self.output_endereco.setText(pessoa.endereco)
            self.output_nascimento.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None, "POOII", "CPF não encontrado")


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_titulo_cadastro.setText(_translate("MainWindow", "Cadastro de Pessoas"))
        self.label_name.setText(_translate("MainWindow", "Nome"))
        self.label_endereco.setText(_translate("MainWindow", "Endereço"))
        self.label_cpf.setText(_translate("MainWindow", "CPF"))
        self.label_nascimento.setText(_translate("MainWindow", "Data de nascimento"))
        self.button_cadastrar.setText(_translate("MainWindow", "cadastrar!"))
        self.label_titulo_busca.setText(_translate("MainWindow", "Busca"))
        self.label.setText(_translate("MainWindow", "CPF"))
        self.label_2.setText(_translate("MainWindow", "Nome"))
        self.label_3.setText(_translate("MainWindow", "Endereço"))
        self.label_4.setText(_translate("MainWindow", "Data de nascimento"))
        self.button_buscar.setText(_translate("MainWindow", "Buscar"))
Esempio n. 9
0
 def __init__(self):
     self._cadastro = Cadastro()
     self._n_conta = 0
Esempio n. 10
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1057, 884)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(333, 30, 91, 41))
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(270, 110, 211, 20))
        self.lineEdit.setObjectName("lineEdit")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(200, 110, 61, 21))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(190, 170, 71, 21))
        self.label_3.setObjectName("label_3")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(270, 170, 211, 20))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(200, 240, 61, 21))
        self.label_4.setObjectName("label_4")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(270, 240, 211, 20))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(120, 310, 141, 21))
        self.label_5.setObjectName("label_5")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(270, 310, 211, 20))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(320, 380, 75, 23))
        self.pushButton.setObjectName("pushButton")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(-10, 440, 821, 20))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(200, 640, 61, 21))
        self.label_6.setObjectName("label_6")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(270, 700, 211, 20))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(120, 750, 141, 21))
        self.label_7.setObjectName("label_7")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(220, 540, 211, 20))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(270, 750, 211, 20))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(333, 470, 91, 41))
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(150, 540, 61, 21))
        self.label_9.setObjectName("label_9")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(460, 540, 75, 23))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(190, 700, 71, 21))
        self.label_10.setObjectName("label_10")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(270, 640, 211, 20))
        self.lineEdit_8.setObjectName("lineEdit_8")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionAula = QtWidgets.QAction(MainWindow)
        self.actionAula.setObjectName("actionAula")

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

        self.cad = Cadastro()
        self.pushButton.clicked.connect(self.botaoCadastra)
        self.pushButton_2.clicked.connect(self.botaoBusca)

    def botaoCadastra(self):
        nome = self.lineEdit.text()
        endereco = self.lineEdit_2.text()
        cpf = self.lineEdit_3.text()
        d_nascimento = self.lineEdit_4.text()
        if not (nome == '' or d_nascimento == '' or cpf == ''
                or endereco == ''):
            p = Pessoa(nome, endereco, cpf, d_nascimento)
            if (self.cad.cadastra(p)):
                QMessageBox.information(None, 'POOII',
                                        'Cadastro realizado com sucesso:')
                self.lineEdit.setText('')
                self.lineEdit_2.setText('')
                self.lineEdit_3.setText('')
                self.lineEdit_4.setText('')
            else:
                QMessageBox.information(None, 'POOII',
                                        'O CPF informado já está cadastrado')
        else:
            QMessageBox.information(None, 'POOII',
                                    'Todos os valores devem ser preenchidos:')

    def botaoBusca(self):
        cpf = self.lineEdit_6.text()
        pessoa = self.cad.busca(cpf)
        if (pessoa != None):
            self.lineEdit_5.setText(pessoa.nome)
            self.lineEdit_7.setText(pessoa.endereco)
            self.lineEdit_8.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None, 'POOII', 'CPF não encontrado:')

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:14pt;\">Cadastro</span></p></body></html>"
            ))
        self.label_2.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">Nome</span></p></body></html>"
            ))
        self.label_3.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">Endereço</span></p><p><br/></p></body></html>"
            ))
        self.label_4.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">CPF</span></p><p><br/></p></body></html>"
            ))
        self.label_5.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">Data de nascimento</span></p><p><br/></p></body></html>"
            ))
        self.pushButton.setText(_translate("MainWindow", "Cadastrar"))
        self.label_6.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">Nome</span></p></body></html>"
            ))
        self.label_7.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">Data de nascimento</span></p><p><br/></p></body></html>"
            ))
        self.label_8.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:14pt;\">Buscar</span></p><p><br/></p></body></html>"
            ))
        self.label_9.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">CPF</span></p><p><br/></p></body></html>"
            ))
        self.pushButton_2.setText(_translate("MainWindow", "Buscar"))
        self.label_10.setText(
            _translate(
                "MainWindow",
                "<html><head/><body><p><span style=\" font-size:12pt;\">Endereço</span></p><p><br/></p></body></html>"
            ))
        self.actionAula.setText(_translate("MainWindow", "Aula"))
Esempio n. 11
0
def Novo_Cadastro():
    try:
        conexao = pymysql.connect(db='DB_CPU',
                                  user='******',
                                  passwd='brunico2807')
        cursor = conexao.cursor()

        print("CADASTRO DE NOVO USUÁRIO")
        cadastro = Cadastro()

        cadastro.InserirNome()
        nome = cadastro.ConsultarNome()
        #print("O nome colocado foi: {}".format(nome))

        cadastro.InserirLogin()
        login = cadastro.ConsultarLogin()
        #print("O login colocado foi: {}".format(login))

        cadastro.InserirIdade()
        idade = cadastro.ConsultarIdade()
        #print("A idade colocada foi: {}".format(idade))

        cadastro.InserirEmail()
        email = cadastro.ConsultarEmail()
        #print("O email colocado foi: {}".format(email))

        cadastro.InserirSenha()
        senha = cadastro.ConsultarSenha()

        code = "INSERT INTO cadastro (NOME, LOGIN, SENHA, EMAIL, IDADE) VALUES (%s,%s,%s,%s,%s)"
        val = [nome, login, senha, email, idade]
        cursor.execute(code, val)
        conexao.commit()

        return True
    except:
        print("Algo deu errado, tente novamente")
        return False
    finally:
        conexao.close()
Esempio n. 12
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.line_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.line_nome.setGeometry(QtCore.QRect(310, 70, 371, 31))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.line_nome.sizePolicy().hasHeightForWidth())
        self.line_nome.setSizePolicy(sizePolicy)
        self.line_nome.setSizeIncrement(QtCore.QSize(0, 0))
        self.line_nome.setBaseSize(QtCore.QSize(0, 0))
        self.line_nome.setObjectName("line_nome")
        self.cadastro = QtWidgets.QLabel(self.centralwidget)
        self.cadastro.setGeometry(QtCore.QRect(340, 24, 111, 25))
        font = QtGui.QFont()
        font.setPointSize(19)
        self.cadastro.setFont(font)
        self.cadastro.setFrameShadow(QtWidgets.QFrame.Plain)
        self.cadastro.setObjectName("cadastro")
        self.label_cpf1 = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf1.setGeometry(QtCore.QRect(140, 120, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_cpf1.setFont(font)
        self.label_cpf1.setObjectName("label_cpf1")
        self.label_nascimento1 = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento1.setGeometry(QtCore.QRect(140, 200, 91, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nascimento1.setFont(font)
        self.label_nascimento1.setObjectName("label_nascimento1")
        self.line_endereco = QtWidgets.QLineEdit(self.centralwidget)
        self.line_endereco.setGeometry(QtCore.QRect(310, 150, 371, 31))
        self.line_endereco.setObjectName("line_endereco")
        self.label_endereco1 = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco1.setGeometry(QtCore.QRect(140, 160, 81, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_endereco1.setFont(font)
        self.label_endereco1.setObjectName("label_endereco1")
        self.label_nome = QtWidgets.QLabel(self.centralwidget)
        self.label_nome.setGeometry(QtCore.QRect(140, 80, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nome.setFont(font)
        self.label_nome.setObjectName("label_nome")
        self.line_cpf = QtWidgets.QLineEdit(self.centralwidget)
        self.line_cpf.setGeometry(QtCore.QRect(310, 110, 371, 31))
        self.line_cpf.setObjectName("line_cpf")
        self.line_nascimento = QtWidgets.QLineEdit(self.centralwidget)
        self.line_nascimento.setGeometry(QtCore.QRect(310, 190, 371, 31))
        self.line_nascimento.setObjectName("line_nascimento")
        self.button_cadastrar = QtWidgets.QPushButton(self.centralwidget)
        self.button_cadastrar.setGeometry(QtCore.QRect(340, 240, 89, 25))
        self.button_cadastrar.setObjectName("button_cadastrar")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 280, 801, 16))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.label_nome2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nome2.setGeometry(QtCore.QRect(140, 420, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nome2.setFont(font)
        self.label_nome2.setObjectName("label_nome2")
        self.line_cpf_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.line_cpf_busca.setGeometry(QtCore.QRect(260, 350, 371, 31))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.line_cpf_busca.sizePolicy().hasHeightForWidth())
        self.line_cpf_busca.setSizePolicy(sizePolicy)
        self.line_cpf_busca.setSizeIncrement(QtCore.QSize(0, 0))
        self.line_cpf_busca.setBaseSize(QtCore.QSize(0, 0))
        self.line_cpf_busca.setObjectName("line_cpf_busca")
        self.line_result_end = QtWidgets.QLineEdit(self.centralwidget)
        self.line_result_end.setGeometry(QtCore.QRect(260, 450, 371, 31))
        self.line_result_end.setObjectName("line_result_end")
        self.busca = QtWidgets.QLabel(self.centralwidget)
        self.busca.setGeometry(QtCore.QRect(360, 310, 71, 21))
        font = QtGui.QFont()
        font.setPointSize(19)
        self.busca.setFont(font)
        self.busca.setFrameShadow(QtWidgets.QFrame.Plain)
        self.busca.setObjectName("busca")
        self.label_cpf2 = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf2.setGeometry(QtCore.QRect(140, 360, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_cpf2.setFont(font)
        self.label_cpf2.setObjectName("label_cpf2")
        self.line_result_nasc = QtWidgets.QLineEdit(self.centralwidget)
        self.line_result_nasc.setGeometry(QtCore.QRect(260, 490, 371, 31))
        self.line_result_nasc.setObjectName("line_result_nasc")
        self.button_buscar = QtWidgets.QPushButton(self.centralwidget)
        self.button_buscar.setGeometry(QtCore.QRect(650, 350, 89, 25))
        self.button_buscar.setObjectName("button_buscar")
        self.label_endereco2 = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco2.setGeometry(QtCore.QRect(140, 460, 81, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_endereco2.setFont(font)
        self.label_endereco2.setObjectName("label_endereco2")
        self.label_nascimento2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento2.setGeometry(QtCore.QRect(140, 500, 91, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nascimento2.setFont(font)
        self.label_nascimento2.setObjectName("label_nascimento2")
        self.line_result_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.line_result_nome.setGeometry(QtCore.QRect(260, 410, 371, 31))
        self.line_result_nome.setObjectName("line_result_nome")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        #Modificaçoes
        self.cad = Cadastro()
        self.button_cadastrar.clicked.connect(self.botaoCadastra)
        self.button_buscar.clicked.connect(self.botaoBusca)

    def botaoCadastra(self):
        nome = self.line_nome.text()
        endereco = self.line_endereco.text()
        cpf = self.line_cpf.text()
        nascimento = self.line_nascimento.text()
        if not((nome == '') or (endereco == '') or (cpf == '') or (nascimento == '')):
            p = Pessoa(nome, endereco, cpf, nascimento)
            if (self.cad.cadastra(p)):
                QMessageBox.information(None,'POOII','Cadastro Realizado!')
                self.line_nome.setText('')
                self.line_endereco.setText('')
                self.line_cpf.setText('')
                self.line_nascimento.setText('')
            else:
                QMessageBox.information(None,'POOII','O CPF ja esta cadastrado')
        else:
            QMessageBox.information(None,'POOII','Todos os valores devem ser informados!')
    
    def botaoBusca(self):
        cpf = self.line_cpf_busca.text()
        pessoa = self.cad.busca(cpf)
        if (pessoa!=None):
            self.line_result_nome.setText(pessoa.nome)
            self.line_result_end.setText(pessoa.endereco)
            self.line_result_nasc.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None,'POOII','CPF não encontrado')


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.cadastro.setText(_translate("MainWindow", "Cadastro"))
        self.label_cpf1.setText(_translate("MainWindow", "CPF"))
        self.label_nascimento1.setText(_translate("MainWindow", "Nascimento"))
        self.label_endereco1.setText(_translate("MainWindow", "Endereço"))
        self.label_nome.setText(_translate("MainWindow", "Nome"))
        self.button_cadastrar.setText(_translate("MainWindow", "Cadastrar"))
        self.label_nome2.setText(_translate("MainWindow", "Nome"))
        self.busca.setText(_translate("MainWindow", "Busca"))
        self.label_cpf2.setText(_translate("MainWindow", "CPF"))
        self.button_buscar.setText(_translate("MainWindow", "Buscar"))
        self.label_endereco2.setText(_translate("MainWindow", "Endereço"))
        self.label_nascimento2.setText(_translate("MainWindow", "Nascimento"))
Esempio n. 13
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(630, 480)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(240, 10, 131, 41))
        self.label.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setPointSize(24)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(170, 60, 291, 25))
        self.lineEdit.setObjectName("lineEdit")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(70, 60, 67, 17))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(70, 90, 71, 17))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(70, 120, 67, 17))
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(70, 150, 91, 17))
        self.label_5.setObjectName("label_5")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(170, 120, 291, 25))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(170, 150, 291, 25))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(170, 290, 151, 25))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(260, 190, 89, 25))
        self.pushButton.setObjectName("pushButton")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(250, 240, 101, 31))
        font = QtGui.QFont()
        font.setPointSize(24)
        self.label_6.setFont(font)
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(60, 290, 67, 17))
        self.label_7.setObjectName("label_7")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(60, 360, 67, 17))
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(60, 390, 67, 17))
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(60, 430, 91, 17))
        self.label_10.setObjectName("label_10")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(350, 290, 89, 25))
        self.pushButton_2.setObjectName("pushButton_2")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(170, 90, 291, 25))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(170, 350, 271, 25))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(170, 390, 271, 25))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(170, 430, 113, 25))
        self.lineEdit_8.setObjectName("lineEdit_8")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 220, 631, 16))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        '''modificacoes'''
        self.cad = Cadastro()
        self.pushButton.clicked.connect(self.botaoCadastra)
        self.pushButton_2.clicked.connect(self.botaoBusca)
def main():
    cadastro = Cadastro()
    cliente = Cliente('1', '1', '1')
    banco = Banco(1, cliente, 0, 1000)

    cadastro.cadastra(banco)
Esempio n. 15
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(923, 675)
        font = QtGui.QFont()
        font.setPointSize(12)
        MainWindow.setFont(font)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.titulo1 = QtWidgets.QLabel(self.centralwidget)
        self.titulo1.setGeometry(QtCore.QRect(400, 30, 101, 41))
        font = QtGui.QFont()
        font.setPointSize(15)
        self.titulo1.setFont(font)
        self.titulo1.setAlignment(QtCore.Qt.AlignCenter)
        self.titulo1.setObjectName("titulo1")
        self.nome_cad = QtWidgets.QLabel(self.centralwidget)
        self.nome_cad.setGeometry(QtCore.QRect(150, 80, 61, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.nome_cad.setFont(font)
        self.nome_cad.setObjectName("nome_cad")
        self.endereco_cad = QtWidgets.QLabel(self.centralwidget)
        self.endereco_cad.setGeometry(QtCore.QRect(150, 120, 81, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.endereco_cad.setFont(font)
        self.endereco_cad.setObjectName("endereco_cad")
        self.cpf_cad = QtWidgets.QLabel(self.centralwidget)
        self.cpf_cad.setGeometry(QtCore.QRect(150, 170, 47, 13))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.cpf_cad.setFont(font)
        self.cpf_cad.setObjectName("cpf_cad")
        self.nasc_cad = QtWidgets.QLabel(self.centralwidget)
        self.nasc_cad.setGeometry(QtCore.QRect(150, 200, 111, 31))
        self.nasc_cad.setObjectName("nasc_cad")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(280, 90, 361, 20))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(280, 130, 361, 20))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(280, 170, 171, 20))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(280, 210, 171, 20))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(-10, 340, 931, 20))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.pushButton_cad = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_cad.setGeometry(QtCore.QRect(400, 270, 91, 31))
        self.pushButton_cad.setObjectName("pushButton_cad")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(390, 370, 111, 21))
        font = QtGui.QFont()
        font.setPointSize(15)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.cpf_busca = QtWidgets.QLabel(self.centralwidget)
        self.cpf_busca.setGeometry(QtCore.QRect(150, 420, 47, 13))
        self.cpf_busca.setObjectName("cpf_busca")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(270, 420, 181, 20))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.pushButton_busca = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_busca.setGeometry(QtCore.QRect(490, 420, 75, 23))
        self.pushButton_busca.setObjectName("pushButton_busca")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(270, 510, 361, 20))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.nome_busca = QtWidgets.QLabel(self.centralwidget)
        self.nome_busca.setGeometry(QtCore.QRect(150, 500, 61, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.nome_busca.setFont(font)
        self.nome_busca.setObjectName("nome_busca")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(270, 550, 361, 20))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.endereco_busca = QtWidgets.QLabel(self.centralwidget)
        self.endereco_busca.setGeometry(QtCore.QRect(150, 550, 81, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.endereco_busca.setFont(font)
        self.endereco_busca.setObjectName("endereco_busca")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(270, 590, 171, 20))
        self.lineEdit_8.setObjectName("lineEdit_8")
        self.nasc_busca = QtWidgets.QLabel(self.centralwidget)
        self.nasc_busca.setGeometry(QtCore.QRect(150, 590, 111, 31))
        self.nasc_busca.setObjectName("nasc_busca")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        '''modificacoes'''
        self.cad = Cadastro()
        self.pushButton_cad.clicked.connect(self.botaoCadastra)
        self.pushButton_busca.clicked.connect(self.botaoBusca)
Esempio n. 16
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(923, 675)
        font = QtGui.QFont()
        font.setPointSize(12)
        MainWindow.setFont(font)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.titulo1 = QtWidgets.QLabel(self.centralwidget)
        self.titulo1.setGeometry(QtCore.QRect(400, 30, 101, 41))
        font = QtGui.QFont()
        font.setPointSize(15)
        self.titulo1.setFont(font)
        self.titulo1.setAlignment(QtCore.Qt.AlignCenter)
        self.titulo1.setObjectName("titulo1")
        self.nome_cad = QtWidgets.QLabel(self.centralwidget)
        self.nome_cad.setGeometry(QtCore.QRect(150, 80, 61, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.nome_cad.setFont(font)
        self.nome_cad.setObjectName("nome_cad")
        self.endereco_cad = QtWidgets.QLabel(self.centralwidget)
        self.endereco_cad.setGeometry(QtCore.QRect(150, 120, 81, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.endereco_cad.setFont(font)
        self.endereco_cad.setObjectName("endereco_cad")
        self.cpf_cad = QtWidgets.QLabel(self.centralwidget)
        self.cpf_cad.setGeometry(QtCore.QRect(150, 170, 47, 13))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.cpf_cad.setFont(font)
        self.cpf_cad.setObjectName("cpf_cad")
        self.nasc_cad = QtWidgets.QLabel(self.centralwidget)
        self.nasc_cad.setGeometry(QtCore.QRect(150, 200, 111, 31))
        self.nasc_cad.setObjectName("nasc_cad")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(280, 90, 361, 20))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(280, 130, 361, 20))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(280, 170, 171, 20))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(280, 210, 171, 20))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(-10, 340, 931, 20))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.pushButton_cad = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_cad.setGeometry(QtCore.QRect(400, 270, 91, 31))
        self.pushButton_cad.setObjectName("pushButton_cad")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(390, 370, 111, 21))
        font = QtGui.QFont()
        font.setPointSize(15)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.cpf_busca = QtWidgets.QLabel(self.centralwidget)
        self.cpf_busca.setGeometry(QtCore.QRect(150, 420, 47, 13))
        self.cpf_busca.setObjectName("cpf_busca")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(270, 420, 181, 20))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.pushButton_busca = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_busca.setGeometry(QtCore.QRect(490, 420, 75, 23))
        self.pushButton_busca.setObjectName("pushButton_busca")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(270, 510, 361, 20))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.nome_busca = QtWidgets.QLabel(self.centralwidget)
        self.nome_busca.setGeometry(QtCore.QRect(150, 500, 61, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.nome_busca.setFont(font)
        self.nome_busca.setObjectName("nome_busca")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(270, 550, 361, 20))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.endereco_busca = QtWidgets.QLabel(self.centralwidget)
        self.endereco_busca.setGeometry(QtCore.QRect(150, 550, 81, 31))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.endereco_busca.setFont(font)
        self.endereco_busca.setObjectName("endereco_busca")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(270, 590, 171, 20))
        self.lineEdit_8.setObjectName("lineEdit_8")
        self.nasc_busca = QtWidgets.QLabel(self.centralwidget)
        self.nasc_busca.setGeometry(QtCore.QRect(150, 590, 111, 31))
        self.nasc_busca.setObjectName("nasc_busca")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        '''modificacoes'''
        self.cad = Cadastro()
        self.pushButton_cad.clicked.connect(self.botaoCadastra)
        self.pushButton_busca.clicked.connect(self.botaoBusca)

    def botaoCadastra(self):
        nome = self.lineEdit.text()
        endereco = self.lineEdit_2.text()
        cpf = self.lineEdit_3.text()
        nascimento = self.lineEdit_4.text()
        if not (nome == '' or endereco == '' or cpf == '' or nascimento == ''):
            pessoa = Pessoa(nome, endereco, cpf, nascimento)
            if self.cad.cadastra(pessoa):
                QMessageBox.information(None, 'POO2', 'Cadastro realizado.')
                self.lineEdit.setText('')
                self.lineEdit_2.setText('')
                self.lineEdit_3.setText('')
                self.lineEdit_4.setText('')
            else:
                QMessageBox.information(None, 'POO2',
                                        'O CPF informado ja esta cadastrado')
        else:
            QMessageBox.information(None, 'POO2',
                                    'Todos os campos devem ser preenchidos')

    def botaoBusca(self):
        cpf = self.lineEdit_5.text()
        pessoa = self.cad.busca(cpf)
        if pessoa is not None:
            self.lineEdit_6.setText(pessoa.nome)
            self.lineEdit_7.setText(pessoa.endereco)
            self.lineEdit_8.setText(pessoa.nascimento)
            self.lineEdit_5.setText('')
        else:
            QMessageBox.information(None, "POO2", "CPF nao encontrado!")
            self.lineEdit_5.setText('')

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.titulo1.setText(_translate("MainWindow", "Cadastro"))
        self.nome_cad.setText(_translate("MainWindow", "Nome:"))
        self.endereco_cad.setText(_translate("MainWindow", "Endereço:"))
        self.cpf_cad.setText(_translate("MainWindow", "CPF:"))
        self.nasc_cad.setText(_translate("MainWindow", "Nascimento:"))
        self.pushButton_cad.setText(_translate("MainWindow", "cadastrar"))
        self.label.setText(_translate("MainWindow", "Busca"))
        self.cpf_busca.setText(_translate("MainWindow", "CPF:"))
        self.pushButton_busca.setText(_translate("MainWindow", "buscar"))
        self.nome_busca.setText(_translate("MainWindow", "Nome:"))
        self.endereco_busca.setText(_translate("MainWindow", "Endereço:"))
        self.nasc_busca.setText(_translate("MainWindow", "Nascimento:"))
Esempio n. 17
0
from pessoa import Pessoa, Aluno, Professor, Administrador, Pesquisador
from cadastro import Cadastro

if __name__ == "__main__":

    aluno = Aluno("Clebson", "12345", "Graduação", "Clebsonpy",
                  "*****@*****.**")
    prof = Professor("Baldoino", "987654", "Baldoino", "*****@*****.**")
    admin = Administrador("Clara", "clarapy", "*****@*****.**")
    pesq = Pesquisador("Gabriel", "gabigol", "*****@*****.**")

    cad = Cadastro("Clebson Carvalho", "clebsonpy", "*****@*****.**")
    print(cad.cadastro())
Esempio n. 18
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1057, 884)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(333, 30, 91, 41))
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(270, 110, 211, 20))
        self.lineEdit.setObjectName("lineEdit")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(200, 110, 61, 21))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(190, 170, 71, 21))
        self.label_3.setObjectName("label_3")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(270, 170, 211, 20))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(200, 240, 61, 21))
        self.label_4.setObjectName("label_4")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(270, 240, 211, 20))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(120, 310, 141, 21))
        self.label_5.setObjectName("label_5")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(270, 310, 211, 20))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(320, 380, 75, 23))
        self.pushButton.setObjectName("pushButton")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(-10, 440, 821, 20))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(200, 640, 61, 21))
        self.label_6.setObjectName("label_6")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(270, 700, 211, 20))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(120, 750, 141, 21))
        self.label_7.setObjectName("label_7")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(220, 540, 211, 20))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(270, 750, 211, 20))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(333, 470, 91, 41))
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(150, 540, 61, 21))
        self.label_9.setObjectName("label_9")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(460, 540, 75, 23))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(190, 700, 71, 21))
        self.label_10.setObjectName("label_10")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(270, 640, 211, 20))
        self.lineEdit_8.setObjectName("lineEdit_8")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionAula = QtWidgets.QAction(MainWindow)
        self.actionAula.setObjectName("actionAula")

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

        self.cad = Cadastro()
        self.pushButton.clicked.connect(self.botaoCadastra)
        self.pushButton_2.clicked.connect(self.botaoBusca)
Esempio n. 19
0
 def cadastre(self):
     cad = Cadastro()
Esempio n. 20
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(630, 480)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(240, 10, 131, 41))
        self.label.setMaximumSize(QtCore.QSize(16777215, 16777215))
        font = QtGui.QFont()
        font.setPointSize(24)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(170, 60, 291, 25))
        self.lineEdit.setObjectName("lineEdit")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(70, 60, 67, 17))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(70, 90, 71, 17))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(70, 120, 67, 17))
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(70, 150, 91, 17))
        self.label_5.setObjectName("label_5")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(170, 120, 291, 25))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(170, 150, 291, 25))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(170, 290, 151, 25))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(260, 190, 89, 25))
        self.pushButton.setObjectName("pushButton")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(250, 240, 101, 31))
        font = QtGui.QFont()
        font.setPointSize(24)
        self.label_6.setFont(font)
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(60, 290, 67, 17))
        self.label_7.setObjectName("label_7")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(60, 360, 67, 17))
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(60, 390, 67, 17))
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(60, 430, 91, 17))
        self.label_10.setObjectName("label_10")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(350, 290, 89, 25))
        self.pushButton_2.setObjectName("pushButton_2")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(170, 90, 291, 25))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(170, 350, 271, 25))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(170, 390, 271, 25))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(170, 430, 113, 25))
        self.lineEdit_8.setObjectName("lineEdit_8")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 220, 631, 16))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        '''modificacoes'''
        self.cad = Cadastro()
        self.pushButton.clicked.connect(self.botaoCadastra)
        self.pushButton_2.clicked.connect(self.botaoBusca)

    def botaoCadastra(self):
        nome = self.lineEdit.text()
        endereco = self.lineEdit_2.text()
        cpf = self.lineEdit_3.text()
        nascimento = self.lineEdit_4.text()

        if not (nome == '' or endereco == '' or cpf == '' or nascimento == ''):
            p = Pessoa(nome, endereco, cpf, nascimento)
            if (self.cad.cadastra(p)):
                QMessageBox.information(None, 'POOII',
                                        'Cadastro realizado com sucesso!')
                self.lineEdit.setText('')
                self.lineEdit_2.setText('')
                self.lineEdit_3.setText('')
                self.lineEdit_4.setText('')
            else:
                QMessageBox.information(
                    None, 'POOII',
                    'O CPF informado já está cadastrado na base de dados!')
        else:
            QMessageBox.information(None, 'POOII',
                                    'Todos os valores devem ser preenchidos!')

    def botaoBusca(self):
        cpf = self.lineEdit_5.text()
        pessoa = self.cad.busca(cpf)
        if (pessoa != None):
            self.lineEdit_6.setText(pessoa.nome)
            self.lineEdit_7.setText(pessoa.endereco)
            self.lineEdit_8.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None, 'POOII', 'CPF não encontrado!')

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(_translate("MainWindow", "Cadastra"))
        self.label_2.setText(_translate("MainWindow", "Nome:"))
        self.label_3.setText(_translate("MainWindow", "Endereço:"))
        self.label_4.setText(_translate("MainWindow", "CPF:"))
        self.label_5.setText(_translate("MainWindow", "Nascimento:"))
        self.pushButton.setText(_translate("MainWindow", "Cadastre!"))
        self.label_6.setText(_translate("MainWindow", "Busca"))
        self.label_7.setText(_translate("MainWindow", "CPF:"))
        self.label_8.setText(_translate("MainWindow", "Nome:"))
        self.label_9.setText(_translate("MainWindow", "Endereço:"))
        self.label_10.setText(_translate("MainWindow", "Nascimento:"))
        self.pushButton_2.setText(_translate("MainWindow", "Buscar"))
Esempio n. 21
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(310, -30, 121, 91))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(150, 60, 351, 20))
        self.lineEdit.setObjectName("lineEdit")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(40, 60, 51, 21))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(40, 110, 47, 13))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(150, 110, 351, 20))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(30, 170, 71, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(150, 170, 351, 20))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(20, 230, 91, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_5.setFont(font)
        self.label_5.setObjectName("label_5")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(150, 230, 351, 20))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(290, 270, 161, 23))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 330, 801, 16))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(310, 350, 131, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.label_6.setFont(font)
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(30, 390, 47, 16))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_7.setFont(font)
        self.label_7.setObjectName("label_7")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(160, 390, 151, 20))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(380, 390, 75, 23))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.pushButton_2.setFont(font)
        self.pushButton_2.setObjectName("pushButton_2")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(30, 450, 81, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_8.setFont(font)
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(30, 480, 81, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_9.setFont(font)
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(30, 510, 91, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_10.setFont(font)
        self.label_10.setObjectName("label_10")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(160, 449, 341, 21))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(160, 480, 341, 20))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(160, 510, 341, 20))
        self.lineEdit_8.setObjectName("lineEdit_8")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        '''alteraçoes'''
        self.cad = Cadastro()
        self.pushButton.clicked.connect(self.botaoCadastra)
        self.pushButton_2.clicked.connect(self.botaoBusca)
Esempio n. 22
0
def cadastra_Click():
    Cadastro()
Esempio n. 23
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(640, 687)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.botao_cadastrar = QtWidgets.QPushButton(self.centralwidget)
        self.botao_cadastrar.setGeometry(QtCore.QRect(290, 270, 75, 23))
        self.botao_cadastrar.setObjectName("botao_cadastrar")
        self.label_nome = QtWidgets.QLabel(self.centralwidget)
        self.label_nome.setGeometry(QtCore.QRect(180, 100, 61, 20))
        self.label_nome.setObjectName("label_nome")
        self.edit_nome_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nome_cad.setGeometry(QtCore.QRect(240, 100, 181, 20))
        self.edit_nome_cad.setObjectName("edit_nome_cad")
        self.label_cadastrar = QtWidgets.QLabel(self.centralwidget)
        self.label_cadastrar.setGeometry(QtCore.QRect(270, 10, 171, 61))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(10)
        sizePolicy.setVerticalStretch(19)
        sizePolicy.setHeightForWidth(
            self.label_cadastrar.sizePolicy().hasHeightForWidth())
        self.label_cadastrar.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label_cadastrar.setFont(font)
        self.label_cadastrar.setObjectName("label_cadastrar")
        self.label_endereco = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco.setGeometry(QtCore.QRect(160, 130, 71, 31))
        self.label_endereco.setObjectName("label_endereco")
        self.edit_endereco_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_endereco_cad.setGeometry(QtCore.QRect(240, 140, 181, 20))
        self.edit_endereco_cad.setObjectName("edit_endereco_cad")
        self.label_cpf = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf.setGeometry(QtCore.QRect(190, 180, 47, 13))
        self.label_cpf.setObjectName("label_cpf")
        self.edit_cpf_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_cpf_cad.setGeometry(QtCore.QRect(240, 180, 181, 20))
        self.edit_cpf_cad.setObjectName("edit_cpf_cad")
        self.label_nascimento = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento.setGeometry(QtCore.QRect(160, 220, 121, 20))
        self.label_nascimento.setObjectName("label_nascimento")
        self.edit_nascimento_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nascimento_cad.setGeometry(QtCore.QRect(240, 220, 181, 20))
        self.edit_nascimento_cad.setObjectName("edit_nascimento_cad")
        self.label_buscar = QtWidgets.QLabel(self.centralwidget)
        self.label_buscar.setGeometry(QtCore.QRect(270, 370, 121, 61))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(10)
        sizePolicy.setVerticalStretch(19)
        sizePolicy.setHeightForWidth(
            self.label_buscar.sizePolicy().hasHeightForWidth())
        self.label_buscar.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label_buscar.setFont(font)
        self.label_buscar.setObjectName("label_buscar")
        self.botao_buscar = QtWidgets.QPushButton(self.centralwidget)
        self.botao_buscar.setGeometry(QtCore.QRect(380, 450, 75, 23))
        self.botao_buscar.setObjectName("botao_buscar")
        self.label_cpf_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf_2.setGeometry(QtCore.QRect(160, 450, 47, 13))
        self.label_cpf_2.setObjectName("label_cpf_2")
        self.label_nome_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nome_2.setGeometry(QtCore.QRect(180, 523, 61, 20))
        self.label_nome_2.setObjectName("label_nome_2")
        self.label_endereco_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco_2.setGeometry(QtCore.QRect(170, 560, 71, 16))
        self.label_endereco_2.setObjectName("label_endereco_2")
        self.edit_nascimento_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nascimento_busca.setEnabled(True)
        self.edit_nascimento_busca.setGeometry(QtCore.QRect(240, 600, 181, 20))
        self.edit_nascimento_busca.setObjectName("edit_nascimento_busca")
        self.edit_endereco_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_endereco_busca.setEnabled(True)
        self.edit_endereco_busca.setGeometry(QtCore.QRect(240, 560, 181, 20))
        self.edit_endereco_busca.setObjectName("edit_endereco_busca")
        self.label_nascimento_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento_2.setGeometry(QtCore.QRect(160, 600, 111, 20))
        self.label_nascimento_2.setObjectName("label_nascimento_2")
        self.edit_nome_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nome_busca.setEnabled(True)
        self.edit_nome_busca.setGeometry(QtCore.QRect(240, 520, 181, 20))
        self.edit_nome_busca.setObjectName("edit_nome_busca")
        self.edit_cpf_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_cpf_busca.setGeometry(QtCore.QRect(190, 450, 181, 20))
        self.edit_cpf_busca.setObjectName("edit_cpf_busca")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

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

        #acrescimos abaixo
        self.cadastro_dados = Cadastro()
        self.botao_cadastrar.clicked.connect(self.metodo_botao_cadastrar)
        self.botao_buscar.clicked.connect(self.metodo_botao_buscar)
Esempio n. 24
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.line_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.line_nome.setGeometry(QtCore.QRect(310, 70, 371, 31))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.line_nome.sizePolicy().hasHeightForWidth())
        self.line_nome.setSizePolicy(sizePolicy)
        self.line_nome.setSizeIncrement(QtCore.QSize(0, 0))
        self.line_nome.setBaseSize(QtCore.QSize(0, 0))
        self.line_nome.setObjectName("line_nome")
        self.cadastro = QtWidgets.QLabel(self.centralwidget)
        self.cadastro.setGeometry(QtCore.QRect(340, 24, 111, 25))
        font = QtGui.QFont()
        font.setPointSize(19)
        self.cadastro.setFont(font)
        self.cadastro.setFrameShadow(QtWidgets.QFrame.Plain)
        self.cadastro.setObjectName("cadastro")
        self.label_cpf1 = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf1.setGeometry(QtCore.QRect(140, 120, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_cpf1.setFont(font)
        self.label_cpf1.setObjectName("label_cpf1")
        self.label_nascimento1 = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento1.setGeometry(QtCore.QRect(140, 200, 91, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nascimento1.setFont(font)
        self.label_nascimento1.setObjectName("label_nascimento1")
        self.line_endereco = QtWidgets.QLineEdit(self.centralwidget)
        self.line_endereco.setGeometry(QtCore.QRect(310, 150, 371, 31))
        self.line_endereco.setObjectName("line_endereco")
        self.label_endereco1 = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco1.setGeometry(QtCore.QRect(140, 160, 81, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_endereco1.setFont(font)
        self.label_endereco1.setObjectName("label_endereco1")
        self.label_nome = QtWidgets.QLabel(self.centralwidget)
        self.label_nome.setGeometry(QtCore.QRect(140, 80, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nome.setFont(font)
        self.label_nome.setObjectName("label_nome")
        self.line_cpf = QtWidgets.QLineEdit(self.centralwidget)
        self.line_cpf.setGeometry(QtCore.QRect(310, 110, 371, 31))
        self.line_cpf.setObjectName("line_cpf")
        self.line_nascimento = QtWidgets.QLineEdit(self.centralwidget)
        self.line_nascimento.setGeometry(QtCore.QRect(310, 190, 371, 31))
        self.line_nascimento.setObjectName("line_nascimento")
        self.button_cadastrar = QtWidgets.QPushButton(self.centralwidget)
        self.button_cadastrar.setGeometry(QtCore.QRect(340, 240, 89, 25))
        self.button_cadastrar.setObjectName("button_cadastrar")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 280, 801, 16))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.label_nome2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nome2.setGeometry(QtCore.QRect(140, 420, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nome2.setFont(font)
        self.label_nome2.setObjectName("label_nome2")
        self.line_cpf_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.line_cpf_busca.setGeometry(QtCore.QRect(260, 350, 371, 31))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.line_cpf_busca.sizePolicy().hasHeightForWidth())
        self.line_cpf_busca.setSizePolicy(sizePolicy)
        self.line_cpf_busca.setSizeIncrement(QtCore.QSize(0, 0))
        self.line_cpf_busca.setBaseSize(QtCore.QSize(0, 0))
        self.line_cpf_busca.setObjectName("line_cpf_busca")
        self.line_result_end = QtWidgets.QLineEdit(self.centralwidget)
        self.line_result_end.setGeometry(QtCore.QRect(260, 450, 371, 31))
        self.line_result_end.setObjectName("line_result_end")
        self.busca = QtWidgets.QLabel(self.centralwidget)
        self.busca.setGeometry(QtCore.QRect(360, 310, 71, 21))
        font = QtGui.QFont()
        font.setPointSize(19)
        self.busca.setFont(font)
        self.busca.setFrameShadow(QtWidgets.QFrame.Plain)
        self.busca.setObjectName("busca")
        self.label_cpf2 = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf2.setGeometry(QtCore.QRect(140, 360, 67, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_cpf2.setFont(font)
        self.label_cpf2.setObjectName("label_cpf2")
        self.line_result_nasc = QtWidgets.QLineEdit(self.centralwidget)
        self.line_result_nasc.setGeometry(QtCore.QRect(260, 490, 371, 31))
        self.line_result_nasc.setObjectName("line_result_nasc")
        self.button_buscar = QtWidgets.QPushButton(self.centralwidget)
        self.button_buscar.setGeometry(QtCore.QRect(650, 350, 89, 25))
        self.button_buscar.setObjectName("button_buscar")
        self.label_endereco2 = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco2.setGeometry(QtCore.QRect(140, 460, 81, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_endereco2.setFont(font)
        self.label_endereco2.setObjectName("label_endereco2")
        self.label_nascimento2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento2.setGeometry(QtCore.QRect(140, 500, 91, 17))
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label_nascimento2.setFont(font)
        self.label_nascimento2.setObjectName("label_nascimento2")
        self.line_result_nome = QtWidgets.QLineEdit(self.centralwidget)
        self.line_result_nome.setGeometry(QtCore.QRect(260, 410, 371, 31))
        self.line_result_nome.setObjectName("line_result_nome")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        #Modificaçoes
        self.cad = Cadastro()
        self.button_cadastrar.clicked.connect(self.botaoCadastra)
        self.button_buscar.clicked.connect(self.botaoBusca)
Esempio n. 25
0
class Servidor():
    '''
        O objeto da class Servidor representar a interface de conecção do servido com o cliente.
        Todos as informações do objeto são inicializados e inicializando um objeto do tipo cadastro
        um contador de contas cadastradas.
    '''
    def __init__(self):
        self._cadastro = Cadastro()
        self._n_conta = 0

    def mostrar_todas_contas(self):
        '''
            Para mostrar todas as contas cadastradas no objeto _cadastro.
        '''
        for conta in self._cadastro.lista_contas:
            print('{} - {} - {}'.format(conta.titular.cpf, conta.titular.nome,
                                        conta.saldo))

    def pre_processamento(self, codigo):
        '''
            Para realizar o pre-processamento do codigo enviado pelo cliente.

            :parametro codigo: string enviada pelo cliente e obtido apos a conecção com o cliente.
            :retorna o codigo_lista, que é o codigo pre processado em formato de lista.
        '''

        codigo_lista = codigo.split('/')
        #cadastra
        #cadastrar/nome/sobre_nome/cpf
        if (codigo_lista[0] == '0'):
            codigo_lista[0] = 'cadastra'
        #login
        #login/cpf
        elif (codigo_lista[0] == '1'):
            codigo_lista[0] = 'login'
        #deposita
        #deposito/cpf/valor
        elif (codigo_lista[0] == '2'):
            codigo_lista[0] = 'deposito'
        #saque
        #saque/cpf/valor
        elif (codigo_lista[0] == '3'):
            codigo_lista[0] = 'saque'
        #transferencia
        #transferencia/cpf/valor/cpf_conta_para_transferir
        elif (codigo_lista[0] == '4'):
            codigo_lista[0] = 'transferencia'
        #historico
        #historico/cpf
        elif (codigo_lista[0] == '5'):
            codigo_lista[0] = 'historico'

        return codigo_lista

    def cadastrar(self, codigo):
        '''
            Para realizar o cadastro da conta utilizando as informações do codigo recebido pelo cliente e tratado.

            :parametro codigo: lista com informações para cadastro de conta.
            :retorna uma string com '1' para conta realizada, e '0' para conta não realizada.
        '''

        pessoa = Cliente(codigo[1], codigo[2], codigo[3])
        conta = Banco(self._n_conta, pessoa, 0.0, 1000, codigo[4])
        self._n_conta = +1
        if (self._cadastro.cadastra(conta)):
            return '1'
        return '0'

    def login(self, codigo):
        '''
            Para realizar o a busca das informações do usuario solicitado pelo cliente e 
            retorna uma string pronta para enviar os dados para o cliente.

            :parametro codigo: lista com informações para realizar a busca da conta solicitada
            pelo cliente.
            :retorna uma string com '1' juntamente com os dados da conta solicitada, informando
            a que a conta existe, e '0' para conta não encontrada.
        '''
        conta = self._cadastro.busca(codigo[1], codigo[2])
        if conta != None:
            return '1/{}/{}/{}/{}'.format(conta.titular.nome,
                                          conta.titular.sobrenome, conta.saldo,
                                          conta.senha)
        return '0'

    def deposito(self, codigo):
        '''
            Para realizar um deposito, incrementar o valor informado pelo cliente, no saldo da 
            conta solicitada.

            :parametro codigo: lista com informações para realizar o deposito da conta solicitada
            pelo cliente.
            :retorna uma string com '1' juntamente com os dados do novo saldo, e '0' para deposito 
            não realizado.
        '''
        conta = self._cadastro.buscaSecun(codigo[1])
        if conta != None:
            if (conta.depositar(float(codigo[2]))):
                self._cadastro.atualizar(conta)
                #print('entrou aqui')
                return '1/{}'.format(conta.saldo)
            return '0'
        return '0'

    def saque(self, codigo):
        '''
            Para realizar um saque, decrementar o valor informado pelo cliente, no saldo da 
            conta solicitada.

            :parametro codigo: lista com informações para realizar o saque da conta solicitada
            pelo cliente.
            :retorna uma string com '1' juntamente com os dados do novo saldo, e '0' para saque 
            não realizado.
        '''
        conta = self._cadastro.buscaSecun(codigo[1])
        if conta != None:
            if (conta.sacar(float(codigo[2]))):
                self._cadastro.atualizar(conta)
                return '1/{}'.format(conta.saldo)
            return '0'
        return '0'

    def transferencia(self, codigo):
        '''
            Para realizar uma transferencia, dencrementar o valor informado pelo cliente, no saldo da 
            conta solicitada, e incrementando na conta informada.

            :parametro codigo: lista com informações para realizar a transação da conta solicitada
            pelo cliente.
            :retorna uma string com '1' juntamente com os dados do novo saldo, e '0' para tansação 
            não realizado.
        '''
        conta = self._cadastro.buscaSecun(codigo[1])
        conta_1 = self._cadastro.buscaSecun(codigo[3])
        if conta != None and conta_1 != None:
            if (conta.transferir(conta_1, float(codigo[2]))):
                self._cadastro.atualizar(conta)
                self._cadastro.atualizar(conta_1)
                return '1/{}'.format(conta.saldo)
            return '0'
        return '0'

    def historico(self, codigo):
        '''
            Para realizar o retorno das 4 ultimas transações realizadas pela conta cliente.

            :parametro codigo: lista com informações para solicitar o historico da conta cliente.
            :retorna uma string com '1' juntamente com as transações do cliente, e '0' caso haja algum
            problema ao solicitar o historico da conta realizada.
        '''
        conta = self._cadastro.buscaSecun(codigo[1])
        if conta != None:
            n_transacoes = len(conta.historico.transacoes)
            if (n_transacoes > 4):
                n_transacoes = 4
            transacoes_str = ''
            for i in range(0, n_transacoes):
                transacoes_str = transacoes_str + '/' + conta.historico.transacoes[
                    i]
            return '1' + transacoes_str
        return '0'

    def ligar_servidor(self):
        '''
            Para deixar o srvidor apto a realizar coneções e receber mensagens,
            realizando as devidas operações de acordo com o que o cliente informa
            por meio do codigo.

            Lista de codigos que poderão ser enviados pelo cliente:
            Para solicitar cadastro : '0/nome/sobre_nome/cpf'
            Para solicitar login : '******'
            Para solicitar deposito : '2/cpf/valor'
            Para solicitar sauqe : '3/cpf/valor'
            Para solicitar transferencia: '4/cpf/valor/cpf_conta_para_transferir'
            Para solicitar historico: '5/cpf'
        '''
        host = 'localhost'
        port = 8000
        addr = (host, port)
        serv_socket = socket.socket(socket.AF_INET,
                                    socket.SOCK_STREAM)  #cria o socket
        serv_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
                               1)  #reinicializa o socket
        serv_socket.bind(
            addr)  #define a porta e quais ips podem se conectar com o servidor
        serv_socket.listen(10)  #define o limite de conexões
        '''
        serv_socket,
        
        '''

        sinc = threading.Lock()

        while (True):
            print('-aguardando conexao...')
            con, clientAddress = serv_socket.accept(
            )  #servidor aguardando conexão
            print('-coneccao realizada')

            newthread = ClientThread(clientAddress, con, sinc)
            newthread.start()
            newthread.join()
            #print('codigo recebido: {}'.format(codigo))

        serv_socket.close()
Esempio n. 26
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(310, -30, 121, 91))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(150, 60, 351, 20))
        self.lineEdit.setObjectName("lineEdit")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(40, 60, 51, 21))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(40, 110, 47, 13))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(150, 110, 351, 20))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(30, 170, 71, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(150, 170, 351, 20))
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(20, 230, 91, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_5.setFont(font)
        self.label_5.setObjectName("label_5")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(150, 230, 351, 20))
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(290, 270, 161, 23))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 330, 801, 16))
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(310, 350, 131, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(16)
        font.setBold(True)
        font.setWeight(75)
        self.label_6.setFont(font)
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(30, 390, 47, 16))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_7.setFont(font)
        self.label_7.setObjectName("label_7")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setGeometry(QtCore.QRect(160, 390, 151, 20))
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(380, 390, 75, 23))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.pushButton_2.setFont(font)
        self.pushButton_2.setObjectName("pushButton_2")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(30, 450, 81, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_8.setFont(font)
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(30, 480, 81, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_9.setFont(font)
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(30, 510, 91, 20))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(12)
        self.label_10.setFont(font)
        self.label_10.setObjectName("label_10")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(160, 449, 341, 21))
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(160, 480, 341, 20))
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(160, 510, 341, 20))
        self.lineEdit_8.setObjectName("lineEdit_8")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        '''alteraçoes'''
        self.cad = Cadastro()
        self.pushButton.clicked.connect(self.botaoCadastra)
        self.pushButton_2.clicked.connect(self.botaoBusca)

    def botaoCadastra(self):
        nome = self.lineEdit.text()
        endereco = self.lineEdit_3.text()
        cpf = self.lineEdit_2.text()
        nascimento = self.lineEdit_4.text()
        if not (nome == '' or endereco == '' or cpf == '' or nascimento == ''):
            p = Pessoa(nome, endereco, cpf, nascimento)
            if self.cad.cadastra(p):
                QMessageBox.information(None, "POOII",
                                        "Cadastro realizado com sucesso!")
                self.lineEdit.setText('')
                self.lineEdit_2.setText('')
                self.lineEdit_3.setText('')
                self.lineEdit_4.setText('')
            else:
                QMessageBox.information(
                    None, "POOII",
                    "O CPF informado já está cadastrado na base de dados!")
        else:
            QMessageBox.information(None, "POOII",
                                    "Todos os valores devem ser preenchidos!")

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(_translate("MainWindow", "Cadastra"))
        self.label_2.setText(_translate("MainWindow", "Nome"))
        self.label_3.setText(_translate("MainWindow", "CPF"))
        self.label_4.setText(_translate("MainWindow", "Endereço"))
        self.label_5.setText(_translate("MainWindow", "Nascimento"))
        self.pushButton.setText(_translate("MainWindow", "Cadastre!!"))
        self.label_6.setText(_translate("MainWindow", "Busca"))
        self.label_7.setText(_translate("MainWindow", "CPF"))
        self.pushButton_2.setText(_translate("MainWindow", "Buscar"))
        self.label_8.setText(_translate("MainWindow", "Nome"))
        self.label_9.setText(_translate("MainWindow", "Endereço"))
        self.label_10.setText(_translate("MainWindow", "Nascimento"))

    def botaoBusca(self):
        cpf = self.lineEdit_5.text()
        pessoa = self.cad.busca(cpf)
        if pessoa is not None:
            self.lineEdit_6.setText(pessoa.nome)
            self.lineEdit_7.setText(pessoa.endereco)
            self.lineEdit_8.setText(pessoa.nascimento)
        else:
            QMessageBox.information(None, "POOII", "CPF não encontrado!")
Esempio n. 27
0
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from cadastro import Cadastro
from carrinho import Carrinho
from validacao import Validacao

#Cria uma nova instancia do Firefox
driver = webdriver.Firefox()

wait = WebDriverWait(driver, 10)

cadastro = Cadastro(driver)
carrinho = Carrinho(driver)
validacao = Validacao(driver)

#Vai ate a pagina inicial
driver.get("http://automationpractice.com/index.php")
print("Entrou na loja")
print(driver.title)

#Encontra e clica no produto
Produto = driver.find_element_by_xpath(
    "/html/body/div/div[2]/div/div[2]/div/div[1]/ul[1]/li[2]/div/div[1]/div/a[1]/img"
)
Produto.click()
print("Produto encontrado")

#Adiciona o produto ao carrinho
Esempio n. 28
0
from cadastro import Cadastro

opc = int(input("Escolha sua opção:\n1 - Cadastro\n2 - Boletim\n3 - Matricula")):
if opc == 1 :
    opc2 = int(input("O que você deseja cadastrar:\n1 - Aluno\n2 - Professor\n3 - Curso\n4 - Disciplina")):
    if opc2 == 1 :
        Cadastro.aluno()
Esempio n. 29
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(640, 687)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.botao_cadastrar = QtWidgets.QPushButton(self.centralwidget)
        self.botao_cadastrar.setGeometry(QtCore.QRect(290, 270, 75, 23))
        self.botao_cadastrar.setObjectName("botao_cadastrar")
        self.label_nome = QtWidgets.QLabel(self.centralwidget)
        self.label_nome.setGeometry(QtCore.QRect(180, 100, 61, 20))
        self.label_nome.setObjectName("label_nome")
        self.edit_nome_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nome_cad.setGeometry(QtCore.QRect(240, 100, 181, 20))
        self.edit_nome_cad.setObjectName("edit_nome_cad")
        self.label_cadastrar = QtWidgets.QLabel(self.centralwidget)
        self.label_cadastrar.setGeometry(QtCore.QRect(270, 10, 171, 61))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(10)
        sizePolicy.setVerticalStretch(19)
        sizePolicy.setHeightForWidth(
            self.label_cadastrar.sizePolicy().hasHeightForWidth())
        self.label_cadastrar.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label_cadastrar.setFont(font)
        self.label_cadastrar.setObjectName("label_cadastrar")
        self.label_endereco = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco.setGeometry(QtCore.QRect(160, 130, 71, 31))
        self.label_endereco.setObjectName("label_endereco")
        self.edit_endereco_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_endereco_cad.setGeometry(QtCore.QRect(240, 140, 181, 20))
        self.edit_endereco_cad.setObjectName("edit_endereco_cad")
        self.label_cpf = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf.setGeometry(QtCore.QRect(190, 180, 47, 13))
        self.label_cpf.setObjectName("label_cpf")
        self.edit_cpf_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_cpf_cad.setGeometry(QtCore.QRect(240, 180, 181, 20))
        self.edit_cpf_cad.setObjectName("edit_cpf_cad")
        self.label_nascimento = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento.setGeometry(QtCore.QRect(160, 220, 121, 20))
        self.label_nascimento.setObjectName("label_nascimento")
        self.edit_nascimento_cad = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nascimento_cad.setGeometry(QtCore.QRect(240, 220, 181, 20))
        self.edit_nascimento_cad.setObjectName("edit_nascimento_cad")
        self.label_buscar = QtWidgets.QLabel(self.centralwidget)
        self.label_buscar.setGeometry(QtCore.QRect(270, 370, 121, 61))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(10)
        sizePolicy.setVerticalStretch(19)
        sizePolicy.setHeightForWidth(
            self.label_buscar.sizePolicy().hasHeightForWidth())
        self.label_buscar.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setPointSize(20)
        self.label_buscar.setFont(font)
        self.label_buscar.setObjectName("label_buscar")
        self.botao_buscar = QtWidgets.QPushButton(self.centralwidget)
        self.botao_buscar.setGeometry(QtCore.QRect(380, 450, 75, 23))
        self.botao_buscar.setObjectName("botao_buscar")
        self.label_cpf_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_cpf_2.setGeometry(QtCore.QRect(160, 450, 47, 13))
        self.label_cpf_2.setObjectName("label_cpf_2")
        self.label_nome_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nome_2.setGeometry(QtCore.QRect(180, 523, 61, 20))
        self.label_nome_2.setObjectName("label_nome_2")
        self.label_endereco_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_endereco_2.setGeometry(QtCore.QRect(170, 560, 71, 16))
        self.label_endereco_2.setObjectName("label_endereco_2")
        self.edit_nascimento_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nascimento_busca.setEnabled(True)
        self.edit_nascimento_busca.setGeometry(QtCore.QRect(240, 600, 181, 20))
        self.edit_nascimento_busca.setObjectName("edit_nascimento_busca")
        self.edit_endereco_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_endereco_busca.setEnabled(True)
        self.edit_endereco_busca.setGeometry(QtCore.QRect(240, 560, 181, 20))
        self.edit_endereco_busca.setObjectName("edit_endereco_busca")
        self.label_nascimento_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_nascimento_2.setGeometry(QtCore.QRect(160, 600, 111, 20))
        self.label_nascimento_2.setObjectName("label_nascimento_2")
        self.edit_nome_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_nome_busca.setEnabled(True)
        self.edit_nome_busca.setGeometry(QtCore.QRect(240, 520, 181, 20))
        self.edit_nome_busca.setObjectName("edit_nome_busca")
        self.edit_cpf_busca = QtWidgets.QLineEdit(self.centralwidget)
        self.edit_cpf_busca.setGeometry(QtCore.QRect(190, 450, 181, 20))
        self.edit_cpf_busca.setObjectName("edit_cpf_busca")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

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

        #acrescimos abaixo
        self.cadastro_dados = Cadastro()
        self.botao_cadastrar.clicked.connect(self.metodo_botao_cadastrar)
        self.botao_buscar.clicked.connect(self.metodo_botao_buscar)

    def metodo_botao_cadastrar(self):
        nome = self.edit_nome_cad.text()
        cpf = self.edit_cpf_cad.text()
        endereco = self.edit_endereco_cad.text()
        nascimento = self.edit_nascimento_cad.text()
        pessoa = Pessoa(nome, cpf, endereco, nascimento)
        if nome != '' and cpf != '' and endereco != '' and nascimento != '':
            if self.cadastro_dados.cadastrar(pessoa):
                QMessageBox.information(None, None, 'Pessoa cadastrada')
                self.edit_nome_cad.setText('')
                self.edit_cpf_cad.setText('')
                self.edit_endereco_cad.setText('')
                self.edit_nascimento_cad.setText('')
            else:
                QMessageBox.information(
                    None, None, 'Já existe uma pessoa cadastrada com esse CPF')
        else:
            QMessageBox.information(None, None, 'Preencha todos os campos')

    def metodo_botao_buscar(self):
        cpf = self.edit_cpf_busca.text()
        pessoa = self.cadastro_dados.buscar(cpf)
        if pessoa != None:
            self.edit_nome_busca.setText(pessoa.nome)
            self.edit_endereco_busca.setText(pessoa.endereco)
            self.edit_nascimento_busca.setText(pessoa.nascimento)
        else:
            QMessageBox.information(
                None, None, 'Nao existe uma pessoa cadastrada com esse CPF')

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.botao_cadastrar.setText(_translate("MainWindow", "Cadastrar"))
        self.label_nome.setText(_translate("MainWindow", "Nome:"))
        self.label_cadastrar.setText(_translate("MainWindow", "Cadastrar"))
        self.label_endereco.setText(_translate("MainWindow", "Endereço:"))
        self.label_cpf.setText(_translate("MainWindow", "CPF:"))
        self.label_nascimento.setText(_translate("MainWindow", "Nascimento:"))
        self.label_buscar.setText(_translate("MainWindow", "Buscar"))
        self.botao_buscar.setText(_translate("MainWindow", "Buscar"))
        self.label_cpf_2.setText(_translate("MainWindow", "CPF:"))
        self.label_nome_2.setText(_translate("MainWindow", "Nome:"))
        self.label_endereco_2.setText(_translate("MainWindow", "Endereço:"))
        self.label_nascimento_2.setText(_translate("MainWindow",
                                                   "Nascimento:"))