Skip to content

Commit

Permalink
Add license information and help menu to JeFaPaTo GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Timozen committed Apr 19, 2024
1 parent d229163 commit feba090
Showing 1 changed file with 95 additions and 1 deletion.
96 changes: 95 additions & 1 deletion frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import structlog

from PyQt6 import QtGui
from PyQt6.QtWidgets import QMainWindow, QTabWidget, QProgressBar, QWidget
from PyQt6.QtWidgets import QMainWindow, QTabWidget, QProgressBar, QWidget, QMessageBox

from frontend import config
from .ui_facial_feature_extraction import FacialFeatureExtraction
Expand All @@ -18,6 +18,29 @@
def add_space_between_words(text):
return re.sub(r"(\w)([A-Z])", r"\1 \2", text)

LICENCE_TEXT = """
JeFaPaTo is licensed under the MIT License.
MIT License
Copyright (c) [2023] [Tim Büchner]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""

class JeFaPaTo(QMainWindow, config.Config):
def __init__(self, args: argparse.Namespace) -> None:
"""
Expand Down Expand Up @@ -61,6 +84,16 @@ def __init__(self, args: argparse.Namespace) -> None:

self.statusBar().addPermanentWidget(self.progress_bar)

# Create menu bar
menu_bar = self.menuBar()
# Create Help menu
help_menu = menu_bar.addMenu("Help")

help_menu.addAction("About", self.show_about)
help_menu.addAction("Documentation", self.show_documentation)
help_menu.addAction("License", self.show_license)
help_menu.addAction("Acknowledgements", self.show_acknowledgements)

def closeEvent(self, event: QtGui.QCloseEvent) -> None:
"""
Event handler for the close event of the application window.
Expand All @@ -81,3 +114,64 @@ def closeEvent(self, event: QtGui.QCloseEvent) -> None:
self.save()
logger.info("Internal Shut Down complete", widget=self)
super().closeEvent(event)

def show_about(self):
"""
Shows the About dialog.
"""
## use a dialog to show the about information
dialog = QMessageBox()
dialog.setWindowTitle("About JeFaPaTo")
dialog.setText("JeFaPaTo - Jena Facial Palsy Tool")
dialog.setInformativeText("""
<ul>
<li> Version: 1.0.0 </li>
<li> Author: Tim Büchner </li>
<li> License: MIT </li>
<li> Link: <a href="https://github.com/cvjena/JeFaPaTo">Website</a> </li>
</ul>
""")
dialog.setStandardButtons(QMessageBox.StandardButton.Ok)
dialog.exec()

def show_documentation(self):
"""
Shows the Documentation dialog.
"""
dialog = QMessageBox()
dialog.setWindowTitle("Documentation")
dialog.setText("Documentation")
dialog.setInformativeText("""
Documentation is available at <a href="https://github.com/cvjena/JeFaPaTo/wiki"> our wiki page</a>.
"""
)
dialog.setStandardButtons(QMessageBox.StandardButton.Ok)
dialog.exec()

def show_license(self):
"""
Shows the License dialog.
"""
dialog = QMessageBox()
dialog.setWindowTitle("License")
dialog.setText("License")
dialog.setInformativeText(LICENCE_TEXT)
dialog.setStandardButtons(QMessageBox.StandardButton.Ok)
dialog.exec()

def show_acknowledgements(self):
"""
Shows the Acknowledgements dialog.
"""

dialog = QMessageBox()
dialog.setWindowTitle("Acknowledgements")
dialog.setText("Acknowledgements")
dialog.setInformativeText("""
JeFaPaTo is based on the <a href="https://github.com/google/mediapipe"> MediaPipe library </a> by Google.
We would like to thank the developers for their great work and the possibility to use their library.
Additionally, we would like to thank the <a href="https://opencv.org/"> OpenCV </a> team for their great work and the possibility to use their library.
Also, we thank our medical partners for their support and feedback.
""")
dialog.setStandardButtons(QMessageBox.StandardButton.Ok)
dialog.exec()

0 comments on commit feba090

Please sign in to comment.