-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Senac-SOR-ADS:main' into Modulo-WEB
- Loading branch information
Showing
12 changed files
with
189 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,76 @@ | ||
from PyQt5.QtWidgets import QWidget | ||
from PyQt5.QtWidgets import QWidget, QComboBox, QLineEdit, QDateEdit | ||
from PyQt5.uic import loadUi | ||
from PyQt5.QtCore import QDate, pyqtSlot | ||
from App.controller.pessoa import buscarPessoas, buscarPessoaId, atualizarPessoa | ||
from App.controller.utils import validarInputs | ||
ID_PESSOA = 0 | ||
|
||
class EditarPessoas(QWidget): | ||
def __init__(self): | ||
super().__init__() | ||
loadUi('App/view/ui/editarPessoa.ui',self) | ||
self.nomePessoas = self.findChild(QComboBox, 'nomePessoas') | ||
self.cargo = self.findChild(QComboBox, 'cargo') | ||
self.email = self.findChild(QLineEdit, 'email') | ||
self.dataDeNascimento = self.findChild(QDateEdit, 'dataDeNascimento') | ||
self.dicionarioPessoas = buscarPessoas() | ||
self.popularJanela() | ||
self.nomePessoas.currentIndexChanged.connect(self.popularCampos) | ||
|
||
# btn editar pessoas = btnEditar | ||
|
||
@pyqtSlot() | ||
def on_btnEditar_clicked(self): | ||
dados = self.getValores() | ||
if validarInputs(dados): | ||
atualizarPessoa(dados[0], dados[1], dados[2], dados[3], dados[4], dados[5], dados[6]) | ||
|
||
def popularNomes(self): | ||
pessoas = self.dicionarioPessoas.keys() | ||
self.nomePessoas.addItems(pessoas) | ||
|
||
def popularJanela(self): | ||
self.popularNomes() | ||
self.popularCampos() | ||
|
||
def getValores(self): | ||
global ID_PESSOA | ||
nome = self.nomePessoas.currentText() | ||
cpfCnpj = self.cpfCnpj.text() | ||
dataNascimento = self.dataDeNascimento.date() | ||
dataNascimento = self.retornaDate(dataNascimento) | ||
telefone = self.telefone.text() | ||
email = self.email.text() | ||
cargo = self.cargo.currentText() | ||
|
||
return (ID_PESSOA, nome, cpfCnpj, dataNascimento, telefone, email, cargo) | ||
|
||
def getKey(self): | ||
nome = self.nomePessoas.currentText() | ||
key = self.dicionarioPessoas.get(nome) | ||
return key | ||
|
||
def popularCampos(self): | ||
key = self.getKey() | ||
self.setIdPessoa(key) | ||
dados = buscarPessoaId(key) | ||
self.email.setText(dados.get('email')) | ||
self.cpfCnpj.setText(dados.get('cpfCnpj')) | ||
self.telefone.setText(dados.get('telefone')) | ||
self.cargo.setCurrentText(dados.get('cargo')) | ||
self.setDataNascimento(dados.get('dataNasc')) | ||
|
||
def setDataNascimento(self, data): | ||
data = data.__str__() | ||
data = data.split('-') | ||
objeto = QDate() | ||
objeto.setDate(int(data[0]), int(data[1]), int(data[2])) | ||
self.dataDeNascimento.setDate(objeto) | ||
|
||
def retornaDate(self, date): | ||
date = (str(date.year()), str(date.month()), str(date.day())) | ||
dataFinal = '-'.join(date) | ||
return dataFinal | ||
|
||
def setIdPessoa(self, id): | ||
global ID_PESSOA | ||
ID_PESSOA = id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
from PyQt5.QtWidgets import QDialog | ||
from PyQt5.uic import loadUi | ||
from PyQt5.QtCore import Qt, QPoint | ||
|
||
class FeadbackConcluido(QDialog): | ||
def __init__(self): | ||
super().__init__() | ||
loadUi('App/view/ui/feadbackConcluido.ui',self) | ||
loadUi('App/view/ui/feadbackConcluido.ui', self) | ||
|
||
#label do aviso do Concluido = #texto | ||
# Variáveis para armazenar o estado da movimentação | ||
self._is_dragging = False | ||
self._start_pos = QPoint() | ||
|
||
def mousePressEvent(self, event): | ||
if event.button() == Qt.LeftButton: | ||
self._is_dragging = True | ||
self._start_pos = event.globalPos() - self.frameGeometry().topLeft() | ||
event.accept() | ||
|
||
def mouseMoveEvent(self, event): | ||
if self._is_dragging and event.buttons() == Qt.LeftButton: | ||
self.move(event.globalPos() - self._start_pos) | ||
event.accept() | ||
|
||
def mouseReleaseEvent(self, event): | ||
if event.button() == Qt.LeftButton: | ||
self._is_dragging = False | ||
event.accept() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,62 @@ | ||
from PyQt5.QtWidgets import QDialog | ||
from PyQt5.uic import loadUi | ||
from PyQt5.QtCore import Qt | ||
from PyQt5.QtCore import Qt, QPoint | ||
|
||
class FeadbackErro(QDialog): | ||
def __init__(self, txt): | ||
super().__init__() | ||
loadUi('App/view/ui/feadbackErro.ui',self) | ||
loadUi('App/view/ui/feadbackErro.ui', self) | ||
|
||
self.texto.setText(txt) | ||
|
||
# Remove a barra de título e as bordas da janela | ||
self.setWindowFlags(Qt.FramelessWindowHint) | ||
|
||
# Variáveis para controle de movimentação | ||
self._is_dragging = False | ||
self._start_pos = QPoint() | ||
|
||
# Botões | ||
self.btnConfirmar.clicked.connect(self.reject) | ||
self.btnFechar.clicked.connect(self.reject) | ||
|
||
def mudarFoto(self, img): | ||
if img == 'Validado': | ||
self.setStyleSheet(""" | ||
#icon { | ||
image: url(App/view/ui/icones/iconConcluido.png) | ||
image: url(App/view/ui/icones/iconConcluido.png); | ||
} | ||
""") | ||
""") | ||
else: | ||
self.setStyleSheet(""" | ||
#icon { | ||
image: url(App/view/ui/icones/iconErro.png) | ||
image: url(App/view/ui/icones/iconErro.png); | ||
} | ||
""") | ||
|
||
|
||
|
||
""") | ||
|
||
# Adiciona movimentação da janela | ||
def mousePressEvent(self, event): | ||
if event.button() == Qt.LeftButton: | ||
self._is_dragging = True | ||
self._start_pos = event.globalPos() - self.frameGeometry().topLeft() | ||
event.accept() | ||
|
||
def mouseMoveEvent(self, event): | ||
if self._is_dragging and event.buttons() == Qt.LeftButton: | ||
self.move(event.globalPos() - self._start_pos) | ||
event.accept() | ||
|
||
def mouseReleaseEvent(self, event): | ||
if event.button() == Qt.LeftButton: | ||
self._is_dragging = False | ||
event.accept() | ||
|
||
|
||
if __name__ == "__main__": | ||
from PyQt5.QtWidgets import QApplication | ||
resp = FeadbackErro('sla') | ||
resp = FeadbackErro('Texto de exemplo') | ||
app = QApplication([]) | ||
if resp.exec_(): | ||
print('ok') | ||
else: | ||
print('negado') | ||
print('negado') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters