Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
15.44k stars 1.86k forks source link

Page modules: support for class variables #462

Open FabienLelaquais opened 1 year ago

FabienLelaquais commented 1 year ago

Description

As of now (and Avaiga/taipy-gui#690), only instance variables can be reached by page definitions. Class variables are simply ignored.

Now in Python, a class variable really is a syntactic trick to define a global variable. You must know what class it is defined in to reach it, that's all.

It would be great to have Taipy GUI pages able to access class variables, and the broadcast mechanism applied to these so that they appear as global variables... in the scope of a given page, defined by a page module.


class MyPage(Page):
    shared_var = 0

    def __init__(self):
        self.var = 0
        super().__init__()

    def create_page(self):
        return Markdown("""
<|{var}|slider|>

<|{shared_var}|slider|>
""")
would work.

All clients would have their own value for the first slider, but moving the second one should update all clients.

**Acceptance Criteria**
- [ ] Ensure new code is unit tested, and check code coverage is at least 90%
- [ ] Ensure any change is well documented
someshfengde commented 1 month ago

Hi @jrobinAV can you please assign this issue to me?

jrobinAV commented 1 month ago

@someshfengde Thank you for your help.

quest-bot[bot] commented 1 month ago

New Quest! image New Quest!

A new Quest has been launched in @Avaiga’s repo. Merge a PR that solves this issue to loot the Quest and earn your reward.


Some loot has been stashed in this issue to reward the solver!

🗡 Comment @quest-bot embark to check-in for this Quest and start solving the issue. Other solvers will be notified!

⚔️ When you submit a PR, comment @quest-bot loot #462 to link your PR to this Quest.

Questions? Check out the docs.

github-actions[bot] commented 4 weeks ago

This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.

Dkingofcode commented 3 weeks ago

Hi @jrobinAV i would like to work on this issue. Although I am still a beginner in python it seems interesting, please i would like to ask if i can be given any resources that could be of help in solving this issue.

github-actions[bot] commented 1 week ago

This issue has been labelled as "🥶Waiting for contributor" because it has been inactive for more than 14 days. If you would like to continue working on this issue, please add another comment or create a PR that links to this issue. If a PR has already been created which refers to this issue, then you should explicitly mention this issue in the relevant PR. Otherwise, you will be unassigned in 14 days. For more information please refer to the contributing guidelines.