Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#1248-cover-json-data-node-contro…
Browse files Browse the repository at this point in the history
…l-new
  • Loading branch information
FredLL-Avaiga authored Nov 9, 2024
2 parents b82cd00 + 0189737 commit 6e47af1
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ body:
attributes:
label: "Steps to Reproduce Issue"
description: If possible, please share the steps to reproduce the issue.
value: |
placeholder: |
1. A code fragment
2. And/or configuration files or code
3. And/or Taipy GUI Markdown or HTML files
Expand All @@ -50,8 +50,7 @@ body:
attributes:
label: "Screenshots"
description: If applicable, add screenshots to help explain your problem.
value: |
![DESCRIPTION](LINK.png)
placeholder: ![DESCRIPTION](LINK.png)
validations:
required: false

Expand Down
18 changes: 1 addition & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
</picture>
</a>
</div>

<br>
</br>
<div align="center">
<img
src="https://img.shields.io/github/license/Avaiga/taipy?style=plastic&color=ff371a&labelColor=1f1f1f"
Expand All @@ -21,16 +20,13 @@
src="https://img.shields.io/github/v/release/Avaiga/taipy?display_name=release&style=plastic&color=ff371a&labelColor=1f1f1f"
></a>
</div>
<br>
<div align="center">
<img
src="https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-ff371a?style=plastic&labelColor=1f1f1f"
alt="Python version needed: 3.9"
/>

</div>
<br>

<div align="center">
<a target="_blank" href="https://docs.taipy.io/en/latest/">
<img
Expand All @@ -51,8 +47,6 @@
alt="Discord support"
></a>
</div>
<br>

<h1 align="center">
Build Python Data & AI web applications
</h1>
Expand All @@ -68,16 +62,6 @@ No more compromises on performance, customization, and scalability.
<strong> Go beyond existing libraries </strong>
</div>

<p align="center"><h4>
<br />
<a href="https://docs.taipy.io/en/latest/"><strong>📚 Explore the Docs </strong></a>
<br />
<a href="https://discord.com/invite/SJyz2VJGxV"><strong> 🫱🏼‍🫲🏼 Discord Support </strong></a>
<br />
<a href="https://docs.taipy.io/en/latest/gallery/"><strong> 👀 Demos & Examples </strong></a>
</h4>
</p>

## Table of Contents

- [What's Taipy?](#%EF%B8%8F-whats-taipy)
Expand Down
1 change: 1 addition & 0 deletions doc/gui/examples/blocks/layout_fit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file makes this directory a module on its own, mandatory for mypy.
27 changes: 27 additions & 0 deletions doc/gui/examples/blocks/layout_fit/builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# -----------------------------------------------------------------------------------------
# To execute this script, make sure that the taipy-gui package is installed in your
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
import taipy.gui.builder as tgb
from taipy.gui import Gui

with tgb.Page() as page:
with tgb.layout("max-content max-content"): # type: ignore[attr-defined]
with tgb.part("card"): # type: ignore[attr-defined]
tgb.text("France") # type: ignore[attr-defined]
with tgb.part("card"): # type: ignore[attr-defined]
tgb.text("United States of America") # type: ignore[attr-defined]

if __name__ == "__main__":
Gui(page).run(title="Layout - Fit to content")
33 changes: 33 additions & 0 deletions doc/gui/examples/blocks/layout_fit/markdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# -----------------------------------------------------------------------------------------
# To execute this script, make sure that the taipy-gui package is installed in your
# Python environment and run:
# python <script>
# -----------------------------------------------------------------------------------------
from taipy.gui import Gui

page = """
<|layout|columns=max-content max-content|
<|card|part|
France
|>
<|card|part|
United States of America
|>
|>
"""

if __name__ == "__main__":
Gui(page).run(title="Layout - Fit to content")
1 change: 1 addition & 0 deletions frontend/taipy/src/ScenarioViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ const ScenarioViewer = (props: ScenarioViewerProps) => {
{ action: props.onDelete, error_id: getUpdateVar(updateScVars, "error_id") },
undefined,
undefined,
undefined,
true,
true,
{ id: scId }
Expand Down
58 changes: 58 additions & 0 deletions tests/gui_core/test_context_crud_scenario.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

import typing as t
from unittest.mock import Mock, patch

from taipy.common.config.common.scope import Scope
from taipy.core import DataNode, Scenario
from taipy.core.data.pickle import PickleDataNode
from taipy.gui.mock.mock_state import MockState
from taipy.gui_core._context import _GuiCoreContext

scenario_a = Scenario("scenario_a_config_id", None, {"a_prop": "a"})
scenario_b = Scenario("scenario_b_config_id", None, {"a_prop": "b"})
scenarios: t.List[t.Union[t.List, Scenario, None]] = [scenario_a, scenario_b]


datanode_a = PickleDataNode("datanode_a_config_id", Scope.SCENARIO)
datanode_b = PickleDataNode("datanode_b_config_id", Scope.SCENARIO)
datanodes: t.List[t.Union[t.List, DataNode, None]] = [datanode_a, datanode_b]


def mock_core_get(entity_id):
if entity_id == datanode_a.id:
return datanode_a
if entity_id == datanode_b.id:
return datanode_b
return None

def mock_is_true(entity_id):
return True

class TestGuiCoreContext_crud_scenario:
def test_crud_scenario_delete(self):
gui_core_context = _GuiCoreContext(Mock())
state = MockState(Mock())

mock_core_delete = Mock()

with (
patch("taipy.gui_core._context.core_get", side_effect=mock_core_get),
patch("taipy.gui_core._context.is_deletable", side_effect=mock_is_true),
patch("taipy.gui_core._context.core_delete", side_effect=mock_core_delete)
):
gui_core_context.crud_scenario(
state,
"id",
t.cast(dict, {"args": [None, None, None, True, True, {"id": "a_scenario_id"}], "error_id": "error_id"}),
)
mock_core_delete.assert_called_once()

0 comments on commit 6e47af1

Please sign in to comment.