Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/ansys-sphinx-theme-0.16.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Revathyvenugopal162 authored Jul 25, 2024
2 parents 43d15cb + 0d05b46 commit 2b40c62
Show file tree
Hide file tree
Showing 8 changed files with 455 additions and 374 deletions.
1 change: 1 addition & 0 deletions doc/changelog.d/495.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: updating poetry.lock before local wheels are used in solution template
1 change: 1 addition & 0 deletions doc/changelog.d/498.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace AWC Tree by Dash Tree in the default UI mode of the solution template

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ python = ">=3.8.1, <3.11"
ansys-saf-portal = {version = "1.0.1", source = "solutions-private-pypi"}
ansys-saf-desktop = {version = "1.1.1", source = "solutions-private-pypi"}
{% if cookiecutter.dash_ui == "default" %}
ansys-web-components-dash = {version = ">=0.0.dev4", source = "solutions-private-pypi"}
ansys-solutions-dash-lib = {version = "^0.4", source = "solutions-private-pypi"}
ansys-solutions-dash-super-components = {version = "^0.1.dev0", python = ">=3.9,<3.11"}
dash = "^2.6"
dash_bootstrap_components = "^1.2"
dash-extensions = ">=0.1.13"
Expand All @@ -54,7 +53,7 @@ dash-mantine-components = "^0.12.1"
dash-uploader = "^0.6"
{% elif cookiecutter.dash_ui == "awc" %}
ansys-web-components-dash = {version = ">=0.0.dev4", source = "solutions-private-pypi"}
ansys-solutions-dash-lib = {version = "^0.4", source = "solutions-private-pypi"}
ansys-solutions-dash-super-components = {version = "^0.1.dev0", python = ">=3.9,<3.11"}
dash = "^2.6"
dash_bootstrap_components = "^1.2"
dash-uploader = "^0.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,23 @@ def clear_workspace(args: object) -> None:
print()


def update_lock_file_to_consider_local_wheels(args: object) -> None:
"""Specify in the poetry.lock file that some packages come from a local wheel file."""
if not args.local_wheels:
return

print("Adapting lock file to consider local wheels.")
subprocess.run(
[
DEPENDENCY_MANAGER_PATHS[sys.platform]["build_sys_exec"],
"lock",
"--no-update",
],
check=True,
shell=DEPENDENCY_MANAGER_PATHS[sys.platform]["shell"],
)


def install_production_dependencies(args: object) -> None:
"""Install the package (mandatory requirements only)."""
print("Install production dependencies")
Expand Down Expand Up @@ -1027,6 +1044,8 @@ def main() -> None:

print_section_header("Install dependencies", max_length=100)

update_lock_file_to_consider_local_wheels(args)

install_production_dependencies(args)

install_optional_dependencies(args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ class {{ cookiecutter.__solution_definition_name }}(Solution):
"""Solution definition."""

display_name: str = "{{ cookiecutter.solution_display_name.replace('"', '') }}"
version: int = 1
steps: Steps
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


from ansys.saf.glow.client.dashclient import DashClient, callback
from ansys.solutions.dash_components.table import InputRow, OutputRow
from ansys.solutions.dash_super_components import InputRow, OutputRow
from dash_extensions.enrich import Input, Output, State, dcc, html
from dash_iconify import DashIconify
import dash_mantine_components as dmc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"""Initialization of the frontend layout across all the steps."""


import json
import webbrowser

from ansys.saf.glow.client.dashclient import DashClient, callback
from ansys_web_components_dash import Tree
from ansys.solutions.dash_super_components import Tree
from dash.exceptions import PreventUpdate
import dash_bootstrap_components as dbc
from dash_extensions.enrich import Input, Output, callback_context, dcc, html
Expand All @@ -20,19 +21,19 @@
{
"id": "about_page",
"text": "About",
"prefixIcon": {"src": "https://s2.svgbox.net/hero-solid.svg?ic=home"},
"prefixIcon": "material-symbols:home",
"expanded": True,
},
{
"id": "first_page",
"text": "First Step",
"prefixIcon": {"src": "https://s2.svgbox.net/materialui.svg?ic=label"},
"prefixIcon": "game-icons:crossed-air-flows",
"expanded": True,
},
{
"id": "second_page",
"text": "Second Step",
"prefixIcon": {"src": "https://s2.svgbox.net/materialui.svg?ic=label_outline"},
"prefixIcon": "carbon:ibm-engineering-workflow-mgmt",
"expanded": True,
},
]
Expand Down Expand Up @@ -107,11 +108,9 @@
dmc.Space(h=10),
dbc.Row(
Tree(
id="navigation_tree",
multi=False,
height=250,
aio_id="navigation_tree",
items=step_list,
selectedItemIds=["about_page"],
active_item_id="about_page",
)
),
],
Expand Down Expand Up @@ -180,31 +179,27 @@ def access_dev_guide_documentation(n_clicks):


@callback(
Output("navigation_tree", "focusRequested"),
Output("page-content", "children"),
[
Input("url", "pathname"),
Input("navigation_tree", "treeItemClicked"),
],
Input("url", "pathname"),
Input(Tree.ids.selected_item("navigation_tree"), "data"),
prevent_initial_call=True,
)
def display_page(pathname, value):
"""Display page content."""
project = DashClient[{{ cookiecutter.__solution_definition_name }}].get_project(pathname)
triggered_id = callback_context.triggered[0]["prop_id"].split(".")[0]
focusRequested = ""
if triggered_id == "url":
return "", about_page.layout()
if triggered_id == "navigation_tree":
if value["id"] is None:
page_layout = html.H1("Welcome!")
elif value["id"] == "about_page":
focusRequested = "about_page"
page_layout = about_page.layout()
elif value["id"] == "first_page":
focusRequested = "first_page"
page_layout = first_page.layout(project.steps.first_step)
elif value["id"] == "second_page":
focusRequested = "second_page"
page_layout = second_page.layout(project.steps.second_step)
return focusRequested, page_layout
return about_page.layout()
else:
triggered_id = json.loads(triggered_id)
if isinstance(triggered_id, dict):
if triggered_id["aio_id"] == "navigation_tree":
if value["index"] == "about_page":
return about_page.layout()
elif value["index"] == "first_page":
return first_page.layout(project.steps.first_step)
elif value["index"] == "second_page":
return second_page.layout(project.steps.second_step)
else:
raise ValueError(f"Unknown page selection: {value['index']}")
raise PreventUpdate

0 comments on commit 2b40c62

Please sign in to comment.