From 14fa19c9588da4649a2ca95360b188d328580b2f Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Fri, 16 Mar 2007 19:07:54 +0000 Subject: Display a warning message if caps lock is on (#207894). --- iw/account_gui.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'iw') diff --git a/iw/account_gui.py b/iw/account_gui.py index 2198c62cb..b22fbf54d 100644 --- a/iw/account_gui.py +++ b/iw/account_gui.py @@ -1,7 +1,7 @@ # # account_gui.py: gui root password and user creation dialog # -# Copyright 2000-2002 Red Hat, Inc. +# Copyright 2000-2007 Red Hat, Inc. # # This software may be freely redistributed under the terms of the GNU # library public license. @@ -20,6 +20,14 @@ from iw_gui import * from rhpl.translate import _, N_ from flags import flags +def handleCapsLockRelease(window, event, label): + if event.keyval == gtk.keysyms.Caps_Lock and event.state & gtk.gdk.LOCK_MASK: + if label.get_text() == "": + label.set_text(_("Caps Lock is on.")) + label.set_use_markup(True) + else: + label.set_text("") + class AccountWindow (InstallWindow): windowTitle = N_("Set Root Password") @@ -80,6 +88,12 @@ class AccountWindow (InstallWindow): self.rootPassword = anaconda.id.rootPassword self.intf = anaconda.intf + self.capsLabel = gtk.Label() + self.capsLabel.set_alignment(0.0, 0.5) + + self.intf.icw.window.connect("key-release-event", + lambda w, e: handleCapsLockRelease(w, e, self.capsLabel)) + self.passwords = {} box = gtk.VBox () @@ -100,7 +114,7 @@ class AccountWindow (InstallWindow): box.pack_start(hbox, False) - table = gtk.Table (2, 2) + table = gtk.Table (3, 2) table.set_size_request(365, -1) table.set_row_spacings (5) table.set_col_spacings (5) @@ -121,11 +135,13 @@ class AccountWindow (InstallWindow): pass2.set_mnemonic_widget(self.confirm) self.confirm.connect ("activate", lambda widget, box=box: self.ics.setGrabNext(1)) self.confirm.set_visibility (False) - table.attach (self.pw, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, 5) - table.attach (self.confirm, 1, 2, 1, 2, gtk.FILL|gtk.EXPAND, 5) + table.attach (self.pw, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, 5) + table.attach (self.confirm, 1, 2, 1, 2, gtk.FILL|gtk.EXPAND, 5) + table.attach (self.capsLabel, 1, 2, 2, 3, gtk.FILL|gtk.EXPAND, 5) hbox = gtk.HBox() hbox.pack_start(table, False) + box.pack_start (hbox, False) # root password statusbar -- cgit