summaryrefslogtreecommitdiff
path: root/src/gui/windowRecherche.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windowRecherche.py')
-rw-r--r--src/gui/windowRecherche.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/gui/windowRecherche.py b/src/gui/windowRecherche.py
deleted file mode 100644
index dd71f08..0000000
--- a/src/gui/windowRecherche.py
+++ /dev/null
@@ -1,62 +0,0 @@
-
-from PyQt5.QtWidgets import (
- QDialog, QVBoxLayout, QHBoxLayout,
- QLabel, QPushButton, QMessageBox
-)
-from src.database import dbsearch
-# https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result
-# https://stackoverflow.com/questions/53751106/create-lambda-functions-in-a-loop-for-pyqt5-signals?noredirect=1
-
-
-def more_infos(mainWindow, proId):
- search: object = dbsearch.DbSearch(mainWindow)
- resRecherche: list = search.get_user_info_by_userid(proId)[0][1:]
- label: list = [
- "Nom",
- "Prénom",
- "Diplôme",
- "Capacités",
- "Description",
- "Téléphone",
- "Adresse",
- "Code postale",
- "Ville",
- ]
- text: list = []
- for i in range(len(resRecherche)):
- text.append(f"{label[i]}: {resRecherche[i]}")
-
- QMessageBox.information(
- mainWindow,
- "Informations du pro",
- "\n".join(text)
- )
-
-def main(mainWindow: object, results: list) -> None:
- dial = QDialog(parent = mainWindow)
- dial.setWindowTitle("Recherche")
- layoutsResult: list = []
- for i in results:
- layoutLine = QHBoxLayout()
- color = results.index(i) % 2
- if color:
- colored = QLabel(i["text"])
- colored.setStyleSheet("background-color: rgb(230,200,200); border-radius: 3px")
- layoutLine.addWidget(colored)
- else:
- layoutLine.addWidget(QLabel(i["text"]))
- btnInfos = QPushButton("Infos")
- btnInfos.clicked.connect(
- lambda checked, proId = i['id']:
- more_infos(mainWindow, proId)
- )
- layoutLine.addStretch()
- layoutLine.addWidget(btnInfos)
- layoutsResult.append(layoutLine)
-
- layoutMain = QVBoxLayout()
- for layout in layoutsResult:
- layoutMain.addLayout(layout)
-
- dial.setLayout(layoutMain)
- dial.show()