-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDBCLI.py
100 lines (78 loc) · 3.15 KB
/
DBCLI.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import os
import json
from simple_term_menu import TerminalMenu
from NotebookGrader import DBCourse, download_master, upload_generated_assignments
with open("configGrader.json", "r") as f:
conf = json.load(f)
with open("configNotebooks.json", "r") as f:
notebook_conf = json.load(f)
with open("users.json", "r") as f:
user_dict = json.load(f)
download_master(conf,notebook_conf)
course = DBCourse()
def clear():
os.system('cls||clear')
def menu_main():
clear()
print("Welcome to the command line interface for managing the Course on Studium!")
options = ["generate", "grading", "exit"]
terminal_menu = TerminalMenu(options)
menu_entry_index = terminal_menu.show()
if (menu_entry_index == 0):
menu_generate()
menu_main()
if (menu_entry_index == 1):
menu_grade()
menu_main()
def menu_generate():
options = ["course notebooks", "assignment notebooks", "back"]
terminal_menu = TerminalMenu(options)
menu_entry_index = terminal_menu.show()
if (menu_entry_index == 0):
input("Code not integrated into CLI, press any key to go back")
if (menu_entry_index == 1):
menu_assignment_notebooks()
def menu_assignment_notebooks():
options = ["assignment 1", "assignment 2", "assignment 3", "back"]
terminal_menu = TerminalMenu(options)
menu_entry_index = terminal_menu.show()
if (menu_entry_index == 0):
menu_choose_gen_type()
if (menu_entry_index == 1):
input("No assignment 2, press any key to go back")
if (menu_entry_index == 2):
input("No assignment 3, press any key to go back")
def menu_choose_gen_type():
options = ["generate all", "problems", "solutions", "tests", "upload to dbc workspace", "back"]
terminal_menu = TerminalMenu(options)
menu_entry_index = terminal_menu.show()
if (menu_entry_index == 0):
download_master(conf,notebook_conf)
course.makeAssignmentNotebook(assignment_number = 1,notebook_type='problem')
course.makeAssignmentNotebook(assignment_number = 1, notebook_type='solution')
course.makeAssignmentNotebook(assignment_number = 1, notebook_type='problem_TEST')
input("Press Enter to continue...")
menu_choose_gen_type()
if (menu_entry_index == 1):
course.makeAssignmentNotebook(assignment_number = 1,notebook_type='problem')
menu_choose_gen_type()
if (menu_entry_index == 2):
course.makeAssignmentNotebook(assignment_number = 1, notebook_type='solution')
menu_choose_gen_type()
if (menu_entry_index == 3):
course.makeAssignmentNotebook(assignment_number = 1, notebook_type='problem_TEST')
menu_choose_gen_type()
if (menu_entry_index == 4):
upload_generated_assignments(conf,notebook_conf)
input("Press Enter to continue...")
menu_choose_gen_type()
def menu_grade():
#options = [str(ass) for ass in course.assignments]
#terminal_menu = TerminalMenu(options)
#menu_entry_index = terminal_menu.show()
#if (menu_entry_index == 0):
os.system("python3 Grader.py")
def upload():
# use dbc-rest wrapper to upload the generated book
return 0
menu_main()