feature/session #27
@ -4,11 +4,13 @@ from pathlib import Path
|
|||||||
from src.util import Util
|
from src.util import Util
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from src.window.image import ImageWindow
|
from src.window.image import ImageWindow
|
||||||
|
from src.window.session import SessionWindow
|
||||||
|
|
||||||
|
|
||||||
class App:
|
class App:
|
||||||
def __init__(self, root):
|
def __init__(self, root):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.session_window = None
|
||||||
self.image_window = None
|
self.image_window = None
|
||||||
self.root = root
|
self.root = root
|
||||||
self.selected_folder = ""
|
self.selected_folder = ""
|
||||||
@ -42,6 +44,11 @@ class App:
|
|||||||
new_button.grid(row=0, column=i, sticky=W + E)
|
new_button.grid(row=0, column=i, sticky=W + E)
|
||||||
i += 1
|
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 = Button(root, text="Let's draw!", command=self.lets_draw, state="disabled")
|
||||||
self.launch_button.pack(side="bottom")
|
self.launch_button.pack(side="bottom")
|
||||||
|
|
||||||
@ -49,6 +56,10 @@ class App:
|
|||||||
self.image_window = ImageWindow(self)
|
self.image_window = ImageWindow(self)
|
||||||
self.image_window.lets_draw(self.found_images.copy(), self.timer)
|
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):
|
def select_folder(self):
|
||||||
self.selected_folder = filedialog.askdirectory()
|
self.selected_folder = filedialog.askdirectory()
|
||||||
self.found_images = list(
|
self.found_images = list(
|
||||||
|
25
src/window/session.py
Normal file
25
src/window/session.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user