From dfbc91c9ec5780e329c5e854255c44bfdad3b4aa Mon Sep 17 00:00:00 2001 From: brahim Date: Tue, 17 Sep 2024 11:09:27 +0200 Subject: [PATCH] Menu Help --> About : open a new window to display information of AcouSed, in particular, the logo, the version and the date. Licence, Copyright and Suport buttons are added. The user can click on each button to open a new window with the related information. --- View/about_window.py | 294 +++++++++++++++++++++++++++++++++++++++++++ View/mainwindow.py | 3 +- 2 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 View/about_window.py diff --git a/View/about_window.py b/View/about_window.py new file mode 100644 index 0000000..06696f3 --- /dev/null +++ b/View/about_window.py @@ -0,0 +1,294 @@ +import sys + +from PyQt5.QtGui import QIcon, QPixmap +from PyQt5.QtWidgets import (QWidget, QLabel, QHBoxLayout, QVBoxLayout, QApplication, QMainWindow, QGridLayout, + QDialog, QDialogButtonBox, QPushButton, QTextEdit, QFrame) +from PyQt5.QtCore import Qt +import datetime + +from Translation.constant_string import HORIZONTAL + + +class AboutWindow(QDialog): + + def __init__(self): + + super().__init__() + + self.logo_path = "./Logo/" + self.logo = QPixmap(self.logo_path + "/" + "Logo_AcouSed_AboutAcouSedWindow.png") + self.logo.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation) + + self.setGeometry(400, 200, 300, 200) + + self.setWindowTitle("About AcouSed") + + # self.buttonBox = QDialogButtonBox.close + + self.verticalLayout_Main = QVBoxLayout() + self.setLayout(self.verticalLayout_Main) + + self.horizontalLayout = QHBoxLayout() + self.verticalLayout_Main.addLayout(self.horizontalLayout) + + # ---------------------------------------------------------- + + self.label_logo = QLabel() + self.label_logo.setPixmap(self.logo) + self.horizontalLayout.addWidget(self.label_logo) + + self.verticalLayout_AcouSed_info = QVBoxLayout() + self.horizontalLayout.addLayout(self.verticalLayout_AcouSed_info) + + self.label_acoused = QLabel() + self.label_acoused.setText(f"Acoused 1.10 \n2024.09.23 \nby INRAE") + self.verticalLayout_AcouSed_info.addWidget(self.label_acoused) + + # self.label_date = QLabel() + # self.label_date.setText(f"") + # self.verticalLayout_AcouSed_info.addWidget(self.label_date) + # + # self.label_copyright = QLabel() + # self.label_copyright.setText(f"") + # self.verticalLayout_AcouSed_info.addWidget(self.label_copyright) + # print("je suis la") + + # ---------------------------------------------------------- + + self.horizontalLine = QFrame() + self.horizontalLine.setFrameShape(QFrame.HLine) + self.horizontalLine.setFrameShadow(QFrame.Sunken) + + self.verticalLayout_Main.addWidget(self.horizontalLine) + + # ---------------------------------------------------------- + + self.gridLayout_button = QGridLayout() + self.verticalLayout_Main.addLayout(self.gridLayout_button) + + self.button_Licence = QPushButton() + self.button_Licence.setText("Licence") + self.gridLayout_button.addWidget(self.button_Licence, 0, 0, 1, 1) + + self.button_Licence.clicked.connect(self.licence_window) + + self.button_Copyright = QPushButton() + self.button_Copyright.setText("Copyright") + self.gridLayout_button.addWidget(self.button_Copyright, 0, 1, 1, 1) + + self.button_Copyright.clicked.connect(self.copyright_window) + + self.button_Support = QPushButton() + self.button_Support.setText("Support") + self.gridLayout_button.addWidget(self.button_Support, 0, 2, 1, 1) + + self.button_Support.clicked.connect(self.support_window) + + def licence_window(self): + lw = Licence() + lw.exec() + + def copyright_window(self): + cw = Copyright() + cw.exec() + + def support_window(self): + sw = Support() + sw.exec() + + +class Licence(QDialog): + + def __init__(self): + + super().__init__() + + self.setWindowTitle("Licence") + + self.setGeometry(500, 300, 400, 400) + + self.verticalLayout = QVBoxLayout() + self.setLayout(self.verticalLayout) + + self.textEdit = QTextEdit() + self.verticalLayout.addWidget(self.textEdit) + + self.textEdit.setText("A. HISTORY OF THE SOFTWARE \n " + "========================== \n\n " + "B. TERMS AND CONDITIONS \n" + "======================= \n\n" + "Open source software .... ") + + +class Copyright(QDialog): + + def __init__(self): + + super().__init__() + + self.setWindowTitle("Copyright") + + self.setGeometry(500, 300, 400, 400) + + self.verticalLayout = QVBoxLayout() + self.setLayout(self.verticalLayout) + + self.textEdit = QTextEdit() + self.verticalLayout.addWidget(self.textEdit) + + self.textEdit.setText("Copyright (c) 2024-2030. \n" + "All Rights Reserved.") + + +class Support(QDialog): + + def __init__(self): + + super().__init__() + + self.setWindowTitle("Support") + + self.setGeometry(500, 300, 400, 400) + + self.verticalLayout = QVBoxLayout() + self.setLayout(self.verticalLayout) + + self.textEdit = QTextEdit() + self.verticalLayout.addWidget(self.textEdit) + + self.textEdit.setText("The development of AcouSed was supported by OSR6 and CNR. \n" + "It was made in collaboration with Ubertone and EDF Companies.") + + +# app = QApplication(sys.argv) +# w = AboutWindow() +# sys.exit(app.exec_()) + +# if __name__ == "__main__": +# app = QApplication(sys.argv) +# # otherwindow = QMainWindow() +# # w = AboutWindow(otherwindow) +# w = AboutWindow() +# print(w) +# w.show() +# print("et ici") +# # otherwindow.show() +# # MainWindow = QMainWindow() +# # ui = Ui_MainWindow() +# # ui.setupUi(MainWindow) +# # MainWindow.show() +# sys.exit(app.exec_()) + + + +# import sys +# from PyQt5.QtWidgets import * +# from PyQt5.QtGui import * +# from PyQt5.QtCore import * +# +# +# class AboutWindow(QWidget): +# +# def __init__(self): +# +# super().__init__() +# +# # self.centralwidget = QWidget(window) +# +# self.execute() +# +# def execute(self): +# +# self.resize(300, 500) +# self.move(200, 200) +# self.setWindowTitle("Ma première fenêtre simple") +# # self.setWindowFlags(Qt.Popup) +# +# # QIcon +# icone = QIcon("PyQt5_icone.jpeg") +# self.setWindowIcon(icone) +# +# # QLabel +# label1 = QLabel("PyQt", self) +# label1.setText(label1.text() + "5") +# label1.setMargin(5) +# label1.setIndent(50) +# +# # QPixmap +# pic = QPixmap("PyQt5_icone.jpeg") +# label2 = QLabel(self) +# label2.setPixmap(pic) +# label2.setScaledContents(True) +# label2.resize(50, 50) +# label2.move(60, 50) +# +# # label3 = QLabel("Phrase test :", self) +# label3 = QLabel(self) +# label3.setText("Phrase test :") +# label3.move(10, 125) +# +# # QLineEdit +# line_edit = QLineEdit(self) +# line_edit.move(100, 125) +# line_edit.resize(150, 20) +# line_edit.setText("Ma Valeur par défaut") +# +# # QPushButton +# button = QPushButton(self) +# button.setText('Cliquez') +# button.move(30, 150) +# +# # QCheckBox +# checkbox = QCheckBox(self) +# checkbox.setText("Bouton Check Box") +# checkbox.move(30, 200) +# checkbox.setChecked(True) +# +# if checkbox.isChecked() == True: +# label1.setText("La case est coché") +# else: +# label1.setText("la case n'est pas coché") +# +# # QRadioButton +# radiobutton = QRadioButton(self) +# radiobutton.setText('Bouton Radio') +# radiobutton.move(30, 220) +# +# # QComboBox +# combobox = QComboBox(self) +# combobox.addItems(["France", "Espagne", "Italie", "Allemagne", "Royaume-Uni"]) +# combobox.move(100, 250) +# +# label4 = QLabel("Choix du pays", self) +# label4.move(5, 250) +# +# # QSpinBox +# spinbox = QSpinBox(self) +# spinbox.move(75, 300) +# +# label5 = QLabel("Valeur :", self) +# label5.move(5, 300) +# +# # QProgressBar +# progressbar = QProgressBar(self) +# progressbar.setGeometry(5, 350, 150, 30) +# progressbar.setValue(0) +# +# # QTextEdit +# textedit = QTextEdit(self) +# textedit.move(20, 400) +# textedit.resize(150, 40) +# textedit.setText("azertyuiopqsdfghjklmwxcvbn azertyuiopqsdfghjklmwxcvbn") +# +# self.show() +# print("coucou") +# +# # if __name__ == "__main__": +# # application = QApplication(sys.argv) +# # +# # fenetre = AboutWindow() +# # +# # fenetre.show() +# # +# # sys.exit(application.exec_()) +# diff --git a/View/mainwindow.py b/View/mainwindow.py index 871200e..a11c1bf 100644 --- a/View/mainwindow.py +++ b/View/mainwindow.py @@ -226,7 +226,8 @@ class Ui_MainWindow(object): def about_window(self): print("about") - AboutWindow() + aw = AboutWindow() + aw.exec() # w.show() # self.main_window = QtWidgets.QMainWindow() # self.window = AboutWindow(mainWindow=self.main_window)