Skip to content

Commit

Permalink
Merge pull request #1 from YanivDorGalron/better_destory
Browse files Browse the repository at this point in the history
Better destory
  • Loading branch information
YanivDorGalron authored Sep 26, 2024
2 parents af7bdbe + a9c7f5e commit bf4a0ec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions FocusApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ def __init__(self):
self.load_stats()
self.create_widgets()
self.after(1000, self.update_timers)
self.protocol("WM_DELETE_WINDOW", self.on_close)

def on_close(self):
if self.is_focus_running:
if messagebox.askyesno("Quit", "Do you really want to quit?"):
destroy = True
self.save_stats() # Save stats before closing
else:
destroy = True

if destroy:
self.quit()
self.destroy()


def create_widgets(self):
self.grid_columnconfigure(0, weight=1)
Expand Down Expand Up @@ -143,6 +157,7 @@ def start_focus_session(self):
return
self.elapsed_time = 0
self.is_paused = False
self.task_label.configure(text=f"Current Task: {self.task}")
self.pause_button.configure(state="normal")
self.stop_button.configure(state="normal")
self.start_time = datetime.datetime.utcnow()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To create an executable file using PyInstaller, follow these steps:

2. Command to create executable:
```
pyinstaller --add-data "sounds;sounds" FocusApp.py --name FocusApp --noconsole --add-data "cred.json;."
pyinstaller --add-data "sounds;sounds" FocusApp.py --name FocusApp --noconsole --add-data "cred.json;. --onefile"
```
3. The executable file will be generated in the `dist` folder.
Expand Down
Binary file renamed dist/FocusApp.exe → dist/FocusApp1.exe
Binary file not shown.
Binary file modified requirements.txt
Binary file not shown.

0 comments on commit bf4a0ec

Please sign in to comment.