Skip to content

Commit

Permalink
4.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaM-TL committed Sep 10, 2023
1 parent 04952a7 commit a31d361
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
18 changes: 14 additions & 4 deletions fotokilof/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ def preview_orig_button():
""" original preview """
# global file_in_path
try:
convert_wand.display_image(file_in_path.get())
if mswindows.windows() or mswindows.macos():
gui.show_picture(file_in_path.get())
else:
convert_wand.display_image(file_in_path.get())
except:
log.write_log("No orig picture to preview", "W")

Expand All @@ -202,16 +205,23 @@ def preview_new_button():
""" preview new picture """
# to define file_out
try:
if os.path.isfile(path_to_file_out(resized.get())):
convert_wand.display_image(path_to_file_out(resized.get()))
filename = path_to_file_out(resized.get())
if os.path.isfile(filename):
if mswindows.windows() or mswindows.macos():
gui.show_picture(filename)
else:
convert_wand.display_image(filename)
except:
log.write_log("No result picture to preview", "W")


def compose_preview_button():
""" preview picture for compose """
try:
convert_wand.display_image(img_compose_file.get())
if mswindows.windows() or mswindows.macos():
gui.show_picture(img_compose_file.get())
else:
convert_wand.display_image(img_compose_file.get())
except:
log.write_log("No compose picture to preview", "W")

Expand Down
8 changes: 8 additions & 0 deletions fotokilof/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- copy_to_clipboard - copy result into clipboard (only Windows)
- only_numbers - validate only natural values
- only_integer - validate integer values
- show_picture - display picture in system viewer, PIL version
"""

from io import BytesIO
Expand Down Expand Up @@ -70,4 +71,11 @@ def only_integer(char):
result = False
return result


def show_picture(filename):
""" display picture in system viewer, PIL version """
#image = Image.open(filename")
with Image.open(filename) as image:
image.show()

# EOF

0 comments on commit a31d361

Please sign in to comment.