-
Notifications
You must be signed in to change notification settings - Fork 69
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
Need stronger ui.hold()-like context manager for non-UI objects #1083
Comments
We could also have a more imperative "echo on/off" type of function. ui.echo(False)
# Do lots of non-UI stuff
ui.echo(True) You wouldn't even have to wrap it in try/finally, instead you could say that if there is an enclosing UI context manager (like The nice thing about this approach is not having to indent the non-UI stuff. There's a good chance this is a terrible idea and I'm not thinking clearly about it, it's pretty late. |
The specific problem with Or another alternative: the objects get put in a subclass of list, like |
Another thought that I had was that perhaps def page_auto_cm(
*,
filter: Callable[[object], bool] | None = None,
) -> RecallContextManager[Tag]:
return RecallContextManager(
ui.page_auto,
filter=filter,
) Where the And then the default (Even with this, there would still be the issue of |
|
We need another context manager, maybe
ui.discard()
, to prevent Shiny Express from trying to interpret non-UI objects as UI. Or, perhaps Shiny Express should not be so strict about what kinds of objects are allowed to be displayhooked (no-op instead of error).For now the best workaround I can think of is to turn such lines into dummy assignment statements, like
_ = a.set_option("host", "localhost")
, but that is not very satisfying.The text was updated successfully, but these errors were encountered: