refactor #26

Merged
Shikiryu merged 2 commits from refactor into main 2023-05-24 14:29:50 +02:00
2 changed files with 18 additions and 12 deletions
Showing only changes of commit 508e384858 - Show all commits

View File

@ -11,10 +11,9 @@ class Toolbar:
self.current_image = None
self.current_original_image = None
self.image_window = image_window
self.timer = timer
self.timer_label = None
self.timer_check = None
self.always_on_top_check = None
toolbar = Frame(self.image_window.window, bd=1, relief=RAISED)
toolbar.pack(side=BOTTOM, fill=X)
@ -30,19 +29,19 @@ class Toolbar:
text="mirror")
self.mirror_button.pack(side=LEFT, padx=0, pady=0)
self.open_folder_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.open_folder
, text="open folder")
self.open_folder_button.pack(side=LEFT, padx=0, pady=0)
open_folder_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.open_folder, text="open folder")
open_folder_button.pack(side=LEFT, padx=0, pady=0)
self.always_on_top_button = Button(toolbar, relief=FLAT, compound=LEFT,
command=self.toggle_always_on_top
, text="always on top")
self.always_on_top_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_always_on_top,
text="always on top")
self.always_on_top_button.pack(side=LEFT, padx=0, pady=0)
self.always_on_top_check = None
self.timer_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_timer,
text="timer")
self.timer_button.pack(side=LEFT, padx=0, pady=0)
self.fullscreen_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_fullscreen,
text="fullscreen")
self.fullscreen_button.pack(side=LEFT, padx=0, pady=0)
timer_button = Button(toolbar, relief=FLAT, compound=LEFT, command=self.toggle_timer, text="timer")
timer_button.pack(side=LEFT, padx=0, pady=0)
self.timer_label = Label(toolbar, text=self.timer)
self.timer_label.pack(side=RIGHT, ipadx=20)
@ -105,3 +104,9 @@ class Toolbar:
# self.window.lift()
self.image_window.window.attributes('-topmost', True)
self.always_on_top_check = self.image_window.window.after(2000, self.stay_on_top)
def toggle_fullscreen(self):
self.image_window.option["fullscreen"] = not self.image_window.option["fullscreen"]
self.fullscreen_button.config(bg="blue" if self.image_window.option["fullscreen"] else "grey85")
self.image_window.window.attributes("-fullscreen", self.image_window.option["fullscreen"])

View File

@ -17,6 +17,7 @@ class ImageWindow:
"bw": False,
"mirror": False,
"always_on_top": False,
"fullscreen": False,
}
mixer.init()