Playing with sensitivity and jumping between widgets based on equality of the password and confirmation entries is confusing and may cause problems. The confirmation entry cannot be clicked when the password entry is being eddited, only TAB works for switching into it. And jumping to the save button when the confirmation entry equals the password entry may lead in an incomplete password entered and "confirmed".
Hitting ENTER in one of the entries may click the Save button if both entries have the same string.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/gui/spokes/lib/passphrase.glade | 2 ++ pyanaconda/ui/gui/spokes/lib/passphrase.py | 29 +++++++++------------------ 2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.glade b/pyanaconda/ui/gui/spokes/lib/passphrase.glade index ccff718..731019a 100644 --- a/pyanaconda/ui/gui/spokes/lib/passphrase.glade +++ b/pyanaconda/ui/gui/spokes/lib/passphrase.glade @@ -117,6 +117,7 @@ <property name="width_chars">32</property> <signal name="changed" handler="on_passphrase_changed" swapped="no"/> <signal name="focus-out-event" handler="on_passphrase_editing_done" swapped="no"/> + <signal name="activate" handler="on_entry_activated" swapped="no"/> </object> <packing> <property name="left_attach">1</property> @@ -149,6 +150,7 @@ <property name="invisible_char">●</property> <property name="width_chars">32</property> <signal name="changed" handler="on_confirm_changed" swapped="no"/> + <signal name="activate" handler="on_entry_activated" swapped="no"/> <signal name="focus-out-event" handler="on_confirm_editing_done" swapped="no"/> </object> <packing> diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py index 83379ef..bc7251b 100644 --- a/pyanaconda/ui/gui/spokes/lib/passphrase.py +++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py @@ -84,7 +84,6 @@ class PassphraseDialog(GUIObject):
if not self.passphrase: self._save_button.set_sensitive(False) - self._confirm_entry.set_sensitive(False)
self._passphrase_entry.set_text(self.passphrase) self._confirm_entry.set_text(self.passphrase) @@ -129,37 +128,28 @@ class PassphraseDialog(GUIObject):
def on_passphrase_changed(self, entry): self._update_passphrase_strength() - if self._confirm_entry.get_text(): - self._confirm_entry.set_text("") + if not self._save_button.get_sensitive() and \ + entry.get_text() == self._confirm_entry.get_text(): self._set_entry_icon(self._confirm_entry, "", "") + self._save_button.set_sensitive(True) + else: + self._save_button.set_sensitive(False)
if not self._pwq_error: self._set_entry_icon(entry, "", "")
- self._save_button.set_sensitive(False) - self._confirm_entry.set_sensitive(False) - def on_passphrase_editing_done(self, entry, *args): - sensitive = True if self._pwq_error: icon = "gtk-dialog-error" msg = _(ERROR_WEAK) % self._pwq_error sensitive = False self._set_entry_icon(entry, icon, msg)
- self._confirm_entry.set_sensitive(sensitive) - if sensitive: - self._confirm_entry.grab_focus() - - return True - def on_confirm_changed(self, entry): if not self._save_button.get_sensitive() and \ entry.get_text() == self._passphrase_entry.get_text(): - self._save_button.set_sensitive(True) - self._save_button.grab_focus() - self._save_button.grab_default() self._set_entry_icon(entry, "", "") + self._save_button.set_sensitive(True)
def on_confirm_editing_done(self, entry, *args): passphrase = self._passphrase_entry.get_text() @@ -169,10 +159,11 @@ class PassphraseDialog(GUIObject): msg = ERROR_NOT_MATCHING self._set_entry_icon(entry, icon, _(msg)) self._save_button.set_sensitive(False) - else: - self._save_button.grab_focus() - self._save_button.grab_default()
def on_save_clicked(self, button): self.passphrase = self._passphrase_entry.get_text()
+ def on_entry_activated(self, entry): + if self._save_button.get_sensitive() and \ + entry.get_text() == self._passphrase_entry.get_text(): + self._save_button.emit("clicked")
On Fri, Sep 06, 2013 at 03:35:28PM +0200, Vratislav Podzimek wrote:
Playing with sensitivity and jumping between widgets based on equality of the password and confirmation entries is confusing and may cause problems. The confirmation entry cannot be clicked when the password entry is being eddited, only TAB works for switching into it. And jumping to the save button when the confirmation entry equals the password entry may lead in an incomplete password entered and "confirmed".
Hitting ENTER in one of the entries may click the Save button if both entries have the same string.
Looks like this solves 921948. I wasn't able to reproduce it at the time IIRC and had let it sit.
def on_confirm_changed(self, entry): if not self._save_button.get_sensitive() and \ entry.get_text() == self._passphrase_entry.get_text():
self._save_button.set_sensitive(True)self._save_button.grab_focus()self._save_button.grab_default() self._set_entry_icon(entry, "", "")
self._save_button.set_sensitive(True)
I think this should mirror the password changed behavior and set sensitive to False when it doesn't match. eg. If I set matching passwords, then type more into the top entry the button goes insensitive. But if I add more to the confirm entry it stays sensitive until I switch to the top or hit tab.
On Fri, 2013-09-06 at 11:18 -0700, Brian C. Lane wrote:
On Fri, Sep 06, 2013 at 03:35:28PM +0200, Vratislav Podzimek wrote:
Playing with sensitivity and jumping between widgets based on equality of the password and confirmation entries is confusing and may cause problems. The confirmation entry cannot be clicked when the password entry is being eddited, only TAB works for switching into it. And jumping to the save button when the confirmation entry equals the password entry may lead in an incomplete password entered and "confirmed".
Hitting ENTER in one of the entries may click the Save button if both entries have the same string.
Looks like this solves 921948. I wasn't able to reproduce it at the time IIRC and had let it sit.
Yeah, I'll add the bug number to the patch.
def on_confirm_changed(self, entry): if not self._save_button.get_sensitive() and \ entry.get_text() == self._passphrase_entry.get_text():
self._save_button.set_sensitive(True)self._save_button.grab_focus()self._save_button.grab_default() self._set_entry_icon(entry, "", "")
self._save_button.set_sensitive(True)I think this should mirror the password changed behavior and set sensitive to False when it doesn't match. eg. If I set matching passwords, then type more into the top entry the button goes insensitive. But if I add more to the confirm entry it stays sensitive until I switch to the top or hit tab.
Good point, thanks, fixing locally.
Playing with sensitivity and jumping between widgets based on equality of the password and confirmation entries is confusing and may cause problems. The confirmation entry cannot be clicked when the password entry is being eddited, only TAB works for switching into it. And jumping to the save button when the confirmation entry equals the password entry may lead in an incomplete password entered and "confirmed".
Hitting ENTER in one of the entries may click the Save button if both entries have the same non-empty string.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/gui/spokes/lib/passphrase.glade | 2 ++ pyanaconda/ui/gui/spokes/lib/passphrase.py | 34 ++++++++++----------------- 2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.glade b/pyanaconda/ui/gui/spokes/lib/passphrase.glade index ccff718..731019a 100644 --- a/pyanaconda/ui/gui/spokes/lib/passphrase.glade +++ b/pyanaconda/ui/gui/spokes/lib/passphrase.glade @@ -117,6 +117,7 @@ <property name="width_chars">32</property> <signal name="changed" handler="on_passphrase_changed" swapped="no"/> <signal name="focus-out-event" handler="on_passphrase_editing_done" swapped="no"/> + <signal name="activate" handler="on_entry_activated" swapped="no"/> </object> <packing> <property name="left_attach">1</property> @@ -149,6 +150,7 @@ <property name="invisible_char">●</property> <property name="width_chars">32</property> <signal name="changed" handler="on_confirm_changed" swapped="no"/> + <signal name="activate" handler="on_entry_activated" swapped="no"/> <signal name="focus-out-event" handler="on_confirm_editing_done" swapped="no"/> </object> <packing> diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py index 83379ef..9c77c18 100644 --- a/pyanaconda/ui/gui/spokes/lib/passphrase.py +++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py @@ -84,7 +84,6 @@ class PassphraseDialog(GUIObject):
if not self.passphrase: self._save_button.set_sensitive(False) - self._confirm_entry.set_sensitive(False)
self._passphrase_entry.set_text(self.passphrase) self._confirm_entry.set_text(self.passphrase) @@ -129,37 +128,27 @@ class PassphraseDialog(GUIObject):
def on_passphrase_changed(self, entry): self._update_passphrase_strength() - if self._confirm_entry.get_text(): - self._confirm_entry.set_text("") + if entry.get_text() and entry.get_text() == self._confirm_entry.get_text(): self._set_entry_icon(self._confirm_entry, "", "") + self._save_button.set_sensitive(True) + else: + self._save_button.set_sensitive(False)
if not self._pwq_error: self._set_entry_icon(entry, "", "")
- self._save_button.set_sensitive(False) - self._confirm_entry.set_sensitive(False) - def on_passphrase_editing_done(self, entry, *args): - sensitive = True if self._pwq_error: icon = "gtk-dialog-error" msg = _(ERROR_WEAK) % self._pwq_error - sensitive = False self._set_entry_icon(entry, icon, msg)
- self._confirm_entry.set_sensitive(sensitive) - if sensitive: - self._confirm_entry.grab_focus() - - return True - def on_confirm_changed(self, entry): - if not self._save_button.get_sensitive() and \ - entry.get_text() == self._passphrase_entry.get_text(): - self._save_button.set_sensitive(True) - self._save_button.grab_focus() - self._save_button.grab_default() + if entry.get_text() and entry.get_text() == self._passphrase_entry.get_text(): self._set_entry_icon(entry, "", "") + self._save_button.set_sensitive(True) + else: + self._save_button.set_sensitive(False)
def on_confirm_editing_done(self, entry, *args): passphrase = self._passphrase_entry.get_text() @@ -170,9 +159,12 @@ class PassphraseDialog(GUIObject): self._set_entry_icon(entry, icon, _(msg)) self._save_button.set_sensitive(False) else: - self._save_button.grab_focus() - self._save_button.grab_default() + self._set_entry_icon(entry, "", "")
def on_save_clicked(self, button): self.passphrase = self._passphrase_entry.get_text()
+ def on_entry_activated(self, entry): + if self._save_button.get_sensitive() and \ + entry.get_text() == self._passphrase_entry.get_text(): + self._save_button.emit("clicked")
Looks ok to me.
On 09/09/2013 09:36 AM, Vratislav Podzimek wrote:
Playing with sensitivity and jumping between widgets based on equality of the password and confirmation entries is confusing and may cause problems. The confirmation entry cannot be clicked when the password entry is being eddited, only TAB works for switching into it. And jumping to the save button when the confirmation entry equals the password entry may lead in an incomplete password entered and "confirmed".
Hitting ENTER in one of the entries may click the Save button if both entries have the same non-empty string.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/ui/gui/spokes/lib/passphrase.glade | 2 ++ pyanaconda/ui/gui/spokes/lib/passphrase.py | 34 ++++++++++----------------- 2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.glade b/pyanaconda/ui/gui/spokes/lib/passphrase.glade index ccff718..731019a 100644 --- a/pyanaconda/ui/gui/spokes/lib/passphrase.glade +++ b/pyanaconda/ui/gui/spokes/lib/passphrase.glade @@ -117,6 +117,7 @@ <property name="width_chars">32</property> <signal name="changed" handler="on_passphrase_changed" swapped="no"/> <signal name="focus-out-event" handler="on_passphrase_editing_done" swapped="no"/>
<signal name="activate" handler="on_entry_activated" swapped="no"/> </object> <packing> <property name="left_attach">1</property>@@ -149,6 +150,7 @@ <property name="invisible_char">●</property> <property name="width_chars">32</property> <signal name="changed" handler="on_confirm_changed" swapped="no"/>
<signal name="activate" handler="on_entry_activated" swapped="no"/> <signal name="focus-out-event" handler="on_confirm_editing_done" swapped="no"/> </object> <packing>diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py index 83379ef..9c77c18 100644 --- a/pyanaconda/ui/gui/spokes/lib/passphrase.py +++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py @@ -84,7 +84,6 @@ class PassphraseDialog(GUIObject):
if not self.passphrase: self._save_button.set_sensitive(False)
self._confirm_entry.set_sensitive(False) self._passphrase_entry.set_text(self.passphrase) self._confirm_entry.set_text(self.passphrase)@@ -129,37 +128,27 @@ class PassphraseDialog(GUIObject):
def on_passphrase_changed(self, entry): self._update_passphrase_strength()
if self._confirm_entry.get_text():self._confirm_entry.set_text("")
if entry.get_text() and entry.get_text() == self._confirm_entry.get_text(): self._set_entry_icon(self._confirm_entry, "", "")self._save_button.set_sensitive(True)else:self._save_button.set_sensitive(False) if not self._pwq_error: self._set_entry_icon(entry, "", "")
self._save_button.set_sensitive(False)self._confirm_entry.set_sensitive(False)def on_passphrase_editing_done(self, entry, *args):sensitive = True if self._pwq_error: icon = "gtk-dialog-error" msg = _(ERROR_WEAK) % self._pwq_errorsensitive = False self._set_entry_icon(entry, icon, msg)self._confirm_entry.set_sensitive(sensitive)if sensitive:self._confirm_entry.grab_focus()return Truedef on_confirm_changed(self, entry):if not self._save_button.get_sensitive() and \entry.get_text() == self._passphrase_entry.get_text():self._save_button.set_sensitive(True)self._save_button.grab_focus()self._save_button.grab_default()
if entry.get_text() and entry.get_text() == self._passphrase_entry.get_text(): self._set_entry_icon(entry, "", "")self._save_button.set_sensitive(True)else:self._save_button.set_sensitive(False) def on_confirm_editing_done(self, entry, *args): passphrase = self._passphrase_entry.get_text()@@ -170,9 +159,12 @@ class PassphraseDialog(GUIObject): self._set_entry_icon(entry, icon, _(msg)) self._save_button.set_sensitive(False) else:
self._save_button.grab_focus()self._save_button.grab_default()
self._set_entry_icon(entry, "", "") def on_save_clicked(self, button): self.passphrase = self._passphrase_entry.get_text()def on_entry_activated(self, entry):
if self._save_button.get_sensitive() and \entry.get_text() == self._passphrase_entry.get_text():self._save_button.emit("clicked")
anaconda-patches@lists.fedorahosted.org