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

fix: do not share the Expr for text_color and background_color #400

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

maartenbreddels
Copy link
Member

Every TextRenderer shares the same Expr (by default). This means that if I create two text renderers, and change the expression on one, it also changes the expression in the other TextRenderer.e.g.

tr1 = TextRenderer()
tr2 = TextRenderer()
tr1.text_color.value = "'red'"
# now tr2.text_color.value is also red, bad UX I think

I think this should behave analogous to say a .layout widget, where they are not shared.

To be honest, this is not the original reason to create this PR. In solara, we cannot have widgets created at import time, since each user would share the same widget, which breaks ipydatagrid in solara.

I hope one of the two reasons is compelling enough :)

@maartenbreddels
Copy link
Member Author

Originally introduced in #35 by @martinRenou

Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Thanks!

ipydatagrid/cellrenderer.py Outdated Show resolved Hide resolved
ipydatagrid/cellrenderer.py Outdated Show resolved Hide resolved
@martinRenou
Copy link
Member

The commit I made from the Github interface has not been signed off, sorry for that! You will probably need to edit that commit (maybe you can also squash all commits into a single signed off one)

@maartenbreddels
Copy link
Member Author

ok, squashed them, but needs you approval again :)

@maartenbreddels
Copy link
Member Author

Looks like this collides with this https://github.com/jupyter-widgets/ipywidgets/pull/3358/files
I think we should open a separate PR and fix main/master first. What do you think @martinRenou ?

@martinRenou
Copy link
Member

It's odd that we did not hit that before. PRs were green a couple of weeks ago. Thanks for the pointer! I agree we should probably fix master first.

Signed-off-by: Maarten A. Breddels <maartenbreddels@gmail.com>
Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants