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

handle icons for status #2264

Merged
merged 5 commits into from
Nov 20, 2024
Merged

handle icons for status #2264

merged 5 commits into from
Nov 20, 2024

Conversation

FredLL-Avaiga
Copy link
Member

@FredLL-Avaiga FredLL-Avaiga commented Nov 20, 2024

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Simplify the work done in the hacktoberfest PR

only new property is icons: Union[bool, list[str]]

if false, no icons,
if true: pre-defined icons
if list, for each element:

  • true: predefined icon
  • false: no icon
  • string: try to use as SVG URL (ends with .svg) or SVG string (starts with <svg )

Related Tickets & Documents

How to reproduce the issue

from taipy.gui import Gui

status = [
    ("warning", "Task is launched."),
    ("warning", "Taks is waiting."),
    ("error", "Task timeout."),
    ("success", "Task Succeded"),
    ("info", "Process was cancelled.")
]

page = """
<|{status}|status|>
<|{status}|status|icons|>
<|{status}|status|icons=https://www.svgrepo.com/show/530594/pants.svg;https://www.svgrepo.com/show/530595/hotel.svg;https://www.svgrepo.com/show/530596/diving-goggles.svg;https://www.svgrepo.com/show/530597/hat.svg|>
<|{status}|status|icons=https://www.svgrepo.com/show/530594/pants.svg;false;true;<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><circle cx='12' cy='12' r='10' fill='red'/></svg>|>
"""

if __name__ == "__main__":
  Gui(page).run(title="1157 Status with icons")

Checklist

  • Does this solution meet the acceptance criteria of the related issue?
  • Is the related issue checklist completed?
  • Does this PR adds unit tests for the developed code? If not, why?
  • End-to-End tests have been added or updated?
  • Was the documentation updated, or a dedicated issue for documentation created? (If applicable)
  • Is the release notes updated? (If applicable)

@FredLL-Avaiga FredLL-Avaiga added 📈 Improvement Improvement of a feature. 🖰 GUI Related to GUI 🟨 Priority: Medium Not blocking but should be addressed 📝Release Notes Impacts the Release Notes or the Documentation in general labels Nov 20, 2024
@FredLL-Avaiga FredLL-Avaiga self-assigned this Nov 20, 2024
Copy link
Contributor

github-actions bot commented Nov 20, 2024

Coverage report for ./frontend/taipy

Caution

Coverage does not meet threshold
Statements coverage not met for global: expected >=80%, but got 52.07920792079208%

St.
Category Percentage Covered / Total
🔴 Statements 52.08% 263/505
🔴 Branches 21.75% 67/308
🔴 Functions 14.66% 17/116
🔴 Lines 53.42% 242/453

Test suite run success

7 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from 52cfbb4

Copy link
Contributor

github-actions bot commented Nov 20, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
19331 16806 87% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
taipy/gui/_renderers/builder.py 83% 🟢
taipy/gui/_renderers/factory.py 96% 🟢
TOTAL 89% 🟢

updated for commit: 52cfbb4 by action🐍

Copy link
Member

@FabienLelaquais FabienLelaquais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please:

  • replace 'icons' -> 'use_icon'
  • Make this property indexed:
    use_icon[warning] = True
    use_icon[e]=<inline_svg>|URL

Copy link
Member

@dinhlongviolin1 dinhlongviolin1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good to me!

Copy link
Member

@FabienLelaquais FabienLelaquais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All examples should have the same header, potentially with a few line of specific information for that code.
See doc/gui/examples/broadcast_callback.py for example...

@FredLL-Avaiga FredLL-Avaiga merged commit 97cfb57 into develop Nov 20, 2024
135 checks passed
@FredLL-Avaiga FredLL-Avaiga deleted the feature/status-with-icons branch November 20, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖰 GUI Related to GUI 📈 Improvement Improvement of a feature. 🟨 Priority: Medium Not blocking but should be addressed 📝Release Notes Impacts the Release Notes or the Documentation in general
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants