Fix text and RAW image handling

- 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
This commit is contained in:
Travis Abendshien
2024-05-31 19:25:53 -07:00
parent e463635cc0
commit 34f347bf55
2 changed files with 3 additions and 2 deletions

View File

@@ -207,4 +207,4 @@ TAG_COLORS = [
]
TAG_FAVORITE = 1
TAG_ARCHIVED = 0
TAG_ARCHIVED = 0

View File

@@ -569,6 +569,7 @@ class PreviewPanel(QWidget):
font = ImageFont.truetype(filepath)
self.dimensions_label.setText(
f"{filepath.suffix.upper()[1:]}{format_size(filepath.stat().st_size)}\n{font.getname()[0]} ({font.getname()[1]}) "
)
else:
self.dimensions_label.setText(
@@ -784,7 +785,7 @@ class PreviewPanel(QWidget):
"""
if self.is_connected:
self.tags_updated.disconnect()
logging.info("[UPDATE CONTAINER] Setting tags updated slot")
self.tags_updated.connect(slot)
self.is_connected = True