-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodify_tab.py
More file actions
53 lines (37 loc) · 1.21 KB
/
Copy pathmodify_tab.py
File metadata and controls
53 lines (37 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import tkinter as tk
import json
import copy
import add_tab
import globals
import handler
fileName = "tasks.json"
# Every save_dct file is for the JSON's frame error
def del_csv(name):
globals.task_names_dct.pop(name)
save_dct = {}
for names in globals.task_names_dct:
save_dct[names] = globals.task_names_dct[names][1]
try:
with open(fileName, "w", encoding="utf-8") as file:
json.dump(save_dct, file, indent=4)
print("Tasks deleted successfully.")
except Exception as e:
print(f"Error saving tasks: {e}")
def save_tab(label, newName, time):
globals.task_names_dct[newName] = [label, time]
print(globals.task_names_dct)
save_dct = {}
for names in globals.task_names_dct:
save_dct[names] = globals.task_names_dct[names][1]
try:
with open(fileName, "w", encoding="utf-8") as file:
json.dump(save_dct, file, indent=4)
print("Tasks saved successfully.")
except Exception as e:
print(f"Error saving tasks: {e}")
def load_tabs(parent):
dct = copy.copy(globals.task_names_dct)
for name in dct:
time = dct[name]
handler.load_task(parent, name, time)
return dct