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 43 additions and 4 deletions
Showing only changes of commit 658e96c6d3 - Show all commits

View File

@ -58,7 +58,7 @@ class App:
def custom_session(self):
self.session_window = SessionWindow(self)
self.session_window.open(self)
self.session_window.open()
def select_folder(self):
self.selected_folder = filedialog.askdirectory()

View File

@ -1,8 +1,12 @@
from functools import partial
from tkinter import *
class SessionWindow:
def __init__(self, app):
self.selected_element_index = 0
self.delete_button = None
self.add_button = None
self.app = app
self.window = Toplevel(app.root)
@ -10,16 +14,51 @@ class SessionWindow:
self.window.geometry("600x600")
self.window.protocol("WM_DELETE_WINDOW", self.save_on_closing)
self.left_column = Frame(self.window, width=300, height=600)
self.right_column = Frame(self.window, width=300, height=600)
self.left_column.grid(row=0, column=0, sticky="ns")
self.right_column.grid(row=0, column=1, sticky="ns")
self.list_in_session = []
def open(self):
self.update_session_list()
self.add_button = Button(self.left_column, text="+", command=self.add_element)
self.add_button.pack()
self.delete_button = Button(self.left_column, text="-", command=self.remove_element)
self.delete_button.pack()
def update_session_list(self):
for i, session in enumerate(self.list_in_session):
new_session = Button(text="")
new_session = Button(self.left_column, text="element " + str(i), command=partial(self.edit_element, i))
new_session.grid(row=i, column=0)
def remove_element(self):
self.list_in_session.pop(self.selected_element_index)
def edit_element(self, i):
self.selected_element_index = i
element = self.list_in_session[self.selected_element_index]
number_of_drawings_label = Text(self.right_column)
number_of_drawings_label.insert(INSERT, "Nombre de dessins :")
number_of_drawings_label.pack()
number_of_drawings_input = Entry(self.right_column)
number_of_drawings_input.insert(INSERT, element.number_of_drawings)
number_of_drawings_input.pack()
def add_element(self):
number_of_drawings_label = Text(self.right_column)
number_of_drawings_label.insert(INSERT, "Nombre de dessins :")
number_of_drawings_label.pack()
number_of_drawings_input = Entry(self.right_column)
number_of_drawings_input.pack()
def save_on_closing(self):
# TODO save
self.window.destroy()