Changeset 764:8fd245311db5


Ignore:
Timestamp:
02/21/16 10:18:43 (8 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The entry exam is called in the browser when requested and the status is displayed in text as well (re #285)

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r763 r764  
    22912291"and the check flight here."
    22922292
     2293msgid "student_entry_exam_status"
     2294msgstr "Entry exam:"
     2295
     2296msgid "student_entry_exam_passed"
     2297msgstr "<span color=\"darkgreen\"><b>Passed</b></span>"
     2298
     2299msgid "student_entry_exam_not_passed"
     2300msgstr "<span color=\"orange\"><b>Not yet passed</b></span>"
     2301
    22932302msgid "student_entry_exam"
    22942303msgstr "Take the _entry exam"
     
    22972306msgstr ""
    22982307"Click this button to go to MAVA's training website in your browser 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."
     2308"the theoretical entry exam. The website might ask you for login: you can "
     2309"use your MAVA pilot ID (PXXX) and password. "
     2310"If this button is greyed out, it means that you have already passed "
     2311"the exam earlier. Note, that its status is updated only a few minutes "
     2312"after passing the exam."
  • locale/hu/mlx.po

    r762 r764  
    23072307"és az ellenőrző repülést."
    23082308
     2309msgid "student_entry_exam_status"
     2310msgstr "Elméleti vizsga:"
     2311
     2312msgid "student_entry_exam_passed"
     2313msgstr "<span color=\"darkgreen\"><b>Sikeres</b></span>"
     2314
     2315msgid "student_entry_exam_not_passed"
     2316msgstr "<span color=\"orange\"><b>Még nem tetted le</b></span>"
     2317
    23092318msgid "student_entry_exam"
    23102319msgstr "_Elméleti vizsga"
     
    23142323"Erre a gombra kattintva a MAVA oktatási weboldalára kerülsz "
    23152324"böngésződben és kitöltheted az elméleti vizsga tesztjét. "
     2325"A weboldalon szükség lehet bejelentkezned: ebben az esetben "
     2326"használd a MAVA pilóta azonosítódat (PXXX) és jelszavadat. "
    23162327"Ha a gomb inaktív, a vizsgát korábban már sikeresen teljesítetted. "
    23172328"A gomb állapota csak néhány perccel a vizsga teljesítése után frissül."
  • src/mlx/gui/flight.py

    r762 r764  
    2121import threading
    2222import re
     23import webbrowser
    2324
    2425#-----------------------------------------------------------------------------
     
    13781379                                  xscale = 0.5, yscale = 0.0)
    13791380
    1380         table = gtk.Table(1, 1)
     1381        table = gtk.Table(2, 2)
    13811382        table.set_row_spacings(4)
    13821383        table.set_col_spacings(32)
     1384        table.set_homogeneous(False)
    13831385        alignment.add(table)
    13841386        self.setMainWidget(alignment)
    13851387
    13861388        row = 0
     1389
     1390        labelAlignment = gtk.Alignment(xalign=0.0, yalign = 0.5,
     1391                                       xscale=0.0, yscale = 0.0)
     1392        label = gtk.Label(xstr("student_entry_exam_status"))
     1393        labelAlignment.add(label)
     1394        table.attach(labelAlignment, 0, 1, row, row + 1, xoptions = 0)
     1395
     1396        alignment = gtk.Alignment(xalign=0.0, yalign = 0.5,
     1397                                  xscale=1.0, yscale = 0.0)
     1398        self._entryExamStatus = gtk.Label()
     1399        self._entryExamStatus.set_use_markup(True)
     1400        self._entryExamStatus.set_alignment(0.0, 0.5)
     1401        alignment.add(self._entryExamStatus)
     1402        table.attach(alignment, 1, 2, row, row + 1)
     1403
     1404        row += 1
    13871405
    13881406        buttonAlignment = gtk.Alignment(xalign=0.0, xscale=1.0)
     
    13931411
    13941412        buttonAlignment.add(button)
    1395         table.attach(buttonAlignment, 0, 1, 0, 1)
     1413        table.attach(buttonAlignment, 0, 2, row, row + 1,
     1414                     ypadding = 4)
    13961415
    13971416    def activate(self):
    13981417        """Activate the student page."""
    13991418        loginResult = self._wizard.loginResult
    1400         self._entryExamButton.set_sensitive(not loginResult.entryExamPassed)
     1419        self._entryExamLink = loginResult.entryExamLink
     1420
     1421        self._updateEntryExamStatus(loginResult.entryExamPassed)
     1422
    14011423        self._getEntryExamStatus()
    14021424
    14031425    def _entryExamClicked(self, button):
    14041426        """Called when the entry exam button is clicked."""
     1427        webbrowser.open(self._entryExamLink)
    14051428
    14061429    def _getEntryExamStatus(self):
     
    14181441        print "_handleEntryExamStatus", returned, result
    14191442        if returned:
    1420             self._entryExamButton.set_sensitive(not result.entryExamPassed)
     1443            self._entryExamLink = result.entryExamLink
     1444            self._updateEntryExamStatus(result.entryExamPassed)
    14211445            self._getEntryExamStatus()
     1446
     1447    def _updateEntryExamStatus(self, passed):
     1448        """Update the entry exam status display and button."""
     1449        self._entryExamStatus.set_text(xstr("student_entry_exam_passed")
     1450                                       if passed else
     1451                                       xstr("student_entry_exam_not_passed"))
     1452        self._entryExamStatus.set_use_markup(True)
     1453        self._entryExamButton.set_sensitive(not passed)
    14221454
    14231455#-----------------------------------------------------------------------------
  • src/mlx/rpc.py

    r761 r764  
    261261        value = self._performCall(lambda sessionID:
    262262                                  self._server.getEntryExamStatus(sessionID))
    263         return (value["entryExamPassed"], value["checkFlightStatus"])
     263        return (value["entryExamPassed"], value["entryExamLink"],
     264                value["checkFlightStatus"])
    264265
    265266    def getFleet(self):
  • src/mlx/web.py

    r761 r764  
    739739                reply = self._client.getEntryExamStatus()
    740740                result.entryExamPassed = reply[0]
    741                 result.checkFlightStatus = reply[1]
     741                result.entryExamLink = reply[1]
     742                result.checkFlightStatus = reply[2]
    742743
    743744        return result
     
    758759
    759760        result.entryExamPassed = reply[0]
    760         result.checkFlightStatus = reply[1]
     761        result.entryExamLink = reply[1]
     762        result.checkFlightStatus = reply[2]
    761763
    762764        return result
Note: See TracChangeset for help on using the changeset viewer.