From d76fdc6396e827bd57706c0dd1866f698ea8ce59 Mon Sep 17 00:00:00 2001 From: Sebastien Morais Date: Wed, 30 Oct 2024 10:05:35 +0100 Subject: [PATCH 1/2] FEAT: Add disclaimer to extension manager --- .../workflows/installer/extension_manager.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/ansys/aedt/core/workflows/installer/extension_manager.py b/src/ansys/aedt/core/workflows/installer/extension_manager.py index 1c2265549a5..b57565df6e9 100644 --- a/src/ansys/aedt/core/workflows/installer/extension_manager.py +++ b/src/ansys/aedt/core/workflows/installer/extension_manager.py @@ -313,6 +313,36 @@ def button_is_clicked( desktop.release_desktop(False, False) +def close_widget(widget): + """Close specific widget.""" + widget.destroy() + + +def create_disclaimer_window(root: tk.Tk): + """Notify users about extra packages.""" + DISCLAIMER = ( + "The extension manager will download and install certain third-party software and/or " + "open-source software (collectively, 'Third-Party Software'). Such Third-Party " + "Software is subject to separate terms and conditions and not the terms of your " + "Ansys software license agreement. Ansys does not warrant or support such " + "Third-Party Software. Do you still wish to proceed?" + ) + + disclaimer_window = tk.Toplevel(root) + disclaimer_window.title("Disclaimer") + disclaimer_window.grab_set() + disclaimer_window.protocol("WM_DELETE_WINDOW", lambda: None) + disclaimer_window.transient(root) + label = tk.Label(disclaimer_window, text=DISCLAIMER, wraplength=275) + label.pack() + yes_button = tk.Button(disclaimer_window, text="Yes", command=lambda: close_widget(disclaimer_window)) + yes_button.pack(side=tk.LEFT, padx=50, pady=10) + no_button = tk.Button(disclaimer_window, text="No", command=lambda: close_widget(root)) + no_button.pack(side=tk.RIGHT, padx=50, pady=10) + + return disclaimer_window + + root = tk.Tk() root.title("Extension Manager") @@ -355,6 +385,9 @@ def button_is_clicked( root.geometry(f"{window_width}x{window_height}+{x_position}+{y_position}") +disclaimer_window = create_disclaimer_window(root) +disclaimer_window.geometry("300x170+{}+{}".format(x_position + 110, y_position + 45)) + # Create buttons in a 4x4 grid, centered for i, level in enumerate(toolkit_levels): row_num = i // 4 From 03ba1a6b14fa45c282c6ccd58102c468b66d067a Mon Sep 17 00:00:00 2001 From: Sebastien Morais Date: Wed, 30 Oct 2024 10:06:13 +0100 Subject: [PATCH 2/2] FIX: Wrong path to import --- .../core/workflows/templates/run_pyaedt_toolkit_script.py_build | 2 +- .../workflows/templates/run_pyaedt_toolkit_script.py_build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/aedt/core/workflows/templates/run_pyaedt_toolkit_script.py_build b/src/ansys/aedt/core/workflows/templates/run_pyaedt_toolkit_script.py_build index aa624beffdc..56216d02a61 100644 --- a/src/ansys/aedt/core/workflows/templates/run_pyaedt_toolkit_script.py_build +++ b/src/ansys/aedt/core/workflows/templates/run_pyaedt_toolkit_script.py_build @@ -34,7 +34,7 @@ is_linux = os.name == "posix" if is_linux: import subprocessdotnet as subprocess -toolkits_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +toolkits_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(toolkits_dir) diff --git a/src/pyaedt/workflows/templates/run_pyaedt_toolkit_script.py_build b/src/pyaedt/workflows/templates/run_pyaedt_toolkit_script.py_build index 355709a26cc..f50eca4b911 100644 --- a/src/pyaedt/workflows/templates/run_pyaedt_toolkit_script.py_build +++ b/src/pyaedt/workflows/templates/run_pyaedt_toolkit_script.py_build @@ -34,7 +34,7 @@ is_linux = os.name == "posix" if is_linux: import subprocessdotnet as subprocess -toolkits_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) +toolkits_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(toolkits_dir)