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

feat(ui): show stems for extension-less files #899

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CyanVoxel
Copy link
Member

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.
image
image
Note: Yes, this example shows several filetypes that should normally be excluded from TagStudio libraries. That is not related to this PR.

Tasks Completed

  • Platforms Tested:
    • Windows x86
    • Windows ARM
    • macOS x86
    • macOS ARM
    • Linux x86
    • Linux ARM
  • Tested For:
    • Basic functionality
    • PyInstaller executable

@CyanVoxel CyanVoxel added Type: Enhancement New feature or request Type: UI/UX User interface and/or user experience Priority: Medium An issue that shouldn't be be saved for last Status: Review Needed A review of this is needed labels Mar 31, 2025
@CyanVoxel CyanVoxel added this to the Alpha v9.5.2 milestone Mar 31, 2025
@CyanVoxel CyanVoxel marked this pull request as ready for review March 31, 2025 05:57
@CyanVoxel CyanVoxel moved this to 🏓 Ready for Review in TagStudio Development Mar 31, 2025
@CyanVoxel CyanVoxel modified the milestones: Alpha v9.5.2, Alpha v9.5.3 Mar 31, 2025
@zfbx
Copy link
Contributor

zfbx commented Apr 2, 2025

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'

Copy link
Collaborator

@Computerdores Computerdores left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium An issue that shouldn't be be saved for last Status: Review Needed A review of this is needed Type: Enhancement New feature or request Type: UI/UX User interface and/or user experience
Projects
Status: 🏓 Ready for Review
Development

Successfully merging this pull request may close these issues.

3 participants