Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Add disclaimer to the extension manager #5361

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/ansys/aedt/core/workflows/installer/extension_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading