Skip to content

Commit eba7c3e

Browse files
Andrew ArnesonAndrew Arneson
authored andcommitted
Merge remote-tracking branch 'upstream/main'
2 parents 89b1921 + f35d9c1 commit eba7c3e

37 files changed

Lines changed: 14958 additions & 200 deletions

.github/workflows/apprun.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PySide App Test
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.12'
17+
cache: 'pip'
18+
19+
- name: Install system dependencies
20+
run: |
21+
# dont run update, it is slow
22+
# sudo apt-get update
23+
sudo apt-get install -y --no-install-recommends \
24+
libxkbcommon-x11-0 \
25+
x11-utils \
26+
libyaml-dev \
27+
libegl1-mesa \
28+
libxcb-icccm4 \
29+
libxcb-image0 \
30+
libxcb-keysyms1 \
31+
libxcb-randr0 \
32+
libxcb-render-util0 \
33+
libxcb-xinerama0 \
34+
libopengl0 \
35+
libxcb-cursor0
36+
37+
- name: Install dependencies
38+
run: |
39+
pip install -r requirements.txt
40+
41+
- name: Run TagStudio app and check exit code
42+
run: |
43+
xvfb-run --server-args="-screen 0, 1920x1200x24 -ac +extension GLX +render -noreset" python tagstudio/tag_studio.py --ci -o /tmp/
44+
exit_code=$?
45+
if [ $exit_code -eq 0 ]; then
46+
echo "TagStudio ran successfully"
47+
else
48+
echo "TagStudio failed with exit code $exit_code"
49+
exit 1
50+
fi

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
ruff==0.4.2
22
pre-commit==3.7.0
3+
Pyinstaller==6.6.0

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ PySide6_Addons>=6.5.1.1,<=6.6.3.1
77
PySide6_Essentials>=6.5.1.1,<=6.6.3.1
88
typing_extensions>=3.10.0.0,<=4.11.0
99
ujson>=5.8.0,<=5.9.0
10-
Pyinstaller==6.6.0

tagstudio/__init__.py

Whitespace-only changes.

tagstudio/resources/icon.icns

2.91 MB
Binary file not shown.

tagstudio/src/cli/__init__.py

Whitespace-only changes.

tagstudio/src/cli/ts_cli.py

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import sys
1313
import time
1414
from PIL import Image, ImageOps, ImageChops, UnidentifiedImageError
15+
from PIL.Image import DecompressionBombError
1516
import pillow_avif
1617
from pathlib import Path
1718
import traceback
@@ -643,8 +644,12 @@ def print_thumbnail(
643644
# raw.thumbnail((512, 512))
644645
raw.thumbnail(self.external_preview_size)
645646
raw.save(external_preview_path)
646-
except:
647-
print(f'{ERROR} Could not load image "{filepath}"')
647+
except (
648+
UnidentifiedImageError,
649+
FileNotFoundError,
650+
DecompressionBombError,
651+
) as e:
652+
print(f'{ERROR} Could not load image "{filepath} due to {e}"')
648653
if self.args.external_preview:
649654
self.set_external_preview_broken()
650655
elif file_type in VIDEO_TYPES:
@@ -1109,24 +1114,34 @@ def create_collage(self) -> str:
11091114
# sys.stdout.write(f'\r{INFO} Combining [{i+1}/{len(self.lib.entries)}]: {self.get_file_color(file_type)}{entry.path}{os.sep}{entry.filename}{RESET}')
11101115
# sys.stdout.flush()
11111116
if file_type in IMAGE_TYPES:
1112-
with Image.open(
1113-
os.path.normpath(
1114-
f"{self.lib.library_dir}/{entry.path}/{entry.filename}"
1115-
)
1116-
) as pic:
1117-
if keep_aspect:
1118-
pic.thumbnail((thumb_size, thumb_size))
1119-
else:
1120-
pic = pic.resize((thumb_size, thumb_size))
1121-
if data_tint_mode and color:
1122-
pic = pic.convert(mode="RGB")
1123-
pic = ImageChops.hard_light(
1124-
pic,
1125-
Image.new(
1126-
"RGB", (thumb_size, thumb_size), color
1127-
),
1117+
try:
1118+
with Image.open(
1119+
os.path.normpath(
1120+
f"{self.lib.library_dir}/{entry.path}/{entry.filename}"
11281121
)
1129-
collage.paste(pic, (y * thumb_size, x * thumb_size))
1122+
) as pic:
1123+
if keep_aspect:
1124+
pic.thumbnail((thumb_size, thumb_size))
1125+
else:
1126+
pic = pic.resize((thumb_size, thumb_size))
1127+
if data_tint_mode and color:
1128+
pic = pic.convert(mode="RGB")
1129+
pic = ImageChops.hard_light(
1130+
pic,
1131+
Image.new(
1132+
"RGB",
1133+
(thumb_size, thumb_size),
1134+
color,
1135+
),
1136+
)
1137+
collage.paste(
1138+
pic, (y * thumb_size, x * thumb_size)
1139+
)
1140+
except DecompressionBombError as e:
1141+
print(
1142+
f"[ERROR] One of the images was too big ({e})"
1143+
)
1144+
11301145
elif file_type in VIDEO_TYPES:
11311146
video = cv2.VideoCapture(filepath)
11321147
video.set(

tagstudio/src/core/__init__.py

Whitespace-only changes.

tagstudio/src/core/utils/__init__.py

Whitespace-only changes.

tagstudio/src/qt/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)