Only enable the password ok button when password is entered.

This commit is contained in:
Sean Davis 2014-03-02 17:25:09 -05:00
parent c41d513616
commit 46a05ed987
2 changed files with 12 additions and 5 deletions

View File

@ -67,6 +67,7 @@ class SudoDialog(Gtk.MessageDialog):
ok_button.connect("clicked", self.on_ok_clicked)
ok_button.set_receives_default(True)
ok_button.set_can_default(True)
ok_button.set_sensitive(False)
self.set_default(ok_button)
button_box.pack_start(ok_button, False, False, 0)
@ -107,6 +108,8 @@ class SudoDialog(Gtk.MessageDialog):
self.password_entry = Gtk.Entry()
self.password_entry.set_visibility(False)
self.password_entry.set_activates_default(True)
self.password_entry.connect("changed", self._on_password_changed,
ok_button)
# Pack all the widgets.
password_box.pack_start(password_label, False, False, 0)
@ -121,6 +124,10 @@ class SudoDialog(Gtk.MessageDialog):
self.attempted_logins = 0
self.max_attempted_logins = retries
def _on_password_changed(self, widget, button):
"""Set the apply button sensitivity based on password input."""
button.set_sensitive(len(widget.get_text()) > 0)
def format_primary_text(self, message_format):
'''
Format the primary text widget.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-03-02 15:56-0500\n"
"POT-Creation-Date: 2014-03-02 17:24-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -173,23 +173,23 @@ msgstr ""
msgid "OK"
msgstr ""
#: ../mugshot_lib/SudoDialog.py:78
#: ../mugshot_lib/SudoDialog.py:79
msgid ""
"Enter your password to\n"
"perform administrative tasks."
msgstr ""
#: ../mugshot_lib/SudoDialog.py:80
#: ../mugshot_lib/SudoDialog.py:81
#, python-format
msgid ""
"The application '%s' lets you\n"
"modify essential parts of your system."
msgstr ""
#: ../mugshot_lib/SudoDialog.py:101
#: ../mugshot_lib/SudoDialog.py:102
msgid "Incorrect password... try again."
msgstr ""
#: ../mugshot_lib/SudoDialog.py:106
#: ../mugshot_lib/SudoDialog.py:107
msgid "Password:"
msgstr ""