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

List files synchronously #12

Open
JezerM opened this issue Oct 13, 2021 · 2 comments
Open

List files synchronously #12

JezerM opened this issue Oct 13, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@JezerM
Copy link
Owner

JezerM commented Oct 13, 2021

Environment

  • OS: Ubuntu 21.04
  • web-greeter version: 3.1.0

Description of feature

Currently, the only way to list files is with theme_utils.dirlist, which works asynchronously: it's needed to pass a function that resolves the list of files. This is sometimes frustrating, as you would need to make things asynchronous when working on backgrounds.

So, a funnction like theme_utils.dirlist_sync would be helpful to block all the webpage and wait for the result.

Possible solutions

nody-greeter has actually solved this problem, thanks to Electron's IPC capacity to send messages both sync and async. QtWebEngine and QtWebChannel works only in an asynchronous way, so based on some research, there's no know method to make a synchronous call between the webpage and web-greeter.

I'll need to make a further research.

@JezerM JezerM added the enhancement New feature or request label Oct 13, 2021
@JezerM
Copy link
Owner Author

JezerM commented Dec 27, 2021

After a long research, it seems impossible :c

Thought about modifying qwebchannel.js to send a "block" message to web-greeter and block the webpage thread after calling a QObject method in the javascript side. Then, do all related to the called function in python, update the properties (each method could have a "private" like property) and unblock the webpage thread. Finally, in the javascript side, qwebchannel.js could return the updated property without needing callbacks...

However, javascript is single threaded, so this solution would only work until the last step, because the properties update are needed to be handled by javascript itself. Therefore, qwebchannel.js would return an outdated value and then update the properties... it's not useful. Doing twice could create issues.

@JezerM
Copy link
Owner Author

JezerM commented Oct 17, 2022

I'm hating Qt5 xd

Considering to move to another framework.

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

No branches or pull requests

1 participant