diff --git a/pomodorodiscord/run.py b/main.py similarity index 57% rename from pomodorodiscord/run.py rename to main.py index bc52dba..a05a673 100644 --- a/pomodorodiscord/run.py +++ b/main.py @@ -1,10 +1,15 @@ import customtkinter as ctk from src.app import PomodoroApp -from src.utils import load_config +from src.utils import load_config, THEMES_DIR -if __name__ == "__main__": + +def main(): config = load_config() - ctk.set_default_color_theme(f"themes/{config['theme']}.json") + ctk.set_default_color_theme(f"{THEMES_DIR}/{config['theme']}.json") ctk.set_appearance_mode("dark") app = PomodoroApp() app.mainloop() + + +if __name__ == "__main__": + main() diff --git a/pomodorodiscord/src/__init__.py b/pomodorodiscord/src/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/pomodorodiscord/src/frames/__init__.py b/pomodorodiscord/src/frames/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/pomodorodiscord/src/logic/__init__.py b/pomodorodiscord/src/logic/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/pomodorodiscord/src/reusable/__init__.py b/pomodorodiscord/src/reusable/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/pomodorodiscord/README.md b/src/README.md similarity index 73% rename from pomodorodiscord/README.md rename to src/README.md index 86cdae2..0becfbe 100644 --- a/pomodorodiscord/README.md +++ b/src/README.md @@ -1,30 +1,33 @@ ## Running -`python3 run.py` +`python3 main.py` + +## Testing + +`python3 -m unittest discover tests` ## Structure -- `run.py`: The main entry point. -- `src/`: The main package directory. - - `app.py`: Defines the main window and tab view, into which the three visible frames are packed. +- `main.py`: The main entry point. +- `src/`: Source code directory. + - `app.py`: Defines the main window and tab view, into which the three visible tabs are packed. - `utils.py`: Loading and saving data, configuration. - `frames/`: - `pomodoro_frame.py`: Entire timer functionality + storing data + communicating with Rich Presence. - `settings_frame.py`: Updates config. - `stats_frame.py`: Displays stats and graphs. - `reusable/`: Reusable UI components. - - `entry_frame.py`: For settings_frame.py, where you put in custom durations for the pomodoro. - - `statistic_display.py`: For stats_frame.py. - `logic/`: Logic separate from customtkinter. - `richpresence.py`: The Discord Rich Presence integration - editable, but if you change function args go to pomodoro_frame.py update_rpc. - `graphs.py`: matplotlib plots using data collected. -- `sounds/`: Beep. -- `themes/`: Responsible for all colors in the GUI. Theme is loaded on launch in run.py. + - `assets/` + - `sounds/`: Beep. + - `themes/`: Responsible for all colors in the GUI. Theme is loaded on launch in run.py. - `tests/`: Basic tests. Ignore ResourceWarnings. ## File Dependencies -- `run.py` imports and uses `src/app.py`. +- `main.py` imports and uses `src/app.py`. - `src/app.py` imports and uses `src/frames/*` and `src/utils.py`. - `src/frames/pomodoro_frame.py` imports and uses `src/utils.py` and `src/logic/richpresence.py`. - `src/frames/settings_frame.py` imports and uses `src/components/entry_frame.py` and `src/utils.py`. diff --git a/pomodorodiscord/src/app.py b/src/app.py similarity index 100% rename from pomodorodiscord/src/app.py rename to src/app.py diff --git a/pomodorodiscord/sounds/beep.mp3 b/src/assets/sounds/beep.mp3 similarity index 100% rename from pomodorodiscord/sounds/beep.mp3 rename to src/assets/sounds/beep.mp3 diff --git a/pomodorodiscord/themes/Anthracite.json b/src/assets/themes/Anthracite.json similarity index 100% rename from pomodorodiscord/themes/Anthracite.json rename to src/assets/themes/Anthracite.json diff --git a/pomodorodiscord/themes/Blue.json b/src/assets/themes/Blue.json similarity index 100% rename from pomodorodiscord/themes/Blue.json rename to src/assets/themes/Blue.json diff --git a/pomodorodiscord/themes/Default.json b/src/assets/themes/Default.json similarity index 100% rename from pomodorodiscord/themes/Default.json rename to src/assets/themes/Default.json diff --git a/pomodorodiscord/themes/GhostTrain.json b/src/assets/themes/GhostTrain.json similarity index 100% rename from pomodorodiscord/themes/GhostTrain.json rename to src/assets/themes/GhostTrain.json diff --git a/pomodorodiscord/themes/Green.json b/src/assets/themes/Green.json similarity index 100% rename from pomodorodiscord/themes/Green.json rename to src/assets/themes/Green.json diff --git a/pomodorodiscord/themes/MoonlitSky.json b/src/assets/themes/MoonlitSky.json similarity index 100% rename from pomodorodiscord/themes/MoonlitSky.json rename to src/assets/themes/MoonlitSky.json diff --git a/pomodorodiscord/src/frames/pomodoro_frame.py b/src/frames/pomodoro_frame.py similarity index 100% rename from pomodorodiscord/src/frames/pomodoro_frame.py rename to src/frames/pomodoro_frame.py diff --git a/pomodorodiscord/src/frames/settings_frame.py b/src/frames/settings_frame.py similarity index 93% rename from pomodorodiscord/src/frames/settings_frame.py rename to src/frames/settings_frame.py index 676934d..0bd595f 100644 --- a/pomodorodiscord/src/frames/settings_frame.py +++ b/src/frames/settings_frame.py @@ -1,13 +1,12 @@ import os import customtkinter as ctk 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 +from src.utils import THEMES_DIR, load_config, save_config, reload_app, beep, DEF_POMODORO_MINS, DEF_SB_MINS, DEF_LB_MINS, DEF_SB_BEFORE_L class SettingsFrame(ctk.CTkScrollableFrame): def __init__(self, master): super().__init__(master) - self.themes_dir = 'themes' config = load_config() self.abcycling_var = ctk.IntVar(value=config.get("auto_break_cycling", 0)) @@ -21,7 +20,7 @@ def __init__(self, master): self.theme_label = ctk.CTkLabel(self, text="Select Theme (RESTARTS APP):") self.theme_label.pack(pady=(20, 0)) - self.theme_options = [os.path.splitext(theme)[0] for theme in os.listdir(self.themes_dir) if theme.endswith('.json')] + self.theme_options = [os.path.splitext(theme)[0] for theme in os.listdir(THEMES_DIR) if theme.endswith('.json')] selected = ctk.StringVar(value=config.get('theme', 'Default')) self.theme_menu = ctk.CTkOptionMenu(self, variable=selected, values=self.theme_options, anchor="n", command=self.change_theme) self.theme_menu.pack(pady=(10, 0)) diff --git a/pomodorodiscord/src/frames/stats_frame.py b/src/frames/stats_frame.py similarity index 100% rename from pomodorodiscord/src/frames/stats_frame.py rename to src/frames/stats_frame.py diff --git a/pomodorodiscord/src/logic/graphs.py b/src/logic/graphs.py similarity index 100% rename from pomodorodiscord/src/logic/graphs.py rename to src/logic/graphs.py diff --git a/pomodorodiscord/src/logic/richpresence.py b/src/logic/richpresence.py similarity index 100% rename from pomodorodiscord/src/logic/richpresence.py rename to src/logic/richpresence.py diff --git a/pomodorodiscord/src/reusable/settings_reusable.py b/src/reusable/settings_reusable.py similarity index 100% rename from pomodorodiscord/src/reusable/settings_reusable.py rename to src/reusable/settings_reusable.py diff --git a/pomodorodiscord/src/reusable/stats_reusable.py b/src/reusable/stats_reusable.py similarity index 100% rename from pomodorodiscord/src/reusable/stats_reusable.py rename to src/reusable/stats_reusable.py diff --git a/pomodorodiscord/src/utils.py b/src/utils.py similarity index 93% rename from pomodorodiscord/src/utils.py rename to src/utils.py index 0928506..5cfa788 100644 --- a/pomodorodiscord/src/utils.py +++ b/src/utils.py @@ -5,7 +5,7 @@ mixer.init() -beep = mixer.Sound('sounds/beep.mp3') +beep = mixer.Sound('src/assets/sounds/beep.mp3') DEF_POMODORO_MINS = 25 @@ -15,6 +15,7 @@ CONFIG_FILE = 'config.json' DATA_FILE = 'data.json' +THEMES_DIR = 'src/assets/themes' def load_file(filename, on_no_file=None): diff --git a/pomodorodiscord/tests/test_pom_frame.py b/tests/test_pom_frame.py similarity index 99% rename from pomodorodiscord/tests/test_pom_frame.py rename to tests/test_pom_frame.py index cc69256..4f4ea77 100644 --- a/pomodorodiscord/tests/test_pom_frame.py +++ b/tests/test_pom_frame.py @@ -16,7 +16,6 @@ class TestPomodoroFrame(unittest.TestCase): @ignore_warnings def setUp(self): - global root self.config = load_config() self.pomodoro_frame = PomodoroFrame(None) diff --git a/pomodorodiscord/tests/test_utils.py b/tests/test_utils.py similarity index 100% rename from pomodorodiscord/tests/test_utils.py rename to tests/test_utils.py