-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.py
82 lines (77 loc) · 2.75 KB
/
ui.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import state
import dfile
import e
def main_ui():
state.compare_states()
import e
if (e.errors != []):
error_stuff()
var = raw_input("What do you want to do?: ")
if (var == "scan"):
state.compare_states()
state.show_attached()
if (var == "save"):
confirm = raw_input("Are you sure, this will overwrite the old state?")
if (confirm == "y"):
print "ok"
current_state = state.make_state()
state.save_entire_state(current_state)
if (confirm == "n"):
print "ok"
if (var == "print old"):
old_state = state.open_state()
state.print_pretty(old_state)
if (var == "print new"):
state.print_pretty(state.current_state)
if (var == "current"):
state.show_attached()
if (var == "errors"):
for error in state.errors:
print error
print state.errors[error]
print "\n"
if (var == "add"):
pass
def error_stuff():
#print "LOOP"
e.print_all
i = 0
for error in e.errors:
edrive = error["Drive"]
print error
if (error["Problem"] == "Unknown_drive"):
print "\n New Drive detected: %s " % edrive
vart = raw_input("Add drive to databse?")
if (vart == "y"):
state.add_drive_to_state(error["Drive"], state.old_state)
state.current_state = state.current_state
e.resolve(i)
if (error["Problem"] == "No_state"):
print "Open state.py, and set a new s_path"
ans = raw_input("Would you like to set a new s_path now?")
if (ans == "y"):
state.s_path = raw_input("Where?")
if (ans == "n"):
pass
q = (raw_input("You can save to the current s_path. y/n"))
if (q == "y"):
confirm = raw_input("Are you sure, this will overwrite the old state?")
if (confirm == "y"):
print "ok"
current_state = state.make_state()
state.save_entire_state(current_state)
if (confirm == "n"):
print "ok"
if (error["Problem"] =="size_mismatch"):
cdrive = error
ans = raw_input("Use current drive data?")
if (ans == "y"):
print "Adding drive %s to state" % cdrive
state.add_drive_to_state(cdrive, state.old_state)
#state.print_pretty(state.current_state)
state.save_entire_state(state.current_state)
state.open_state()
print "state.errors"
print state.errors
del state.errors[cdrive]
main_ui()