Changeset 744:39e770edda2e


Ignore:
Timestamp:
01/02/16 12:29:48 (8 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Added a callback to display the credentials window for logging in to the MAVA website (re #283).

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • locale/en/mlx.po

    r738 r744  
    232232msgid "button_reconnect"
    233233msgstr "_Reconnect"
     234
     235msgid "login_title"
     236msgstr "Login"
     237
     238msgid "login_info"
     239msgstr ""
     240"Enter your MAVA pilot's ID and password to\n"
     241"log in to the MAVA website."
    234242
    235243msgid "login"
  • locale/hu/mlx.po

    r738 r744  
    233233msgstr "Újra_kapcsolódás"
    234234
     235msgid "login_title"
     236msgstr "Bejelentkezés"
     237
     238msgid "login_info"
     239msgstr ""
     240"Írd be a MAVA pilóta azonosítódat és a\n"
     241"bejelentkezéshez használt jelszavadat."
     242
    235243msgid "login"
    236244msgstr "Bejelentkezés"
  • src/mlx/gui/gui.py

    r733 r744  
    8989        self._sendPIREPCallback = None
    9090        self._sendBugReportCallback = None
     91
     92        self._credentialsCondition = threading.Condition()
     93        self._credentialsAvailable = False
     94        self._credentialsUserName = None
     95        self._credentialsPassword = None
    9196
    9297        self.webHandler = web.Handler()
     
    16351640        """Set the anti-ice on indicator."""
    16361641        self._wizard.landingAntiIceOn = value
     1642
     1643    def _getCredentialsCallback(self):
     1644        """Called when the web handler asks for the credentials."""
     1645        # FIXME: this is almost the same as
     1646        # SimBriefSetupPage._getCredentialsCallback
     1647        with self._credentialsCondition:
     1648            self._credentialsAvailable = False
     1649
     1650            gobject.idle_add(self._getCredentials)
     1651
     1652            while not self._credentialsAvailable:
     1653                self._credentialsCondition.wait()
     1654
     1655            return (self._credentialsUserName, self._credentialsPassword)
     1656
     1657    def _getCredentials(self):
     1658        """Get the credentials."""
     1659        # FIXME: this is almost the same as
     1660        # SimBriefSetupPage._getCredentials
     1661        with self._credentialsCondition:
     1662            config = self.config
     1663
     1664            dialog = CredentialsDialog(self, config.pilotID, config.password,
     1665                                       xstr("login_title"),
     1666                                       xstr("button_cancel"),
     1667                                       xstr("button_ok"),
     1668                                       xstr("label_pilotID"),
     1669                                       xstr("login_pilotID_tooltip"),
     1670                                       xstr("label_password"),
     1671                                       xstr("login_password_tooltip"),
     1672                                       xstr("login_info"),
     1673                                       config.rememberPassword,
     1674                                       xstr("remember_password"),
     1675                                       xstr("login_remember_tooltip"))
     1676            response = dialog.run()
     1677
     1678            if response==RESPONSETYPE_OK:
     1679                self._credentialsUserName = dialog.userName
     1680                self._credentialsPassword = dialog.password
     1681                rememberPassword = dialog.rememberPassword
     1682
     1683                config.pilotID = self._credentialsUserName
     1684
     1685                config.password = \
     1686                  self._credentialsPassword if rememberPassword else ""
     1687                config.rememberPassword = rememberPassword
     1688
     1689                config.save()
     1690            else:
     1691                self._credentialsUserName = None
     1692                self._credentialsPassword = None
     1693
     1694            self._credentialsAvailable = True
     1695            self._credentialsCondition.notify()
Note: See TracChangeset for help on using the changeset viewer.