-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
feat(ui): show stems for extension-less files #899
base: main
Are you sure you want to change the base?
Conversation
Functions fine on windows but on shutdown it throws this error 2025-04-02 01:02:26 [error ] [Preview Panel] Error updating selection error=AttributeError("'NoneType' object has no attribute 'suffix'")
Traceback (most recent call last):
File "C:\dev\TagStudio\src\tagstudio\qt\widgets\preview_panel.py", line 136, in update_widgets
self.file_attrs.update_stats()
File "C:\dev\TagStudio\src\tagstudio\qt\widgets\preview\file_attributes.py", line 135, in update_stats
ext = filepath.suffix.lower()
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'suffix' |
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.
Just two nits and the error that zfbx observed, otherwise looks good.
self.switch_preview("image") | ||
|
||
image: Image.Image | None = None | ||
|
||
if MediaCategories.is_ext_in_category( | ||
ext, MediaCategories.IMAGE_RAW_TYPES, mime_fallback=True | ||
filepath.suffix.lower(), MediaCategories.IMAGE_RAW_TYPES, mime_fallback=True |
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.
Shouldn't this use ext
instead of recomputing the same value?
self.update_thumb(timestamp, image=image), | ||
self.update_size(timestamp, size=size), | ||
self.set_filename_text(filename), | ||
self.set_extension(ext), # type: ignore | ||
self.set_extension(filename), # type: ignore |
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.
Why is this ignore comment necessary? Removing this doesn't trigger any warning for me locally
Summary
This PR displays file stems in place of extensions for extension-less filenames inside item thumbnails and the preview panel. The prior behavior was to show no label if there was no extension, which made browsing these extension-less files difficult.


Note: Yes, this example shows several filetypes that should normally be excluded from TagStudio libraries. That is not related to this PR.
Tasks Completed