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

Get drop information out from windowview #3378

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

EmberLightVFX
Copy link

This is my WIP PR for issue #3372
Right now all it does is allow you to drag and drop files into the webview and it will print out the path to the file from the main thread.

The issue I'm still having is how to access the running nicegui instance on the main thread as currently the check for droped files happens in a separate thread that's running from the main thread (not multiprocessing).

Are there any other way for me to check the drop_queue from within the main thread and from there create an event that could be picked up like ui.on("drop", my_func)?

@EmberLightVFX
Copy link
Author

Got it working!!!
I had to create a new widget to fetch the file drop. The positive with this is that you have have multiple drop-locations.

2024-07-22_23-18-15.mp4

There are two problems still tho that I would love to get some help with.

  1. Closing the native window doesn't close the listening thread I'm running
  2. When auto-reload is enabled this doesn't work. I think it's because the extra subprocess that gets created and information goes to the wrong process.

I'll post the data tomorrow as it's quite late here 😄

@EmberLightVFX
Copy link
Author

Added all files to make the drag and drop working and included a _example.py in the root dir for you to try it out.
I have added a new element called drop_zone. It's just a wrapper like row or column and the user needs to fill the content of the drop zone.
When a file or folder is being draged over the zone the class dragover will get added so the user can change the style of the zone.

Drop zone does still not work with refresh=True as drop_queue.put(file.get('pywebviewFullPath')) (in the native_mode.py file) gets applied on the refresh-thread and not the thread the user is interacting on. I don't know how to really solve this...
But I got the closing working!

@falkoschindler
Copy link
Contributor

Thanks for the pull request, @EmberLightVFX!
Unfortunately, we haven't found the time to look into it yet. We're currently focusing on the release of version 2.0 and other pressing matters. So we hope you find a way to fix the remaining issues with the implementation. Maybe someone from the community can jump in and assist?

@falkoschindler falkoschindler added the help wanted Extra attention is needed label Aug 19, 2024
@EmberLightVFX
Copy link
Author

No worries! I know you're busy with other stuff :) I haven't had much time myself to look into the problems but when I get some time I'll do my best. Any community help is highly appreciated tho!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants