feature/session #27

Merged
Shikiryu merged 7 commits from feature/session into main 2023-06-02 12:24:15 +02:00
2 changed files with 36 additions and 0 deletions
Showing only changes of commit 95392cc6e0 - Show all commits

View File

@ -4,11 +4,13 @@ from pathlib import Path
from src.util import Util
from functools import partial
from src.window.image import ImageWindow
from src.window.session import SessionWindow
class App:
def __init__(self, root):
super().__init__()
self.session_window = None
self.image_window = None
self.root = root
self.selected_folder = ""
@ -42,6 +44,11 @@ class App:
new_button.grid(row=0, column=i, sticky=W + E)
i += 1
new_button = Button(self.button_frame, text="Custom", command=self.custom_session)
self.buttons.append(new_button)
self.button_frame.columnconfigure(i, weight=1)
new_button.grid(row=0, column=i, sticky=W + E)
self.launch_button = Button(root, text="Let's draw!", command=self.lets_draw, state="disabled")
self.launch_button.pack(side="bottom")
@ -49,6 +56,10 @@ class App:
self.image_window = ImageWindow(self)
self.image_window.lets_draw(self.found_images.copy(), self.timer)
def custom_session(self):
self.session_window = SessionWindow(self)
self.session_window.open(self)
def select_folder(self):
self.selected_folder = filedialog.askdirectory()
self.found_images = list(

25
src/window/session.py Normal file
View File

@ -0,0 +1,25 @@
from tkinter import *
class SessionWindow:
def __init__(self, app):
self.app = app
self.window = Toplevel(app.root)
self.window.title("Custom session")
self.window.geometry("600x600")
self.window.protocol("WM_DELETE_WINDOW", self.save_on_closing)
self.list_in_session = []
self.update_session_list()
def update_session_list(self):
for i, session in enumerate(self.list_in_session):
new_session = Button(text="")
new_session.grid(row=i, column=0)
def save_on_closing(self):
# TODO save
self.window.destroy()