From 69a19881862d2d3d86e16163b9a2e0276ea87c5c Mon Sep 17 00:00:00 2001 From: Samuel Lopez <85613111+Samuelopez-ansys@users.noreply.github.com> Date: Mon, 10 Jun 2024 07:46:59 +0200 Subject: [PATCH 1/5] Update v0.6.dev0 (#131) --- src/ansys/aedt/toolkits/common/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/aedt/toolkits/common/__init__.py b/src/ansys/aedt/toolkits/common/__init__.py index 9fe52d60..5cfb1297 100644 --- a/src/ansys/aedt/toolkits/common/__init__.py +++ b/src/ansys/aedt/toolkits/common/__init__.py @@ -26,4 +26,4 @@ ansys.aedt.toolkits.common """ -__version__ = "0.5.dev0" +__version__ = "0.6.dev0" From e9e8c5aac234cb38561531e57f82890f5e151a6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 6 Jul 2024 09:38:59 +0000 Subject: [PATCH 2/5] MAINT: Update ipython requirement from <8.26,>=8.13.0 to >=8.13.0,<8.27 (#133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 44500fdb..21945fe4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ doc = [ "nbsphinx>=0.9.0,<0.10", "sphinx_design", "jupytext", - "ipython>=8.13.0,<8.26", + "ipython>=8.13.0,<8.27", "jupyterlab>=4.0.0,<4.3", "pypandoc>=1.10.0,<1.14", ] From fee115f321062b845c5441d4bf666a71a02e086f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= <146729917+SMoraisAnsys@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:49:52 +0200 Subject: [PATCH 3/5] DOCS: Add help menu in example (#134) --- .../ui/frontend_properties.toml | 8 ++ .../toolkit/pyaedt_toolkit/ui/run_frontend.py | 24 ++++ .../ui/windows/help/__init__.py | 0 .../ui/windows/help/help_menu.py | 125 ++++++++++++++++++ .../common/ui/utils/images/icons/help.svg | 76 +++++++++++ 5 files changed, 233 insertions(+) create mode 100644 examples/toolkit/pyaedt_toolkit/ui/windows/help/__init__.py create mode 100644 examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py create mode 100644 src/ansys/aedt/toolkits/common/ui/utils/images/icons/help.svg diff --git a/examples/toolkit/pyaedt_toolkit/ui/frontend_properties.toml b/examples/toolkit/pyaedt_toolkit/ui/frontend_properties.toml index 1d2fc25e..c497c471 100644 --- a/examples/toolkit/pyaedt_toolkit/ui/frontend_properties.toml +++ b/examples/toolkit/pyaedt_toolkit/ui/frontend_properties.toml @@ -36,6 +36,14 @@ btn_tooltip= "Design" show_top= true is_active= false +[[defaults.add_left_menus]] +btn_icon= "help.svg" +btn_id= "help_menu" +btn_text= "Help" +btn_tooltip= "Help" +show_top= false +is_active= false + [[defaults.add_left_menus]] btn_icon= "icon_log.svg" btn_id= "progress_menu" diff --git a/examples/toolkit/pyaedt_toolkit/ui/run_frontend.py b/examples/toolkit/pyaedt_toolkit/ui/run_frontend.py index bee1e822..cedf6607 100644 --- a/examples/toolkit/pyaedt_toolkit/ui/run_frontend.py +++ b/examples/toolkit/pyaedt_toolkit/ui/run_frontend.py @@ -16,6 +16,7 @@ # New windows from windows.create_geometry.geometry_menu import GeometryMenu from windows.plot_design.plot_design_menu import PlotDesignMenu +from windows.help.help_menu import HelpMenu # Common windows from ansys.aedt.toolkits.common.ui.main_window.main_window_layout import MainWindowLayout @@ -102,6 +103,11 @@ def __init__(self): self.plot_design_menu.setup() self.ui.left_menu.clicked.connect(self.plot_design_menu_clicked) + # Help menu + self.plot_design_menu = HelpMenu(self) + self.plot_design_menu.setup() + self.ui.left_menu.clicked.connect(self.help_menu_clicked) + # Home page as first page self.ui.set_page(self.ui.load_pages.home_page) @@ -142,6 +148,24 @@ def plot_design_menu_clicked(self): if not is_left_visible: self.ui.toggle_left_column() + def help_menu_clicked(self): + selected_menu = self.ui.get_selected_menu() + menu_name = selected_menu.objectName() + + if menu_name == "help_menu": + selected_menu.set_active(True) + self.ui.set_page(self.plot_design_menu.plot_design_menu_widget) + + self.ui.set_left_column_menu( + menu=self.plot_design_menu.plot_design_column_widget, + title="Help", + icon_path=self.ui.images_load.icon_path("help.svg"), + ) + + is_left_visible = self.ui.is_left_column_visible() + if not is_left_visible: + self.ui.toggle_left_column() + if __name__ == "__main__": app = QApplication(sys.argv) diff --git a/examples/toolkit/pyaedt_toolkit/ui/windows/help/__init__.py b/examples/toolkit/pyaedt_toolkit/ui/windows/help/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py b/examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py new file mode 100644 index 00000000..6298cf94 --- /dev/null +++ b/examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py @@ -0,0 +1,125 @@ +from PySide6 import QtCore, QtGui, QtWidgets +from PySide6.QtWidgets import QLabel +from PySide6.QtWidgets import QGridLayout +from PySide6.QtWidgets import QWidget +from windows.plot_design.plot_design_column import Ui_LeftColumn +from windows.plot_design.plot_design_page import Ui_Plot_Design + +import tempfile +from ansys.aedt.toolkits.common import __version__ + +ABOUT_TEXT = f"""

PyAEDT Common Toolkit {__version__}

+

Project using PySide6.

+

If you have any questions or issues, please open an issue in pyaedt-toolkits-common Issues page.

+

Alternatively, you can contact us at pyansys.core@ansys.com.

+

Your use of this software is governed by the MIT License. In addition, this package allows you to access a software that is licensed under separate terms ("Separately Licensed Software"). If you chose to install such Separately Licensed Software, you acknowledge that you are responsible for complying with any associated terms and conditions.

+

Copyright 2023 - 2024 ANSYS, Inc. All rights reserved.

+""" +DOCUMENTATION_URL = "https://aedt.common.toolkit.docs.pyansys.com/" +ISSUE_TRACKER_URL = "https://github.com/ansys/pyaedt-toolkits-common/issues" + + +class HelpMenu(object): + def __init__(self, main_window): + # General properties + self.main_window = main_window + self.ui = main_window.ui + self.temp_folder = tempfile.mkdtemp() + + # Add page + plot_design_menu_index = self.ui.add_page(Ui_Plot_Design) + self.ui.load_pages.pages.setCurrentIndex(plot_design_menu_index) + self.plot_design_menu_widget = self.ui.load_pages.pages.currentWidget() + + # Add left column + new_column_widget = QWidget() + new_ui = Ui_LeftColumn() + new_ui.setupUi(new_column_widget) + self.ui.left_column.menus.menus.addWidget(new_column_widget) + self.plot_design_column_widget = new_column_widget + self.plot_design_column_vertical_layout = new_ui.plot_design_vertical_layout + + # Specific properties + self.plot_design_label = self.plot_design_menu_widget.findChild(QLabel, "plot_design_label") + self.plot_design_grid = self.plot_design_menu_widget.findChild(QGridLayout, "plot_design_grid") + + self.plot_design_button_layout = None + self.plot_design_button = None + self.online_documentation_button = None + self.issue_tracker_button = None + + def setup(self): + # Modify theme + app_color = self.main_window.ui.themes["app_color"] + text_color = app_color["text_active"] + background = app_color["dark_three"] + + # Label button + plot_design_label_style = """ + QLabel {{ + color: {_color}; + font-size: {_font_size}pt; + font-weight: bold; + }} + """ + custom_style = plot_design_label_style.format( + _color=text_color, _bg_color=background, _font_size=self.main_window.properties.font["title_size"] + ) + self.plot_design_label.setStyleSheet(custom_style) + + # Set column + + # About button + row_returns = self.ui.add_n_buttons( + self.plot_design_column_vertical_layout, num_buttons=1, + height=40, + width=[200], + text=["About"], + font_size=self.main_window.properties.font["title_size"] + ) + self.plot_design_button_layout = row_returns[0] + self.plot_design_button = row_returns[1] + self.plot_design_button_layout.addWidget(self.plot_design_button) + self.plot_design_button.clicked.connect(self.about_button_clicked) + + # Documentation button + row_returns = self.ui.add_n_buttons( + self.plot_design_column_vertical_layout, num_buttons=1, + height=40, + width=[200], + text=["Documentation website"], + font_size=self.main_window.properties.font["title_size"] + ) + self.plot_design_button_layout = row_returns[0] + self.online_documentation_button = row_returns[1] + self.plot_design_button_layout.addWidget(self.online_documentation_button) + self.online_documentation_button.clicked.connect(self.visit_website) + + # Issue tracker button + row_returns = self.ui.add_n_buttons( + self.plot_design_column_vertical_layout, num_buttons=1, + height=40, + width=[200], + text=["Issue tracker"], + font_size=self.main_window.properties.font["title_size"] + ) + print(row_returns) + self.plot_design_button_layout = row_returns[0] + self.issue_tracker_button = row_returns[1] + self.plot_design_button_layout.addWidget(self.issue_tracker_button) + self.issue_tracker_button.clicked.connect(self.report_issue) + + def about_button_clicked(self): + """Display the PyAEDT Common Toolkit 'About' information.""" + + mbox = QtWidgets.QMessageBox.about(self.main_window, "About", ABOUT_TEXT) + + def visit_website(self): + """Access the PyAEDT Common Toolkit documentation.""" + url = QtCore.QUrl(DOCUMENTATION_URL) + QtGui.QDesktopServices.openUrl(url) + + def report_issue(self): + """Access the PyAEDT Common Toolkit issues tracker.""" + url = QtCore.QUrl(ISSUE_TRACKER_URL) + QtGui.QDesktopServices.openUrl(url) diff --git a/src/ansys/aedt/toolkits/common/ui/utils/images/icons/help.svg b/src/ansys/aedt/toolkits/common/ui/utils/images/icons/help.svg new file mode 100644 index 00000000..1e1f66c3 --- /dev/null +++ b/src/ansys/aedt/toolkits/common/ui/utils/images/icons/help.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + ? + + + From 157a0f1b2e527da9ea9fb849118cd75b3bf42b8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:36:12 +0200 Subject: [PATCH 4/5] MAINT: Bump twine from 5.1.0 to 5.1.1 (#132) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 21945fe4..c6298f52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ ] dependencies = [ "build==1.2.1", - "twine==5.1.0", + "twine==5.1.1", "pyaedt>=0.8.0,<0.10", "pydantic", "tomli; python_version < '3.12'", From 279126f95d766c93d9a7722e7426abb02dfc6864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Morais?= <146729917+SMoraisAnsys@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:46:04 +0200 Subject: [PATCH 5/5] DOCS: Remove forgotten print from example (#135) --- examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py b/examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py index 6298cf94..49868a2e 100644 --- a/examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py +++ b/examples/toolkit/pyaedt_toolkit/ui/windows/help/help_menu.py @@ -103,7 +103,7 @@ def setup(self): text=["Issue tracker"], font_size=self.main_window.properties.font["title_size"] ) - print(row_returns) + self.plot_design_button_layout = row_returns[0] self.issue_tracker_button = row_returns[1] self.plot_design_button_layout.addWidget(self.issue_tracker_button)