diff options
author | Alex <acj3840@rit.edu> | 2010-07-20 19:39:36 (GMT) |
---|---|---|
committer | Alex <acj3840@rit.edu> | 2010-07-20 19:39:36 (GMT) |
commit | e229d96de23b187d2a538372d90ad38ffae15400 (patch) | |
tree | 556d8f11467ca831fe0bac93702c7c93e4f1b613 | |
parent | c5273fa2727e2ccbcd862c5403e349e3fd47a73a (diff) |
added second screen to teacher
wait for timer to run out after hitting question button to see 2nd screen
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | popquiz.py | 81 |
2 files changed, 83 insertions, 5 deletions
@@ -1,3 +1,10 @@ +7-20-2010 (8 days till hydro thunder hurricane hits xbla!) +added another screen for teacher +shows students and details will display details about selected student when we have real details to show +next question should make question screen reappear but doesnt +need help accessing activities canvas currently i do it with global but thats wrong and doesnt always work +wait for timer to run out in the 1st screen for teacher (after hitting question button) to see 2nd screen + 7-19-2010 Going to need a little further thinking in proper implemtation and handling of networking, let me know if you have any ideas. @@ -30,9 +30,13 @@ WRONG1ANSWER = "wrong1answer" WRONG2ANSWER = "wrong2answer" WRONG3ANSWER = "wrong3answer" TIMER = 10 +STUDENTS = [ [ "Student1" ], [ "Student2" ], [ "Student3" ], [ "Student4" ], [ "Student5" ] ] +SELECTEDSTUDENT = "Student0" +POPQUIZ = "" class PopQuiz(activity.Activity): def __init__(self, handle): + global POPQUIZ activity.Activity.__init__(self, handle) logging.debug('logger setup') @@ -40,8 +44,8 @@ class PopQuiz(activity.Activity): logging.debug(self.shared_activity) logging.debug(self._share_id) logging.debug(self._join_id) - if self._shared_activity: - #if False: #####remove eventually#### + #if self._shared_activity: + if False: logging.debug('joining an activity') #joining an activity self.connect('joined', self._joined_cb) @@ -73,6 +77,8 @@ class PopQuiz(activity.Activity): toolbar_box.toolbar.insert(StopButton(self), -1) toolbar_box.show_all() + POPQUIZ = self + def _shared_cb(self, activity): logger.debug('Popquiz was shared') self._setup() @@ -119,7 +125,6 @@ class Student(): def __init__(self): #activity.Activity.__init__(self, handle) - global QUESTION global CORRECTANSWER global WRONG1ANSWER @@ -253,6 +258,67 @@ class Teacher(): personaltimer = 999999999 + def students_answered(self): + global STUDENTS + global POPQUIZ + + vboxholdsall = gtk.VBox() + vboxholdsall.show() + + title = [ "Student Names" ] + + #get list of students and stats + ###### + + #setup scroll window + scrollwindow = gtk.ScrolledWindow() + scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + scrollwindow.show() + + #set up clist + clist = gtk.CList(1, title) + clist.connect("select_row", self.student_selected) + clist.show() + + #add students to clist + for index in range(len(STUDENTS)): + clist.append(STUDENTS[index]) + + scrollwindow.add(clist) + vboxholdsall.pack_start(scrollwindow, True, True, 10) + + #create buttons at the bottom for continuing and showing student info + hboxbuttons = gtk.HBox() + hboxbuttons.show() + + detailsbutton = gtk.Button("Details") + detailsbutton.show() + nextquestionbutton = gtk.Button("Next Question") + nextquestionbutton.show() + detailsbutton.connect("clicked", self.display_student) + nextquestionbutton.connect("clicked", self.next_question) + hboxbuttons.pack_start(detailsbutton, True, True, 10) + hboxbuttons.pack_start(nextquestionbutton, True, True, 10) + vboxholdsall.pack_start(hboxbuttons, False, True, 10) + self.vboxholdsall = vboxholdsall + POPQUIZ.set_canvas(self.vboxholdsall) + + def student_selected(self, clist, row, column, event, data=None): + global STUDENTS + global SELECTEDSTUDENT + + SELECTEDSTUDENT = clist.get_text(row, column) + + def display_student(self, data): + global SELECTEDSTUDENT + + logging.debug(SELECTEDSTUDENT) + #display info based on the SELECTEDSTUDENT + + def next_question(self, data): + self.question_screen() + + def countdown(self): logging.debug('countdown method') logging.debug(str(self.personaltimer)) @@ -265,8 +331,9 @@ class Teacher(): gobject.timeout_add(1000, self.countdown) else: logging.debug('time has run out') + self.students_answered() - def sendquestion(self, widget, data = None): + def send_question(self, widget, data = None): logging.debug('sendquestion method') global QUESTION global CORRECTANSWER @@ -312,6 +379,10 @@ class Teacher(): #activity.Activity.__init__(self, handle) + self.question_screen() + + def question_screen(self): + #box for formatting vboxholdsall = gtk.VBox() vboxholdsall.show() @@ -406,7 +477,7 @@ class Teacher(): self.sendbutton.show() #connect button - self.sendbutton.connect("clicked", self.sendquestion) + self.sendbutton.connect("clicked", self.send_question) logging.debug('connected button in teacher') #pack hboxbottom |