1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2026-01-08 16:05:15 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
RedDeadDepresso
a9c535dd69
Merge 7803994a3e into 2cad7ebbac 2024-01-04 14:20:28 +00:00
2 changed files with 7 additions and 28 deletions

View File

@ -8,7 +8,6 @@ from MCE.custom_widgets.ctk_timeentry import CTkTimeEntry
from MCE.custom_widgets.ctk_integerspinbox import CTkIntegerSpinbox
from MCE.custom_widgets.ctk_templatedialog import CTkTemplateDialog
from MCE.custom_widgets.ctk_notification import CTkNotification
from MCE.custom_widgets.ctk_add_button import CTkAddButton
from MCE.utils import Linker, Config
from filelock import FileLock, Timeout
import threading
@ -118,7 +117,7 @@ class MCE_Manager(customtkinter.CTk):
# Helper method to create Mission Tabview with Template and Queue Tabs
def create_mission_tabview(self):
self.mission_tabview = customtkinter.CTkTabview(self)
self.mission_tabview = customtkinter.CTkTabview(self, height=500)
self.mission_tabview.grid(row=17, column=0, columnspan=3, padx=20)
self.tab_template = self.mission_tabview.add('Template')
@ -152,8 +151,7 @@ class MCE_Manager(customtkinter.CTk):
self.highlight_label = customtkinter.CTkLabel(self.template_buttons_frame, text="*You can double click an entry and press up or down arrow to change its position", font=customtkinter.CTkFont(family="Inter", size=12))
self.highlight_label.grid(row=0, column=0, columnspan=3)
self.add_button = CTkAddButton(master=self.template_buttons_frame)
self.add_button.button.configure(command=lambda queue=queue, button=self.add_button.button: self.add_frame(queue=queue, button=button))
self.add_button = customtkinter.CTkButton(self.template_buttons_frame , text="Add", command=lambda queue=queue: self.add_frame(queue=queue))
self.add_button.grid(row=1, column=0, padx=5, pady=5)
# Clear button to clear all frames
@ -168,10 +166,10 @@ class MCE_Manager(customtkinter.CTk):
# Helper method to create Template Frame and Queue Frame
def create_template_and_queue_frames(self):
self.template_frame = customtkinter.CTkScrollableFrame(self.tab_template, width=435, height=350)
self.template_frame = customtkinter.CTkScrollableFrame(self.tab_template, width=400, height=350)
self.template_frame.grid(row=1, column=0, sticky="nsew")
self.queue_frame = customtkinter.CTkScrollableFrame(self.tab_queue, width=435, height=350)
self.queue_frame = customtkinter.CTkScrollableFrame(self.tab_queue, width=400, height=350)
self.queue_frame.grid(row=1, column=0, sticky="nsew")
# Helper method to create Lists to Store Frame Widgets
@ -256,15 +254,14 @@ class MCE_Manager(customtkinter.CTk):
return
# Function to add a frame with widgets
def add_frame(self, inner_list=None, queue=False, state="normal", button=None):
position = button.cget("text") if button else "Add Down"
def add_frame(self, inner_list=None, queue=False, state="normal"):
frames = self.queue_frames if queue else self.template_frames
parent_frame = self.queue_frame if queue else self.template_frame
row_index = len(frames) + 1 # Calculate the row for the new frame
# Create a frame
frame = tk.Frame(parent_frame, bg="gray17")
frame.grid(row=row_index, column=0, columnspan=4, padx=10, pady=10, sticky="w")
frames.append(frame) if position == "Add Down" else frames.insert(0, frame)
frames.append(frame)
# "Up" button to move the frame up
up_button = customtkinter.CTkButton(frame, text="Up", width=5, command=lambda f=frame, queue=queue: self.move_frame_up(f, queue), state=state)
up_button.grid(row=0, column=0, padx=5, pady=5, sticky="w")
@ -291,9 +288,7 @@ class MCE_Manager(customtkinter.CTk):
delete_button = customtkinter.CTkButton(frame, text="Delete", width=5, command=lambda f=frame, queue=queue: self.delete_frame(f, queue), state=state)
delete_button.grid(row=0, column=5, padx=5, pady=5, sticky="w")
frame.bind("<Double-Button-1>", lambda event, f=frame: self.highlight_frame(f))
if position == "Add Up":
self.update_frame_positions(queue=queue)
frame.bind("<Double-Button-1>", lambda event, f=frame: self.highlight_frame(f))
# Function to clear all frames
def clear_frames(self, queue=False):

View File

@ -1,16 +0,0 @@
import customtkinter
class CTkAddButton(customtkinter.CTkFrame):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.button = customtkinter.CTkButton(self, text="Add Down", corner_radius=0, width=120)
self.button.grid(row=0, column=0)
self.option_menu = customtkinter.CTkOptionMenu(
self, values= ["Add Up", "Add Down"], width=10, command=self.set_button, corner_radius=0
)
self.option_menu.set("")
self.option_menu.grid(row=0, column=1)
def set_button(self, value):
self.option_menu.set("")
self.button.configure(text=value)