Skip to content

Commit

Permalink
Merge branch 'Senac-SOR-ADS:main' into Modulo-WEB
Browse files Browse the repository at this point in the history
  • Loading branch information
XlouPx authored Dec 9, 2024
2 parents ddc45e1 + 5805e82 commit be0185c
Show file tree
Hide file tree
Showing 12 changed files with 189 additions and 25 deletions.
71 changes: 69 additions & 2 deletions App/view/editarPessoas.py
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
23 changes: 21 additions & 2 deletions App/view/feadbackConcluido.py
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()
45 changes: 33 additions & 12 deletions App/view/feadbackErro.py
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')
8 changes: 7 additions & 1 deletion App/view/ui/cadastroCurso.ui
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@ border-radius: 15px;
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>793</width>
<height>486</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
8 changes: 7 additions & 1 deletion App/view/ui/cadastroPessoas.ui
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>762</width>
<height>479</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
8 changes: 7 additions & 1 deletion App/view/ui/cadastroSalas.ui
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,20 @@
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>801</width>
<height>340</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
8 changes: 7 additions & 1 deletion App/view/ui/editarCurso.ui
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,20 @@
</property>
</spacer>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>1056</width>
<height>642</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
8 changes: 7 additions & 1 deletion App/view/ui/editarLogin.ui
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,20 @@
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>833</width>
<height>582</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
11 changes: 10 additions & 1 deletion App/view/ui/editarPessoa.ui
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,20 @@ border-radius: 15px;
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>803</width>
<height>566</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down Expand Up @@ -237,6 +243,9 @@ border-radius: 15px;
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</widget>
</item>
Expand Down
8 changes: 7 additions & 1 deletion App/view/ui/editarReserva.ui
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,20 @@ border-radius: 15px;
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="ReservaDeSala">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>1130</width>
<height>622</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
8 changes: 7 additions & 1 deletion App/view/ui/editarSalas.ui
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>794</width>
<height>314</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down
8 changes: 7 additions & 1 deletion App/view/ui/reserva.ui
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,20 @@
</property>
</widget>
</item>
<item>
<item alignment="Qt::AlignHCenter">
<widget class="QFrame" name="ReservaDeSala">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>1106</width>
<height>642</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down

0 comments on commit be0185c

Please sign in to comment.