Changeset 762:c49eee53b7c5


Ignore:
Timestamp:
02/14/16 14:31:32 (9 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The student page is displayed with proper title, help and the entrance exam button updated based on the completion state of the exam (re #285)

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r759 r762  
    22822282msgid "register_result_title"
    22832283msgstr "Registration"
     2284
     2285msgid "student_title"
     2286msgstr "Student"
     2287
     2288msgid "student_help"
     2289msgstr ""
     2290"You can initiate the entrace exam\n"
     2291"and the check flight here."
     2292
     2293msgid "student_entry_exam"
     2294msgstr "Take the _entry exam"
     2295
     2296msgid "student_entry_exam_tooltip"
     2297msgstr ""
     2298"Click this button to go to MAVA's training website and take "
     2299"the theoretical entry exam. If this button is greyed out, "
     2300"it means that you have already passed the exam earlier. Note, that "
     2301"its status is updated only a few minutes after passing the exam."
  • locale/hu/mlx.po

    r759 r762  
    22982298msgid "register_result_title"
    22992299msgstr "Regisztráció"
     2300
     2301msgid "student_title"
     2302msgstr "Tanuló"
     2303
     2304msgid "student_help"
     2305msgstr ""
     2306"Itt intézheted a felvételi elméleti vizsgát\n"
     2307"és az ellenőrző repülést."
     2308
     2309msgid "student_entry_exam"
     2310msgstr "_Elméleti vizsga"
     2311
     2312msgid "student_entry_exam_tooltip"
     2313msgstr ""
     2314"Erre a gombra kattintva a MAVA oktatási weboldalára kerülsz "
     2315"böngésződben és kitöltheted az elméleti vizsga tesztjét. "
     2316"Ha a gomb inaktív, a vizsgát korábban már sikeresen teljesítetted. "
     2317"A gomb állapota csak néhány perccel a vizsga teljesítése után frissül."
  • src/mlx/gui/flight.py

    r760 r762  
    13671367class StudentPage(Page):
    13681368    """A page displayed to students after logging in."""
     1369    _entryExamStatusQueryInterval = 60*1000
     1370
    13691371    def __init__(self, wizard):
    13701372        """Construct the student page."""
     
    13721374                                          xstr("student_title"),
    13731375                                          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()
    13741422
    13751423#-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.