-
Notifications
You must be signed in to change notification settings - Fork 18
/
README.techinfo
97 lines (55 loc) · 2.6 KB
/
README.techinfo
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
Some Technical Details
files created:
server:
student answer files, in one directory per student, one big
directoy per exam, all in subdirectory of InstructorDirectory/
client:
ExamQuestions.txt: downloaded questions from server
omsi_answer*: the student's answers
server operation:
OmsiServer.py:
clientMap: dictionary of all clients so far
main loop:
create omsiServer, an instance of the class OmsiServer
repeatedly call awaitConnections()
OmsiServer.awaitConnections():
runs a listening socket, creates a new thread when a call
finally comes in; if new client (new IP), adds client to
self.clientMap; creates socket to pair with client;
launches a thread that runs OmsiServer.requestHandler()
OmsiServer.requestHandler():
loop, waiting for requests from clients
client operation:
OmsiGui.py:
OmsiGui.getConnect():
triggered by user clicking Connect; connect to server;
getQuestionsFromServer()
OmsiGui.updateQuestionBox():
when user clicks on Question n, the text for Question n is then
written to the question box; done by OmsiGui.listboxSelected()
OmsiGui.updateAnswerBox():
when user clicks on Question n, the current answer for Question
n is then written to the answer box
OmsiGui.listboxSelected():
inserts into the question and answer boxes when user clicks on
a question; insert() here is a method in the Tkinter.Text class
uses Tk, so main() sets up a Tk instance 'top', then does
app = OmsiGui(top)
top.mainloop()
to set up an OmsiGui class instance and get things going
widgets were set up in widgets() within that class; clicking one
triggers a method within that class, e.g. saveAnswer()
example of interest: initial connection to server
user clicks Connect, triggers getConnectionInfo()
the latter sets up a dialog box (a dBox), and if successful
connect, then prints out version number, calls
getQuestionsFromServer() to get the file ExamQuestions (but
doesn't parse them)
major classes:
OmsiQuestion, in OmsiQuestion.py:
one instance for each question
stores the question and answer, in fields of those same names, in
plain ASCII
however, note that the question and answer boxes store text in
type Tkinter.Text; self.txt() converts the latter to plain ASCII,
while self.txt.insert() inserts ASCII into a box