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

add read_image api to ui.clipboard #4144

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

liunux4odoo
Copy link

make it easy to read copied image from client clipboard.

Copy link
Contributor

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request, @liunux4odoo!

To be honest, I don't understand how to use this feature. How can I copy an image to the clipboard? Whatever I try, your demo says I need to copy an image first.

Apart from that, there are some problems with this implementation:

  1. We can't simply break existing API by renaming read and write. I suggest to leave them unchanged while adding read_image.
  2. The demo doesn't work for two reasons:
    1. The call to ui.clipboard.read_image() needs to be awaited.
    2. Awaiting a JavaScript command isn't allowed on the auto-index client, so the demo needs to be wrapped in a page function. But in order for the demo to keep working when embedded on the NiceGUI website, we need to prevent the decorator from adding a new route. Here is an example how to do that.

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