Changeset 764:8fd245311db5 for src/mlx


Ignore:
Timestamp:
02/21/16 10:18:43 (9 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)

Location:
src/mlx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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.