Skip to content

Commit 7a33920

Browse files
committed
More Bug Fixes
- Changed reset mechanism to avoid bugs - Fixed graphs being out of sync
1 parent cc0f646 commit 7a33920

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

Package/data_management.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ def clear_graph_lists(self) -> None:
225225

226226

227227
def collect_day_data(self) -> None:
228-
self.monday_duration = int(self.worksheet["W2"].value)
229-
self.tuesday_duration = int(self.worksheet["W3"].value)
230-
self.wednesday_duration = int(self.worksheet["W4"].value)
231-
self.thursday_duration = int(self.worksheet["W5"].value)
232-
self.friday_duration = int(self.worksheet["W6"].value)
233-
self.saturday_duration = int(self.worksheet["W7"].value)
234-
self.sunday_duration = int(self.worksheet["W8"].value)
228+
self.monday_duration = round(self.worksheet["W2"].value)
229+
self.tuesday_duration = round(self.worksheet["W3"].value)
230+
self.wednesday_duration = round(self.worksheet["W4"].value)
231+
self.thursday_duration = round(self.worksheet["W5"].value)
232+
self.friday_duration = round(self.worksheet["W6"].value)
233+
self.saturday_duration = round(self.worksheet["W7"].value)
234+
self.sunday_duration = round(self.worksheet["W8"].value)
235235

236236
self.day_duration_list = [self.monday_duration, self.tuesday_duration, self.wednesday_duration, self.thursday_duration, self.friday_duration, self.saturday_duration, self.sunday_duration]
237237

main.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import random
33
from PIL import Image
4+
import sys
45

56
import datetime
67
import openpyxl as op
@@ -590,7 +591,7 @@ def _format_func(value, tick_number):
590591

591592
def create_weekday_graph(self, frame) -> None:
592593
self.data_manager.collect_day_data()
593-
594+
print(self.data_manager.day_duration_list)
594595
if self.data_manager.day_duration_list:
595596
non_zero_durations = [duration for duration in self.data_manager.day_duration_list if duration != 0]
596597
non_zero_names = [name for name, duration in zip(self.data_manager.day_name_list, self.data_manager.day_duration_list) if duration != 0]
@@ -1026,21 +1027,11 @@ def reset_data(self) -> None:
10261027
button_hover_color=self.data_manager.highlight_color, font=(font_family, font_size), text_color=self.data_manager.font_color, button_text_color="black")
10271028
if reset_messagebox.get() == "Yes":
10281029
os.remove(self.data_file)
1029-
self.timer_manager.timer_running = False
1030-
self.timer_manager.break_running = False
1031-
self.reset_gui_values()
1032-
self.clear_hisotry()
1033-
1034-
self._file_setup()
1030+
self.restart_program()
10351031

10361032
print("Data reset.")
10371033

10381034

1039-
def clear_hisotry(self):
1040-
for widget in self.history_data_frame.winfo_children():
1041-
widget.destroy()
1042-
1043-
10441035
def scroll(self, direction: str) -> None:
10451036
if self.scrolling:
10461037
return
@@ -1160,6 +1151,11 @@ def change_focus(self, event) -> None:
11601151
def run(self) -> None:
11611152
self.WINDOW.mainloop()
11621153

1154+
1155+
def restart_program(self) -> None:
1156+
python = sys.executable
1157+
os.execl(python, python, *sys.argv)
1158+
11631159

11641160
if __name__ == "__main__":
11651161
App().run()

0 commit comments

Comments
 (0)