-
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
3 changed files
with
74 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,56 @@ | ||
from PyQt5.QtWidgets import QWidget | ||
from PyQt5.uic import loadUi | ||
from PyQt5.QtCore import pyqtSlot | ||
from App.controller.login import listarLogins, buscarLoginId, atualizarCadastro | ||
from App.controller.utils import validarInputs | ||
from App.model.criptografia import Criptografia | ||
|
||
class EditarLogin(QWidget): | ||
def __init__(self): | ||
super().__init__() | ||
loadUi('App/view/ui/editarLogin.ui',self) | ||
|
||
#btn editar login = btnEditarLogin | ||
#btn editar login = btnEditarLogin | ||
self.dicionarioLogins = listarLogins() | ||
self.popularJanela() | ||
self.alterarLogin.currentIndexChanged.connect(self.popularCampos) | ||
|
||
@pyqtSlot() | ||
def on_btnEditarLogin_clicked(self): | ||
dados = self.getValores() | ||
if validarInputs(dados): | ||
atualizarCadastro(dados[0], dados[1], dados[3], dados[2]) | ||
|
||
def popularJanela(self): | ||
self.comboboxLogin() | ||
self.popularCampos() | ||
|
||
def comboboxLogin(self): | ||
logins = self.dicionarioLogins.keys() | ||
self.alterarLogin.addItems(logins) | ||
|
||
def popularCampos(self): | ||
key = self.getKey() | ||
dados = buscarLoginId(key) | ||
self.email.setText(dados.get('email')) | ||
self.setNivelAcesso() | ||
|
||
def getKey(self): | ||
nome = self.alterarLogin.currentText() | ||
key = self.dicionarioLogins.get(nome) | ||
return key | ||
|
||
def getValores(self): | ||
email = self.email.text() | ||
senha = self.senha.text() | ||
nivelAcesso = self.nivelAcesso.currentText() | ||
nome = self.alterarLogin.currentText() | ||
idLogin = self.dicionarioLogins.get(nome) | ||
|
||
return (idLogin, email, senha, nivelAcesso) | ||
|
||
def setNivelAcesso(self): | ||
key = self.getKey() | ||
dados = buscarLoginId(key) | ||
self.nivelAcesso.setCurrentText(dados.get('nivelAcesso')) | ||
|