🚧 Save session to app
This commit is contained in:
parent
25314fde08
commit
e2546c7bfb
@ -12,7 +12,9 @@ from src.window.session import SessionWindow
|
|||||||
class App:
|
class App:
|
||||||
def __init__(self, root):
|
def __init__(self, root):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.custom = False
|
||||||
self.config = Config()
|
self.config = Config()
|
||||||
|
self.session = None
|
||||||
self.session_window = None
|
self.session_window = None
|
||||||
self.image_window = None
|
self.image_window = None
|
||||||
self.root = root
|
self.root = root
|
||||||
@ -41,7 +43,6 @@ class App:
|
|||||||
t = i
|
t = i
|
||||||
new_button = Button(self.button_frame, text=Util.format_seconds(t),
|
new_button = Button(self.button_frame, text=Util.format_seconds(t),
|
||||||
command=partial(self.set_timer_in_seconds, t))
|
command=partial(self.set_timer_in_seconds, t))
|
||||||
|
|
||||||
self.buttons.append(new_button)
|
self.buttons.append(new_button)
|
||||||
self.button_frame.columnconfigure(i, weight=1)
|
self.button_frame.columnconfigure(i, weight=1)
|
||||||
new_button.grid(row=0, column=i, sticky=W + E)
|
new_button.grid(row=0, column=i, sticky=W + E)
|
||||||
@ -72,7 +73,7 @@ class App:
|
|||||||
self.check_lets_draw()
|
self.check_lets_draw()
|
||||||
|
|
||||||
def check_lets_draw(self):
|
def check_lets_draw(self):
|
||||||
if self.selected_folder != "" and len(self.found_images) > 0 and self.timer != 0:
|
if self.selected_folder != "" and len(self.found_images) > 0 and (self.timer != 0 or self.custom):
|
||||||
self.launch_button.config(state="normal")
|
self.launch_button.config(state="normal")
|
||||||
else:
|
else:
|
||||||
self.launch_button.config(state="disabled")
|
self.launch_button.config(state="disabled")
|
||||||
@ -85,3 +86,7 @@ class App:
|
|||||||
else:
|
else:
|
||||||
button.config(bg="gray85")
|
button.config(bg="gray85")
|
||||||
self.check_lets_draw()
|
self.check_lets_draw()
|
||||||
|
|
||||||
|
def set_custom(self, list_in_session):
|
||||||
|
self.custom = True
|
||||||
|
self.list_in_session = list_in_session
|
||||||
|
@ -58,8 +58,8 @@ class SessionWindow:
|
|||||||
self.down_button = Button(button_frame, text="v", command=self.down_element)
|
self.down_button = Button(button_frame, text="v", command=self.down_element)
|
||||||
self.down_button.pack(side=LEFT, padx=0, pady=0)
|
self.down_button.pack(side=LEFT, padx=0, pady=0)
|
||||||
|
|
||||||
self.save_session_button = Button(button_frame, text="v", command=self.save_session)
|
save_session_button = Button(button_frame, text="v", command=self.save_session)
|
||||||
self.save_session_button.pack(side=LEFT, padx=0, pady=0)
|
save_session_button.pack(side=LEFT, padx=0, pady=0)
|
||||||
button_frame.grid()
|
button_frame.grid()
|
||||||
|
|
||||||
def reset_element(self):
|
def reset_element(self):
|
||||||
@ -156,6 +156,7 @@ class SessionWindow:
|
|||||||
|
|
||||||
def save_session(self):
|
def save_session(self):
|
||||||
for element in self.list_in_session:
|
for element in self.list_in_session:
|
||||||
Config._CONFIG['session'].append(element)
|
Config._CONFIG['session'].append(element.__dict__)
|
||||||
Config.save()
|
Config.save()
|
||||||
|
self.app.set_custom(self.list_in_session)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
Loading…
Reference in New Issue
Block a user