forked from JackD83/PyMenu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResumeHandler.py
45 lines (39 loc) · 1.06 KB
/
ResumeHandler.py
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
import json, os
lastUsed = None
lastSelectedLine = None
lastPath = None
mainIndex = None
def setLastUsedMain(json, index):
global lastUsed
global mainIndex
lastUsed = json
mainIndex = index
def clearResume():
try:
os.remove("/tmp/resume.json")
except Exception as ex:
return None
def setLastSelectedLine(line):
global lastSelectedLine
lastSelectedLine = line
def setLastPath(path):
global lastPath
lastPath = path
def storeResume():
try:
resume = {}
resume["main"]=lastUsed
resume["mainIndex"]= mainIndex
resume["line"]=lastSelectedLine
resume["path"]=lastPath
#print("Storing resume file: " + str(lastUsed) + " line:"+ str(lastSelectedLine) + " lastPath" + str(lastPath))
with open('/tmp/resume.json', 'w') as fp:
json.dump(resume, fp,sort_keys=True, indent=4)
except Exception as ex:
pass
def getResumeFile():
try:
res = json.load(open('/tmp/resume.json'))
return res
except Exception as ex:
return None