enhance/icons_on_toolbar #34

Merged
Shikiryu merged 2 commits from enhance/icons_on_toolbar into main 2024-05-16 00:30:05 +02:00
9 changed files with 39 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

BIN
assets/icons/copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

BIN
assets/icons/flip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
assets/icons/folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

BIN
assets/icons/maximize.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
assets/icons/next.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

BIN
assets/icons/timer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

View File

@ -1,4 +1,6 @@
pillow~=9.5.0
pyinstaller
pyinstaller==5.12.0
pygame~=2.4.0
customtkinter~=5.1.3
configparser~=5.3.0
CTkToolTip~=0.4

View File

@ -3,6 +3,9 @@ import os
import subprocess
import sys
from tkinter import *
from CTkToolTip import *
from PIL import ImageTk, Image, ImageOps
import customtkinter
from src.util import Util
@ -20,34 +23,46 @@ class Toolbar:
toolbar = Frame(self.image_window.window, bd=1, relief=RAISED)
toolbar.pack(side=BOTTOM, fill=X)
next_button = customtkinter.CTkButton(toolbar, compound=LEFT, text="next ➡️",
command=self.image_window.next_image)
next_button = customtkinter.CTkButton(toolbar, image=ImageTk.PhotoImage(Image.open("assets/icons/next.png")),
text="", command=self.image_window.next_image)
next_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(next_button, delay=0.1, message="Next", y_offset=-40, x_offset=-40)
self.bw_button = customtkinter.CTkButton(toolbar, compound=LEFT, text="black&white",
command=self.toggle_black_white)
self.bw_button = customtkinter.CTkButton(toolbar, image=ImageTk.PhotoImage(Image.open("assets/icons/black-and"
"-white.png")),
text="", command=self.toggle_black_white)
self.bw_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.bw_button, delay=0.1, message="Black and white image", y_offset=-40, x_offset=-40)
self.mirror_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_mirror,
text="mirror")
self.mirror_button = customtkinter.CTkButton(toolbar, command=self.toggle_mirror, text="",
image=ImageTk.PhotoImage(Image.open("assets/icons/flip.png")))
self.mirror_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.mirror_button, delay=0.1, message="Mirrored image", y_offset=-40, x_offset=-40)
open_folder_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.open_folder,
text="open folder")
open_folder_button = customtkinter.CTkButton(toolbar, command=self.open_folder, text="",
image=ImageTk.PhotoImage(Image.open("assets/icons/folder.png")))
open_folder_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(open_folder_button, delay=0.1, message="Open folder", y_offset=-40, x_offset=-40)
self.always_on_top_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_always_on_top,
text="always on top")
self.always_on_top_button = customtkinter.CTkButton(toolbar, command=self.toggle_always_on_top, text="",
image=ImageTk.PhotoImage(
Image.open("assets/icons/copy.png")))
self.always_on_top_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.always_on_top_button, delay=0.1, message="Always on top", y_offset=-40, x_offset=-40)
self.fullscreen_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_fullscreen,
text="fullscreen")
self.fullscreen_button = customtkinter.CTkButton(toolbar, command=self.toggle_fullscreen, text="",
image=ImageTk.PhotoImage(
Image.open("assets/icons/maximize.png")))
self.fullscreen_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(self.fullscreen_button, delay=0.1, message="Fullscreen", y_offset=-40, x_offset=-40)
timer_button = customtkinter.CTkButton(toolbar, compound=LEFT, command=self.toggle_timer, text="timer")
timer_button = customtkinter.CTkButton(toolbar, command=self.toggle_timer, text="",
image=ImageTk.PhotoImage(Image.open("assets/icons/timer.png")))
timer_button.pack(side=LEFT, padx=0, pady=0)
CTkToolTip(timer_button, delay=0.1, message="Toggle timer", y_offset=-40, x_offset=-40)
self.timer_label = customtkinter.CTkLabel(toolbar, text=str(self.timer), text_color=Util.get_default_button_color())
self.timer_label = customtkinter.CTkLabel(toolbar, text=str(self.timer),
text_color=Util.get_default_button_color())
self.timer_label.pack(side=RIGHT, ipadx=20)
def display_new_timer(self):
@ -72,13 +87,15 @@ class Toolbar:
def toggle_black_white(self):
self.image_window.option["bw"] = not self.image_window.option["bw"]
self.bw_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option["bw"] else Util.get_default_button_color())
self.bw_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option[
"bw"] else Util.get_default_button_color())
self.image_window.image.apply_options()
def toggle_mirror(self):
self.image_window.option["mirror"] = not self.image_window.option["mirror"]
self.mirror_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option["mirror"] else Util.get_default_button_color())
self.mirror_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option[
"mirror"] else Util.get_default_button_color())
self.image_window.image.apply_options()
@ -112,6 +129,7 @@ class Toolbar:
def toggle_fullscreen(self):
self.image_window.option["fullscreen"] = not self.image_window.option["fullscreen"]
self.fullscreen_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option["fullscreen"] else Util.get_default_button_color())
self.fullscreen_button.configure(fg_color=Util.get_default_active_button_color() if self.image_window.option[
"fullscreen"] else Util.get_default_button_color())
self.image_window.window.attributes("-fullscreen", self.image_window.option["fullscreen"])