Changeset 45:0938977d6603


Ignore:
Timestamp:
03/18/12 16:50:52 (12 years ago)
Author:
István Váradi <locvais@…>
Branch:
default
Phase:
public
Message:

Added option to remember the password as well as mnemonics and tooltips

Location:
src/mlx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/config.py

    r43 r45  
    2323        self._pilotID = ""
    2424        self._password = ""
     25        self._rememberPassword = False
    2526
    2627        self._autoUpdate = True       
     
    5152        if password!=self._password:
    5253            self._password = password
     54            self._modified = True
     55
     56    @property
     57    def rememberPassword(self):
     58        """Get if we should remember the password."""
     59        return self._rememberPassword
     60
     61    @rememberPassword.setter
     62    def rememberPassword(self, rememberPassword):
     63        """Set if we should remember the password."""
     64        if rememberPassword!=self._rememberPassword:
     65            self._rememberPassword = rememberPassword
    5366            self._modified = True
    5467
     
    8497        self._pilotID = self._get(config, "login", "id", "")
    8598        self._password = self._get(config, "login", "password", "")
     99        self._rememberPassword = self._getBoolean(config, "login",
     100                                                  "rememberPassword", False)
    86101
    87102        self._autoUpdate = self._getBoolean(config, "update", "auto", True)
     
    100115        config.set("login", "id", self._pilotID)
    101116        config.set("login", "password", self._password)
     117        config.set("login", "rememberPassword",
     118                   "yes" if self._rememberPassword else "no")
    102119
    103120        config.add_section("update")
    104         config.set("update", "auto", self._autoUpdate)
     121        config.set("update", "auto",
     122                   "yes" if self._autoUpdate else "no")
    105123        config.set("update", "url", self._updateURL)
    106124
  • src/mlx/gui/flight.py

    r44 r45  
    8585        super(LoginPage, self).__init__(wizard, "Login", help)
    8686
    87         table = gtk.Table(2, 2)
     87        table = gtk.Table(2, 3)
    8888        table.set_row_spacings(4)
    8989        table.set_col_spacings(32)
     
    9191
    9292        labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
    93         labelAlignment.add(gtk.Label("Pilot ID:"))
     93        label = gtk.Label("Pilot _ID:")
     94        label.set_use_underline(True)
     95        labelAlignment.add(label)
    9496        table.attach(labelAlignment, 0, 1, 0, 1)
    9597
    9698        self._pilotID = gtk.Entry()
    9799        self._pilotID.connect("changed", self._setLoginButton)
     100        self._pilotID.set_tooltip_text("Enter your MAVA pilot's ID. This "
     101                                       "usually starts with a "
     102                                       "'P' followed by 3 digits.")
    98103        table.attach(self._pilotID, 1, 2, 0, 1)
     104        label.set_mnemonic_widget(self._pilotID)
    99105
    100106        labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0)
    101         labelAlignment.add(gtk.Label("Password:"))
     107        label = gtk.Label("_Password:")
     108        label.set_use_underline(True)
     109        labelAlignment.add(label)
    102110        table.attach(labelAlignment, 0, 1, 1, 2)
    103111
     
    105113        self._password.set_visibility(False)
    106114        self._password.connect("changed", self._setLoginButton)
     115        self._password.set_tooltip_text("Enter the password for your pilot's ID")
    107116        table.attach(self._password, 1, 2, 1, 2)
    108 
    109         self._loginButton = self.addButton("Login")
     117        label.set_mnemonic_widget(self._password)
     118
     119        self._rememberButton = gtk.CheckButton("_Remember password")
     120        self._rememberButton.set_use_underline(True)
     121        self._rememberButton.set_tooltip_text("If checked, your password will "
     122                                              "be stored, so that you should "
     123                                              "not have to enter it every time. "
     124                                              "Note, however, that the password "
     125                                              "is stored as text, and anybody "
     126                                              "who can access your files will "
     127                                              "be able to read it.")
     128        table.attach(self._rememberButton, 1, 2, 2, 3, ypadding = 8)
     129
     130        self._loginButton = self.addButton("_Login")
    110131        self._loginButton.set_sensitive(False)
     132        self._loginButton.set_use_underline(True)
    111133        self._loginButton.connect("clicked", self._loginClicked)
     134        self._loginButton.set_tooltip_text("Click to log in.")
    112135       
    113136        config = self._wizard.gui.config
    114137        self._pilotID.set_text(config.pilotID)
    115138        self._password.set_text(config.password)
     139        self._rememberButton.set_active(config.rememberPassword)
    116140
    117141    def _setLoginButton(self, entry):
     
    138162            if result.loggedIn:
    139163                config = self._wizard.gui.config
     164
    140165                config.pilotID = self._pilotID.get_text()
    141                 config.password = self._password.get_text()
     166
     167                rememberPassword = self._rememberButton.get_active()               
     168                config.password = self._password.get_text() if rememberPassword  \
     169                                  else ""
     170
     171                config.rememberPassword = rememberPassword
     172               
    142173                config.save()
    143174                self._wizard.nextPage()
Note: See TracChangeset for help on using the changeset viewer.