From fdee998b28afde25851addb089b2b6649eb9a442 Mon Sep 17 00:00:00 2001 From: freeram Date: Fri, 5 Apr 2024 11:22:26 -0600 Subject: [PATCH] Rename reusable components for clarity --- pomodorodiscord/src/frames/settings_frame.py | 2 +- .../{entry_frame.py => settings_reusable.py} | 0 ...{statistic_display.py => stats_reusable.py} | 18 ++++++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) rename pomodorodiscord/src/reusable/{entry_frame.py => settings_reusable.py} (100%) rename pomodorodiscord/src/reusable/{statistic_display.py => stats_reusable.py} (59%) diff --git a/pomodorodiscord/src/frames/settings_frame.py b/pomodorodiscord/src/frames/settings_frame.py index 7fe4a5c..1fcafeb 100644 --- a/pomodorodiscord/src/frames/settings_frame.py +++ b/pomodorodiscord/src/frames/settings_frame.py @@ -1,6 +1,6 @@ import os import customtkinter as ctk -from src.reusable.entry_frame import EntryFrame +from src.reusable.settings_reusable import EntryFrame from src.utils import load_config, save_config, reload_app, beep, DEF_POMODORO_MINS, DEF_SB_MINS, DEF_LB_MINS, DEF_SB_BEFORE_L diff --git a/pomodorodiscord/src/reusable/entry_frame.py b/pomodorodiscord/src/reusable/settings_reusable.py similarity index 100% rename from pomodorodiscord/src/reusable/entry_frame.py rename to pomodorodiscord/src/reusable/settings_reusable.py diff --git a/pomodorodiscord/src/reusable/statistic_display.py b/pomodorodiscord/src/reusable/stats_reusable.py similarity index 59% rename from pomodorodiscord/src/reusable/statistic_display.py rename to pomodorodiscord/src/reusable/stats_reusable.py index dc56bfb..3e9b99a 100644 --- a/pomodorodiscord/src/reusable/statistic_display.py +++ b/pomodorodiscord/src/reusable/stats_reusable.py @@ -1,17 +1,27 @@ import customtkinter as ctk -class StatisticDisplay(ctk.CTkFrame): +class StatisticFrame(ctk.CTkFrame): def __init__(self, master, title, initial_value="0", title_font=18, val_font=24, **kwargs): super().__init__(master, **kwargs) self.pack(pady=(10, 15), fill="x") - + self.title_label = ctk.CTkLabel(self, text=title, font=("Helvetica", title_font), anchor="n") self.title_label.pack(fill="x") - + self.value_var = ctk.StringVar(value=initial_value) self.value_label = ctk.CTkLabel(self, textvariable=self.value_var, font=("Helvetica", val_font), anchor="center") self.value_label.pack(pady=(5, 0), fill="x") - + def set_value(self, value): self.value_var.set(value) + + +class ButtonFrame(ctk.CTkFrame): + def __init__(self, master, title, btntext, callback, **kwargs): + super().__init__(master, **kwargs) + self.pack() + self.label = ctk.CTkLabel(self, text=title, font=("Helvetica", 18)) + self.label.pack(pady=(20, 8)) + self.button = ctk.CTkButton(self, text=btntext, width=90, font=("Roboto", 16), command=callback) + self.button.pack()