-
Notifications
You must be signed in to change notification settings - Fork 386
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
SVG thumbnail renderer #442
Conversation
* Ability to drop local files in to TagStudio to add to library * Added renaming option to drop import * Improved readability and switched to pathLib * format * Apply suggestions from code review Co-authored-by: yed podtrzitko <[email protected]> * Revert Change * Update tagstudio/src/qt/modals/drop_import.py Co-authored-by: yed podtrzitko <[email protected]> * Added support for folders * formatting * Progress bars added * Added Ability to Drag out of window * f * format * Ability to drop local files in to TagStudio to add to library * Added renaming option to drop import * Improved readability and switched to pathLib * format * Apply suggestions from code review Co-authored-by: yed podtrzitko <[email protected]> * Revert Change * Update tagstudio/src/qt/modals/drop_import.py Co-authored-by: yed podtrzitko <[email protected]> * Added support for folders * formatting * Progress bars added * Added Ability to Drag out of window * f * format * format * formatting and refactor * format again * formatting for mypy * convert lambda to func for clarity * mypy fixes * fixed dragout only worked on selected * Refactor typo, Add license * Reformat QMessageBox * Disable drops when no library is open --------- Co-authored-by: yed podtrzitko <[email protected]> Co-authored-by: Travis Abendshien <[email protected]>
…oDev#289) * fix: python complaining about backslashes inside f-string expressions refactor excessively long f-string into separate variables * fix: missing f on f-string * Format with Ruff
* Update thumb_renderer.py Included support for rendering blender thumbnails * Add files via upload Add functions that get the thumbnail's data * Update thumb_renderer.py * Update blender_thumbnailer.py * Update thumb_renderer.py * Update thumb_renderer.py Changed where imports are according to feedback * Update thumb_renderer.py Changed blender thumbnail function name to reduce ambiguity * Update blender_thumbnailer.py Updated function name * Update blender_thumbnailer.py * Update blender_thumbnailer.py Ruff format * Update thumb_renderer.py Ruff format * Update constants.py Add .blend1, 2, 3 etc file support * Update blender_thumbnailer.py Refactor to follow requested changes * Update thumb_renderer.py More refactoring * Update blender_thumbnailer.py Ruff format * Update thumb_renderer.py Ruff format
* use list widget for selecting fields to add * fix(ui): allow list widget resizing
* Fixed merge conflicts * fixed format? * Improve readability (Apply suggestions from code review) Co-authored-by: yed podtrzitko <[email protected]> * bug fix: Copy last selected not first * Fix copy entanglement; Fix paste overwriting * Change multi-selection copy to merge data - Multi-selection copy now merges fields of all selected entries - Action states are now handled --------- Co-authored-by: yed podtrzitko <[email protected]> Co-authored-by: Travis Abendshien <[email protected]>
* Add font thumbnail preview support * Add multiple font sizes to thumbnail * Ruff reformat * Ruff reformat * Added Metadata to info * Change the way thumbnails are structured * Small performance improvement * changed Metadata display structure * added copyright notice to added file * fix(ui): dynamically scale font previews; add .woff2, .ttc --------- Co-authored-by: Travis Abendshien <[email protected]>
- Fix RAW images not being loaded correctly in the preview panel - Fix trying to read size data from null images - Refactor `os.stat` to `<Path object>.stat()` - Remove unnecessary upper/lower conversions - Improve encoding compatibility beyond UTF-8 when reading text files - Code cleanup
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.
Once comments are addressed I approve.
@CyanVoxel I wonder if a future change would make sense, add a context manager so that it handles the buildup and teardown of thumbnails. |
…#472) * fix(PreviewPanel): Use birthtime for creation time st_ctime does not provide accurate creation time on MacOS, and as of Python 3.12 is deprecated for Windows. On these two platforms use st_birthtime, but fall back to st_ctime on linux. * mypy errors
* fix(ThumbRenderer): Use audio icon when no ffmpeg When ffmpeg is missing, Popen raises a FileNotFound error. This would be caught as an Unlinked file and use the broken file icon. The exception is now caught and a more appropriate exception is raised in its place. * ruff formatting
The cutoff for how many files get sorted also changes to 150,000.
* fix(QtDriver): Retain filter on directory refresh * ruff formatting
* feat: increase file scanning performance * fix: correct typo in comment * refactor: use `continue` in place of nested `ifs`
nice work, but as always - when adding a new feature, please add a test. For this one having some sample from syrupy.extensions.image import PNGImageSnapshotExtension
def test_svg_to_png(snapshot):
file_path = Path(__file__).parent / "fixtures" / "sample.svg"
png_image = ThumbRenderer(...)._image_vector_thumb(file_path, 600)
assert png_image.read() == snapshot(extension_class=PNGImageSnapshotExtension) |
also what's the git branch |
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.
.
|
||
# Create an image to draw the svg to and a painter to do the drawing | ||
image: QImage = QImage(size, size, QImage.Format.Format_ARGB32) | ||
image.fill("#00000000") |
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 would make it a bit more readable:
image.fill("#00000000") | |
image.fill(Qt.transparent) |
image.save(buffer, "PNG") | ||
|
||
# Load the image from the buffer | ||
im: Image.Image = Image.open(BytesIO(buffer.data().data())) |
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.
im: Image.Image = Image.open(BytesIO(buffer.data().data())) | |
im: Image.Image = Image.open(BytesIO(buffer.data())) |
* feat: Warn user if FFmpeg is not installed Creates a Warning dialog on startup if the program cannot find FFmpeg or FFprobe in the PATH. Other interactions with the program are blocked until the issue is either ignore or resolved. * docs: Add FFmpeg installation guide * ruff formatting * chore: Cleanup missing logic and warning message * chore: Remove custom icon Per QT docs, handling custom iconPixmap requires multiple icons per platform. Easier to just use universal, default warning icon (yellow triangle) * fix: Ignore dialog with X button * fix: Move startup checks after CI * chore: Unreverse install check logic * doc: Improve docs formatting * docs: Point help url to new docs sites * Remove ffmpeg docs page * Use which from python stdlib
I'm moved this PR from the deprecated Sorry for the disruption, and thank you for your patience. |
* feat: add svg thumbnail support Co-Authored-By: Tyrannicodin <[email protected]> * flip `svg.isValid()` logic check * tests: add test comparing svg to png snapshot Co-Authored-By: yed <[email protected]> --------- Co-authored-by: Tyrannicodin <[email protected]> Co-authored-by: yed <[email protected]>
I've ported this functionality to |
Adds an SVG renderer for thumbnails using Qt's QSvgRenderer that writes to a QImage that is written onto a QBuffer that PIL can then read as an image.
However, it does have an issue that I have been unable to resolve: Sometimes thumbnails seem to write over each other or otherwise be corrupted (no affect on the actual files though). I think it's due to the QPainter painting in a thread, but I'm not sure.You can see an example of this problem below:
Image no longer relevant