Skip to content

Commit 92b299f

Browse files
authored
Merge pull request #208 from TeaM-TL/5.1.5
5.1.5
2 parents 6bc0fa2 + e57b7f1 commit 92b299f

13 files changed

+137
-139
lines changed

Diff for: .github/workflows/publish_to_pypi.yml

+31-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Upload FotoKilof Package to PyPI when a Release is Created
1+
name: Build and upload to PyPI when a Release is Created
22

33
on:
44
release:
@@ -15,24 +15,37 @@ jobs:
1515
contents: write
1616
id-token: write
1717
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v4
18+
- name: Checkout code
19+
uses: actions/checkout@v4
2020

21-
- name: Set up Python 3.12
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: '3.12'
21+
- name: Set up Python 3.12
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.12'
2525

26-
- name: "Install build"
27-
run: pip install build
26+
- name: Compile *po files for localisation
27+
run: |
28+
apt-get install -y gettext tree
29+
ls
30+
tree
31+
L_PRE=fotokilof/locale
32+
L_LAST=LC_MESSAGES/fotokilof
33+
for L in $L_PRE/??; do
34+
if [ -e $L_PRE/$L/$L_LAST.po ]; then
35+
msgfmt $L_PRE/$L/$L_LAST.po -o fotokilof/$L/$L_LAST.mo
36+
fi
37+
done
2838
29-
- name: Build package
30-
run: python -m build
31-
32-
- name: Publish distribution to PyPI
33-
uses: pypa/gh-action-pypi-publish@release/v1
39+
- name: "Install build"
40+
run: pip install build
3441

35-
- name: Upload artifact signatures to GitHub Release
36-
env:
37-
GITHUB_TOKEN: ${{ github.token }}
38-
run: gh release upload '${{ github.pypi }}' dist/** --repo '${{ github.repository }}'
42+
- name: Build package
43+
run: python -m build
44+
45+
- name: Publish distribution to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
48+
# - name: Upload artifact signatures to GitHub Release
49+
# env:
50+
# GITHUB_TOKEN: ${{ github.token }}
51+
# run: gh release upload '${{ github.pypi }}' dist/** --repo '${{ github.repository }}'

Diff for: CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2025
4+
5+
5.1.5 fixed right mouse button for crop, small code polishing
6+
37
## 2024
48

59
5.1.4 updated locale and pot file, added missing entry poinyt into toml

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019-2024 Tomasz Łuczak, TeaM-TL
1+
Copyright (c) 2019-2025 Tomasz Łuczak, TeaM-TL
22
MIT License
33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

Diff for: README.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
GUI for the most used (by me) ImageMagick functionality for processing pictures.
44
If ImageMagick or Wand are unavailable, Pillow is in use. There some limitation, but works in general.
55

6-
![Happy new Year](https://raw.githubusercontent.com/TeaM-TL/FotoKilof/master/screenshots/january_happy_new_year.jpg)
7-
86
## Screenshots
97

108
### Linux

Diff for: fotokilof/__main__.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# pylint: disable=line-too-long
88

99
"""
10-
Copyright (c) 2019-2024 Tomasz Łuczak, TeaM-TL
10+
Copyright (c) 2019-2025 Tomasz Łuczak, TeaM-TL
1111
1212
Permission is hereby granted, free of charge, to any person obtaining a copy
1313
of this software and associated documentation files (the "Software"), to deal
@@ -237,7 +237,7 @@ def preview_new(file_out):
237237
preview_new_clear()
238238
else:
239239
preview_picture = convert_common.preview(
240-
file_out, int(co_preview_selector_new.get()), PILLOW, OS
240+
file_out, int(co_preview_selector_new.get()), PILLOW
241241
)
242242
try:
243243
pi_preview_new.configure(file=preview_picture["filename"])
@@ -856,7 +856,7 @@ def open_file():
856856
def open_file_common(cwd, filename):
857857
"""common function for: open, first, last, next, prev"""
858858
if filename is not None:
859-
file_in_path.set(common.spacja(os.path.join(cwd, filename), OS))
859+
file_in_path.set(common.spacja(os.path.join(cwd, filename)))
860860
root.title(window_title + file_in_path.get())
861861
image_size = convert_common.get_image_size(file_in_path.get(), PILLOW)
862862
if image_size != (0, 0):
@@ -983,7 +983,7 @@ def open_screenshot():
983983
except:
984984
if OS == "UNIX":
985985
message = _(
986-
"Sorry, xclip (X11) or wl-clipboard (Wayland) is not installed\n Install xclip or wl-clipboard and try again!"
986+
"Sorry, nothing in clipboard\nOr xclip (X11) or wl-clipboard (Wayland) is not installed\n Install xclip or wl-clipboard and try again!"
987987
)
988988
Messagebox.show_error(message, title=_("Missing package"))
989989
try:
@@ -1528,7 +1528,6 @@ def preview_orig():
15281528
file_in_path.get(),
15291529
int(co_preview_selector_orig.get()),
15301530
PILLOW,
1531-
OS,
15321531
crop_rectangle,
15331532
)
15341533

@@ -1564,7 +1563,7 @@ def preview_logo():
15641563
if os.path.isfile(file_logo_path.get()):
15651564
l_logo_filename.configure(text=os.path.basename(file_logo_path.get()))
15661565
preview_picture = convert_common.preview(
1567-
file_logo_path.get(), PREVIEW_LOGO, PILLOW, OS
1566+
file_logo_path.get(), PREVIEW_LOGO, PILLOW
15681567
)
15691568

15701569
try:
@@ -1591,7 +1590,7 @@ def preview_compose():
15911590
if os.path.isfile(img_compose_file.get()):
15921591
# l_compose_preview.configure(text=os.path.basename(img_compose_file.get()))
15931592
preview_picture = convert_common.preview(
1594-
img_compose_file.get(), int(co_compose_preview_selector.get()), PILLOW, OS
1593+
img_compose_file.get(), int(co_compose_preview_selector.get()), PILLOW
15951594
)
15961595

15971596
try:
@@ -3150,7 +3149,10 @@ def text_tool_hide_show():
31503149
co_compose_preview_selector.bind("<<ComboboxSelected>>", preview_compose_refresh)
31513150
co_text_font.bind("<<ComboboxSelected>>", font_selected)
31523151
c_preview_orig_pi.bind("<Button-1>", mouse_crop_nw)
3153-
c_preview_orig_pi.bind("<Button-2>", mouse_crop_se)
3152+
if OS == "MACOS":
3153+
c_preview_orig_pi.bind("<Button-2>", mouse_crop_se)
3154+
else:
3155+
c_preview_orig_pi.bind("<Button-3>", mouse_crop_se)
31543156
c_preview_new_pi.bind("<Button-1>", preview_new_button)
31553157
root.bind("<F1>", help_info)
31563158
root.bind("<F2>", change_ttk_theme)

Diff for: fotokilof/common.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
"""
4-
Copyright (c) 2019-2024 Tomasz Łuczak, TeaM-TL
4+
Copyright (c) 2019-2025 Tomasz Łuczak, TeaM-TL
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal
@@ -39,6 +39,7 @@
3939
import fnmatch
4040
import logging
4141
from pathlib import PurePosixPath, PureWindowsPath
42+
import platform
4243
import os
4344
import os.path
4445

@@ -52,8 +53,7 @@ def resize_subdir(resize_vatiant, pixel_x, pixel_y, percent):
5253
command = str(pixel_x) + "x" + str(pixel_y)
5354
sub_dir = str(pixel_x) + "x" + str(pixel_y)
5455
case 2:
55-
if percent > 100:
56-
percent = 100
56+
percent = min(percent, 100)
5757
if percent == 0:
5858
percent = 1
5959
command = str(percent) + "%"
@@ -120,10 +120,10 @@ def mouse_crop_calculation(x_orig, y_orig, size):
120120
return dict_return
121121

122122

123-
def spacja(file_path, operating_system):
123+
def spacja(file_path):
124124
"""escaping space and special char in pathname"""
125125
if len(file_path):
126-
if operating_system == "Windows":
126+
if platform.system() == "Windows":
127127
result = PureWindowsPath(os.path.normpath(file_path))
128128
else:
129129
result = PurePosixPath(os.path.normpath(file_path))
@@ -259,9 +259,7 @@ def file_from_list_of_images(file_list, current_file, request):
259259

260260
def arrow_gravity(position, length, x0, y0):
261261
"""calculate coordinated to draw arrow"""
262-
length = int(length)
263-
x0 = int(x0)
264-
y0 = int(y0)
262+
265263
width = int(length / 3 / 2)
266264
length_1_2 = int(length / 2)
267265
length_1_3 = int(length / 3)
@@ -270,9 +268,6 @@ def arrow_gravity(position, length, x0, y0):
270268
offset_x = 0
271269
offset_y = 0
272270
c = (x0, y0)
273-
a = (x0, y0)
274-
d = (x0, y0)
275-
e = (x0, y0)
276271
match position:
277272
case "N":
278273
a = (x0, y0 + length)
@@ -380,7 +375,7 @@ def gravitation(gravity, text_x, text_y, image_width, image_height):
380375
result0 = "0"
381376
result1 = "0"
382377

383-
return (result0, result1), text_x, text_y
378+
return (result0, result1), int(text_x), int(text_y)
384379

385380

386381
def compose_calculate_half(clone, compose, auto_resize, gravity):

Diff for: fotokilof/convert_common.py

+22-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# pylint: disable=bare-except
33

44
"""
5-
Copyright (c) 2024 Tomasz Łuczak, TeaM-TL
5+
Copyright (c) 2024-2025 Tomasz Łuczak, TeaM-TL
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -78,7 +78,6 @@ def fonts_list(set_pillow):
7878

7979
def display_image(file_to_display, set_pillow):
8080
"""display image"""
81-
# file_in = common.spacja(file_to_display)
8281
module_logger.info(" Display file: %s", file_to_display)
8382
start_time = time.time()
8483
result = None
@@ -134,13 +133,23 @@ def get_image_size(file_in, is_pillow):
134133
return size
135134

136135

137-
def preview(file_logo, size, set_pillow, operating_system, coord=""):
136+
def preview(file_logo, size, set_pillow, coord=""):
138137
"""preview"""
139138
start_time = time.time()
139+
140140
if set_pillow:
141-
result = convert_pillow.preview(file_logo, size, operating_system, coord)
141+
result = convert_pillow.preview(file_logo, size, coord)
142142
else:
143-
result = convert_wand.preview(file_logo, size, operating_system, coord)
143+
result = convert_wand.preview(file_logo, size, coord)
144+
if result is None:
145+
result = {
146+
"filename": None,
147+
"size": "0",
148+
"width": "0",
149+
"height": "0",
150+
"preview_width": "0",
151+
"preview_height": "0",
152+
}
144153
module_logger.info("preview: %s s", str(time.time() - start_time))
145154
return result
146155

@@ -170,10 +179,16 @@ def save_close_clone(clone, file_out, exif_on, set_pillow):
170179
def rotate(clone, angle, color, angle_own, set_pillow):
171180
"""rotate"""
172181
start_time = time.time()
182+
if angle == 0:
183+
angle = common.empty(angle_own)
184+
if angle == 0:
185+
color = None
186+
else:
187+
color = None
173188
if set_pillow:
174-
result = convert_pillow.rotate(clone, angle, color, angle_own)
189+
result = convert_pillow.rotate(clone, angle, color)
175190
else:
176-
convert_wand.rotate(clone, angle, color, angle_own)
191+
convert_wand.rotate(clone, angle, color)
177192
result = clone
178193
module_logger.info("Rotate: %ss", str(time.time() - start_time))
179194
return result

0 commit comments

Comments
 (0)