Ticket #277: login.diff

File login.diff, 1.8 kB (added by swordfish, 9 months ago)

Diff to add the requested feature to Login.py module

  • emesene/Login.py

     
    4848         
    4949        lUser = gtk.Label(_('_User:')) 
    5050        lPass = gtk.Label(_('_Password:')) 
     51        self.lCaps = gtk.Label('') 
    5152        lStatus = gtk.Label(_('_Status:')) 
    5253         
    5354        lUser.set_use_underline(True) 
     
    9091        self.tPass = gtk.Entry(128) 
    9192        self.tPass.set_visibility(False) 
    9293        self.tPass.connect('activate' , self.bLogin_clicked) 
     94        self.tPass.connect('key-press-event', self.on_password_keypressed) 
    9395         
    9496        lUser.set_mnemonic_widget(self.tUser) 
    9597        lPass.set_mnemonic_widget(self.tPass) 
     
    124126        self.fieldsBox.pack_start(userBox, False, False) 
    125127         
    126128        passBox = gtk.VBox(spacing=6) 
     129        passLBox = gtk.HBox(spacing=6) 
    127130        lPass.set_alignment(0.0, 0.5) 
    128         passBox.pack_start(lPass , False , False) 
     131        passLBox.pack_start(lPass , False , False) 
     132        passLBox.pack_start(self.lCaps , False , False) 
     133        passBox.pack_start(passLBox , False , False) 
    129134        passBox.pack_start(self.tPass , False , False) 
    130135         
    131136        self.fieldsBox.pack_start(passBox, False, False) 
     
    379384             
    380385        if event.keyval == gtk.keysyms.Return: 
    381386            self.login() 
    382      
     387 
     388    def on_password_keypressed(self, widget, event): 
     389        if (event.state & 0x00000002) == 2:     # Verify caps lock state 
     390            self.lCaps.set_markup('<span foreground="#FF0000">CAPS LOCK enabled</span>') 
     391        elif self.lCaps.get_text(): 
     392            self.lCaps.set_text('') 
     393 
    383394class UserManager(object): 
    384395    '''This class manages the file that hold the user:password data 
    385396    the format of users.dat is: