-
Notifications
You must be signed in to change notification settings - Fork 157
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
Drag-and-Drop Failures #3876
Comments
@tbpassin Thanks for your offer to fix this issue. |
…n helper functions. Fixes Issue leo-editor#3876
After fixing the code so that Leo outlines can be drag-and-dropped, non-Leo files still failed. Their at-file nodes were created but the body wasn't populated. This turns out to be a problem in
The problem is that even if - as in our case - the arg fromString is a non-empty string, then file_s es None and so False is returned. But before this, Therefore
This change allows the contents of the external file to be placed into the new body node - which is what we want - and should either have no effect for any other use of `at.read()', or even fix similar bugs for other uses of the method. If this is acceptable I will go ahead and add this change to my PR. |
@tbpassin I agree with your analysis, but not your fix. A cff shows that only if fromString: # pragma: no cover
if is_at_shadow: # pragma: no cover
at.error('can not call at.read from string for @shadow files')
return None, None
at.initReadLine(fromString)
return None, fromString # #3876. What do you think? I would be happy to create a new PR for this single change. |
I would be happy with this change. I will test it and add it to my open PR, since the changes in that PR have to happen anyway. |
@tbpassin Alright, I'll leave the PR to you. Thanks! |
Dragging and dropping files from the desktop or file manager onto an open Leo outline fails. A typical error message reads
This seems to be the result of an effort to correct a possible Qt bug from 2014. That bug in QUrl doesn't exist in current Qt6 implementations.
The problem is in qt_frame.py, in the method
LeoQTreeWidget.urlDrop & helpers
. I will submit a PR with fixes.More specifically, the code receives a QUrl from the drop event. The QUrl will contain a scheme, and Leo's code checks whether the scheme is file or http. The existing code converts the QUrl to a string and then tries to call
.scheme()
on it, which of course fails, sincescheme()
is a method of a QUrl, not of a string. Also, most URLs one would drag from a browser are https, not http, so the code needs to look for them too.Helper methods expect a string, not a QUrl, so the QUrl object can't be passed directly to them.
These are all easy to fix.
The text was updated successfully, but these errors were encountered: