-
Notifications
You must be signed in to change notification settings - Fork 3.2k
qt: add qr reading from file to ScanQRTextEdit and SendTab #9782
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
base: master
Are you sure you want to change the base?
Conversation
Nothing wrong with the code per se, but it doesn't find a QR code in my testing (screenshot saved as png from spectacle, which itself detects a QR code) |
Yeah, your screenshots work fine here too |
f04a60a
to
f00f62e
Compare
The zbar library we use here for detecting the qr codes doesn't seem to like dense qr codes that are a large portion of the image. So i added a function |
electrum/gui/qt/qrreader/__init__.py
Outdated
new_width = image.width() * 2 | ||
new_height = image.height() * 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can really get large. Maybe + 200
suffices, as you offset the source image (100,100) below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah right, + 200 didn't work, but instead i changed the function to make the passed image a smaller part of a new (white) image with the same size, this is faster too and seems as reliable. I also removed the offset as it could happen to cut parts of the original image if it is very small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead i changed the function to make the passed image a smaller part of a new (white) image with the same size, this is faster too and seems as reliable.
That's.. unexpected :)
f00f62e
to
0a789e3
Compare
There was no ability to read qr codes contained in image files. This could lead to confusion in some contexts, as `on_file_input()` of ScanQRTextEdit will read the whole content of the file (instead of looking for qr codes). The revealer plugin for example generates png files containing qr codes and uses the `ScanQRTextEdit` to get user input, for the user it would seem logical to click on 'Read from file' to load the generated file, however this will result in the wrong data being loaded. Having the option to explicitly load a QR from file makes this clear. Also it seems useful, especially considering reading QR from screenshots doesn't work on wayland.
0a789e3
to
63c224c
Compare
There was no ability to read qr codes contained in image files. This is confusing in some contexts, as
on_file_input()
of ScanQRTextEdit will read the whole content of the file (instead of looking for qr codes).The revealer plugin for example generates png files containing qr codes and uses the
ScanQRTextEdit
to get user input, for the user it would seem logical to click on 'Read from file' to load the generated file, however this will result in the wrong data getting loaded. Having the option to explicitly load a QR from file makes this clear.Besides that it seems useful, considering reading QR from screenshots doesn't work on wayland.