Re: [PATCH 1/3] Make the authorization dialog more friendly



On Wed, Aug 19, 2009 at 05:29:50PM +0100, John Haxby wrote:
> Hide the password as the user types it in and allow authentication to
> complete when you hit Enter.
> ---
>  examples/gvncviewer.py |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/gvncviewer.py b/examples/gvncviewer.py
> index 74d284a..2debf76 100644
> --- a/examples/gvncviewer.py
> +++ b/examples/gvncviewer.py
> @@ -90,6 +90,7 @@ def vnc_auth_cred(src, credList):
>  
>      if prompt:
>          dialog = gtk.Dialog("Authentication required", None, 0, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
> +        dialog.set_default_response(gtk.RESPONSE_OK)
>          label = []
>          entry = []
>  
> @@ -97,15 +98,17 @@ def vnc_auth_cred(src, credList):
>  
>          row = 0
>          for i in range(len(credList)):
> +            entry.append(gtk.Entry())
>              if credList[i] == gtkvnc.CREDENTIAL_USERNAME:
>                  label.append(gtk.Label("Username:"))
>              elif credList[i] == gtkvnc.CREDENTIAL_PASSWORD:
>                  label.append(gtk.Label("Password:"))
> +                entry[-1].set_visibility(False)
> +                entry[-1].set_activates_default(True)
>              else:
> +                entry[-1].destroy()
>                  continue
>  
> -            entry.append(gtk.Entry())
> -
>              box.attach(label[row], 0, 1, row, row+1, 0, 0, 3, 3)
>              box.attach(entry[row], 1, 2, row, row+1, 0, 0, 3, 3)
>              row = row + 1

ACK, looks good.


Daniel
-- 
|: http://berrange.com/     -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://freshmeat.net/~danielpb/    -o-   http://gtk-vnc.sourceforge.net :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]