Changeset 762:c49eee53b7c5 for src
- Timestamp:
- 02/14/16 14:31:32 (9 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r760 r762 1367 1367 class StudentPage(Page): 1368 1368 """A page displayed to students after logging in.""" 1369 _entryExamStatusQueryInterval = 60*1000 1370 1369 1371 def __init__(self, wizard): 1370 1372 """Construct the student page.""" … … 1372 1374 xstr("student_title"), 1373 1375 xstr("student_help")) 1376 1377 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1378 xscale = 0.5, yscale = 0.0) 1379 1380 table = gtk.Table(1, 1) 1381 table.set_row_spacings(4) 1382 table.set_col_spacings(32) 1383 alignment.add(table) 1384 self.setMainWidget(alignment) 1385 1386 row = 0 1387 1388 buttonAlignment = gtk.Alignment(xalign=0.0, xscale=1.0) 1389 button = self._entryExamButton = gtk.Button(xstr("student_entry_exam")) 1390 button.set_use_underline(True) 1391 button.connect("clicked", self._entryExamClicked) 1392 button.set_tooltip_text(xstr("student_entry_exam_tooltip")) 1393 1394 buttonAlignment.add(button) 1395 table.attach(buttonAlignment, 0, 1, 0, 1) 1396 1397 def activate(self): 1398 """Activate the student page.""" 1399 loginResult = self._wizard.loginResult 1400 self._entryExamButton.set_sensitive(not loginResult.entryExamPassed) 1401 self._getEntryExamStatus() 1402 1403 def _entryExamClicked(self, button): 1404 """Called when the entry exam button is clicked.""" 1405 1406 def _getEntryExamStatus(self): 1407 """Initiate the query of the entry exam status after the interval.""" 1408 gobject.timeout_add(StudentPage._entryExamStatusQueryInterval, 1409 lambda: self._wizard.gui.webHandler. \ 1410 getEntryExamStatus(self._entryExamStatusCallback)) 1411 1412 def _entryExamStatusCallback(self, returned, result): 1413 """Called when the entry exam status is available.""" 1414 gobject.idle_add(self._handleEntryExamStatus, returned, result) 1415 1416 def _handleEntryExamStatus(self, returned, result): 1417 """Called when the entry exam status is availabe.""" 1418 print "_handleEntryExamStatus", returned, result 1419 if returned: 1420 self._entryExamButton.set_sensitive(not result.entryExamPassed) 1421 self._getEntryExamStatus() 1374 1422 1375 1423 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.