Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.

Commit

Permalink
fix: updated event_banner
Browse files Browse the repository at this point in the history
  • Loading branch information
RedDeadDepresso committed Nov 17, 2023
1 parent dfb467c commit 8dfde92
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
Binary file modified assets/CN/goto/event_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/EN/goto/event_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions gui/custom_widgets/ctk_integerspinbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ def set(self, value: int):
self.entry.delete(0, "end")
self.entry.insert(0, max(self.min_value, value)) # Ensure the value is not less than 0

def configure(self, state):
self.subtract_button.configure(state=state)
self.add_button.configure(state=state)
self.entry.configure(state=state)
def configure(self, **kwargs):
state = kwargs.get("state", None)
if state is not None:
self.subtract_button.configure(state=state)
self.add_button.configure(state=state)
self.entry.configure(state=state)
kwargs.pop("state")
super().configure(**kwargs)
35 changes: 31 additions & 4 deletions gui/frames/farming.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,19 @@ def create_template_queue_editor(self):
self.template_buttons_frame = customtkinter.CTkFrame(i)
self.template_buttons_frame.grid(row=3, column=0)

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 = customtkinter.CTkButton(self.template_buttons_frame , text="Add", command=lambda queue=queue: self.add_frame(queue=queue))
self.add_button.grid(row=0, column=0, padx=5, pady=5)
self.add_button.grid(row=1, column=0, padx=5, pady=5)

# Clear button to clear all frames
self.clear_button = customtkinter.CTkButton(self.template_buttons_frame, text="Clear All", command=lambda queue=queue: self.clear_frames(queue=queue), fg_color="crimson")
self.clear_button.grid(row=0, column=1, padx=5, pady=5)
self.clear_button.grid(row=1, column=1, padx=5, pady=5)

# Save button to save data
self.save_button = customtkinter.CTkButton(self.template_buttons_frame, text="Save", command=lambda queue=queue: self.save_data(queue=queue), fg_color="#DC621D")
self.save_button.grid(row=0, column=2, padx=5, pady=5)
self.save_button.grid(row=1, column=2, padx=5, pady=5)
if queue:
self.queue_buttons = [self.add_button, self.clear_button, self.save_button]

Expand All @@ -224,6 +227,7 @@ def create_template_and_queue_frames(self):
def create_frame_lists(self):
self.template_frames = []
self.queue_frames = []
self.highlighted_frame = None

# Helper method to initialize Preferred Template and Templates List
def initialize_preferred_template(self):
Expand Down Expand Up @@ -306,7 +310,7 @@ def add_frame(self, inner_list=None, queue=False, state="normal"):
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 = customtkinter.CTkFrame(parent_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)
# "Up" button to move the frame up
Expand Down Expand Up @@ -335,6 +339,8 @@ def add_frame(self, inner_list=None, queue=False, state="normal"):
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))

# Function to clear all frames
def clear_frames(self, queue=False):
frames = self.queue_frames if queue else self.template_frames
Expand Down Expand Up @@ -409,3 +415,24 @@ def delete_frame(self, frame, queue=False):
frame.destroy()
# Update the positions of remaining frames
self.update_frame_positions(queue=queue)

def highlight_frame(self, frame):
try:
if self.highlighted_frame is not None:
self.highlighted_frame.unbind("<Up>")
self.highlighted_frame.unbind("<Down>")
self.highlighted_frame.config(bg="gray17")
except:
pass

if self.highlighted_frame == frame:
self.highlighted_frame = None

else:
up_button = frame.winfo_children()[0]
down_button = frame.winfo_children()[1]
frame.config(bg="yellow")
frame.bind("<Up>", lambda event: up_button.invoke())
frame.bind("<Down>", lambda event: down_button.invoke())
frame.focus_set()
self.highlighted_frame = frame

0 comments on commit 8dfde92

Please sign in to comment.