From 3b17dff7bef859b54c60c79daac0972efcc9949f Mon Sep 17 00:00:00 2001 From: Clement Desmidt Date: Thu, 15 Jun 2023 12:12:52 +0200 Subject: [PATCH] :construction: Add icons in toolbar For #17 --- assets/icons/black-and-white.png | Bin 0 -> 643 bytes assets/icons/copy.png | Bin 0 -> 423 bytes assets/icons/flip.png | Bin 0 -> 427 bytes assets/icons/folder.png | Bin 0 -> 464 bytes assets/icons/maximize.png | Bin 0 -> 245 bytes assets/icons/next.png | Bin 0 -> 451 bytes assets/icons/timer.png | Bin 0 -> 534 bytes requirements.txt | 6 ++-- src/element/toolbar.py | 52 +++++++++++++++++++++---------- 9 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 assets/icons/black-and-white.png create mode 100644 assets/icons/copy.png create mode 100644 assets/icons/flip.png create mode 100644 assets/icons/folder.png create mode 100644 assets/icons/maximize.png create mode 100644 assets/icons/next.png create mode 100644 assets/icons/timer.png diff --git a/assets/icons/black-and-white.png b/assets/icons/black-and-white.png new file mode 100644 index 0000000000000000000000000000000000000000..1ddaf490f068b7f819e1e6c96751dbf95666030d GIT binary patch literal 643 zcmV-}0(||6P)V8t^Sz-;V(JQfuR`fw8)3uBihmB;a-jG$MNx(P?{ zr9@pF$M8D7zu{N(x8P`C9G1e{vWrO^z;GMz%zofa$^W0y8I58BcZv!g;}gzy0I#DT zx7&<2a1|eLB0sQGl60v9ct+6fkn_HZ8qNG23^fnC5WszG4XLV{yae=+A5{vx%Ov3%EDV2W=8Nn+8SPUA*kV;KkrDMfQUv$@GKZdDiCDW z*QQ^S5@wOskjzW@f2IRy9oulDWbCVyJ=dg5d$KrTN>VZ0g`i5BPGk#;rQ#_zOR3hb zRP^AyR2uTuhr3ejheW9;+P(mu(Hhq>1>dD~&3q-=-DSXe8x4||(JvA#;Y!YDG|Tl! zH}JfYg;@9i7o|ctjeFQ5m6h3;^Q6koi`FAm*g54-=4udJ(Ba9f`smkiNUAxoEGb-G d@2>y3{RS4km3n4ghfx3k002ovPDHLkV1h4nAkhE- literal 0 HcmV?d00001 diff --git a/assets/icons/copy.png b/assets/icons/copy.png new file mode 100644 index 0000000000000000000000000000000000000000..61b0fe005507e52f7001d4b7d4175f940bebd209 GIT binary patch literal 423 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEX7WqAsj$Z!;#Vf2?- z6cA>tnE2Hj$dD{?jVKAuPb(=;EJ|f4FE7{2%*!rLPAo{(%P&fw{mw>;fq_xQ)5S5w zqx0>xjb6--BCHpLIRiIt445ENc8kTNwKeQzPR`L|huj3}kHiNE{9&}NciiHi<8sg` zX<@_)7iX0PN8bs}_PKMmODs+z?V;_vxxdq%ofZ3H(96}euV3s{2EW%GM|OEhH{tHT z9o!#J&8|4acrVCe#!)@Lz}M45y2Ce3Z~CDvRq;|>=hf9clLHf&A1gK{7D{sUu_Ogs zh~4zx{PMkp^VAK^wQC-;g)`TF2{^>%XCN*Van$r#@C0>>BW79)g?t|X1a4{=$%vFls|O&E^@bT5fU?)dC1Ydtxc6kS}u~HNQ zf?b~D+C#fQD%+&9@CB5-f(VX<6F4s%>>wvMuq?yQ|9|Y5e0-}03a!ow31Xxno7!}Mv`*ZmhP1S;NM^b81U}n6aYmJhvV z>6*I7$jo*C$3OvG01My)SZ@uR3s`&2!Zn3^v;!IjGhkE8$H2IjZ-7}t^9!&SZ1sch z=c$4yAUt)Qk7@J1Yj;PJPnY}j3 z-+*gL2f!onv_tr>=Q;ycKnYBNyybbWfU4yzcWvojnVF&BPrve8pQUPgH>S@~z&AuA V&OcR)4_^QP002ovPDHLkV1kpgu|og= literal 0 HcmV?d00001 diff --git a/assets/icons/folder.png b/assets/icons/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..e4c57f15959803263bcb75cdcb95b80a6865f129 GIT binary patch literal 464 zcmV;>0WbcEP)2QGtPwx3h2c~H++e*ztPwwBXC*)f2Joc@cu&YThzr@+-n8uf3`SI* zb+zjdZIwD$#e;074>fd9Qm^bRX0ROtxtB8 zigElZcb2Z{MX=wnm2?- zjUdc;OxLp)$dD{?jVKAuPb(=;EJ|f4FE7{2%*!rLPAo{(%P&fw{mw=TsHn)(#WBRA zGdV%R@4)QF#)q8D%!lhu_Q?0oYmT^LpO%pD;mEQdhGIvbM0}VJlom8QYT)U`*k$Px zVj!R|@k?xj!p44s0Cm09RHS{qwK zat`BzZDpqFmzcDs@BMcwT-Es`SKH}#yDBENvQ2weaQ%6^MN~x}dqY)-(Iw@;@P^ZK zwHX|YPdezR#_8FG|57f+qeSbyy~uXl*~fY<)Gm6boFyt=akR{ E0N3o3fB*mh literal 0 HcmV?d00001 diff --git a/assets/icons/timer.png b/assets/icons/timer.png new file mode 100644 index 0000000000000000000000000000000000000000..2a52359aec3e21b0accf2c1a55b1adbb28bb01c2 GIT binary patch literal 534 zcmV+x0_pvUP)fAGqcak&O7h3{AZkMnYV>|Grkwt zX?k&?V?#I6TBA*YMI2)fKhyTox7e}4Kd^*n7$?~Q-lZL+Z-l3r+X=UDgm1Wyt0g(B zc#uVou+f(MP7;5_l@|GZ4Dy}ZP05#VnB-?m;#+C6IEPPSbjx)GcCwSI&R?gMp)bbu zq>8+U?_%avs4D;uljGvlQC!ozID_39f+p-H$7Wf9bus_J90fjLh?`T#=|ZrF{T3u^ zcvX0wm5hC{EPoX^)~rp>@uMMU0l&%u+hWb;#ZY0Bif8avoc`(@kgo_~d|a2*6Ehr$>)#gV@mZ{StyB<7IuhE_=1W$Re58Y-Ze%xO zaVFPFa@NGm$C=xje2QhUZWD1w4)H#1n7)aadF5Ez{PdTEPOal|`o4&@eu=MLJO8Kn Y4b#nCW?K{Q!~g&Q07*qoM6N<$f)7#e-v9sr literal 0 HcmV?d00001 diff --git a/requirements.txt b/requirements.txt index b5caefd..d22b91a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ pillow~=9.5.0 -pyinstaller +pyinstaller==5.12.0 pygame~=2.4.0 -customtkinter~=5.1.3 \ No newline at end of file +customtkinter~=5.1.3 +configparser~=5.3.0 +CTkToolTip~=0.4 \ No newline at end of file diff --git a/src/element/toolbar.py b/src/element/toolbar.py index 379434e..e509719 100644 --- a/src/element/toolbar.py +++ b/src/element/toolbar.py @@ -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.5, message="Next") - 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.5, message="Black and white image") - 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.5, message="Mirrored image") - 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.5, message="Open folder") - 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.5, message="Always on top") - 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.5, message="Fullscreen") - 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.5, message="Toggle timer") - 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"])