FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 07-22-2010, 01:11 PM
Martin Gracik
 
Default Guess user name from full name (#517269)

---
modules/create_user.py | 42 ++++++++++++++++++++++++++++++++++--------
1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/modules/create_user.py b/modules/create_user.py
index ca61f17..c6f249f 100644
--- a/modules/create_user.py
+++ b/modules/create_user.py
@@ -219,8 +219,13 @@ class moduleClass(Module):
label.set_alignment(0.0, 0.5)
label.set_size_request(500, -1)

- self.usernameEntry = gtk.Entry()
self.fullnameEntry = gtk.Entry()
+ self.usernameEntry = gtk.Entry()
+
+ self.guessUserName = True
+ self.fullnameEntry.connect("changed", self.fullnameEntry_changed)
+ self.usernameEntry.connect("changed", self.usernameEntry_changed)
+
self.passwordEntry = gtk.Entry()
self.passwordEntry.set_visibility(False)
self.passwordEntry.set_property("primary-icon-stock",
@@ -238,19 +243,20 @@ class moduleClass(Module):
table = gtk.Table(2, 4)
table.set_row_spacings(6)
table.set_col_spacings(6)
- label = gtk.Label(_("_Username:"))
+
+ label = gtk.Label(_("Full Nam_e:"))
label.set_use_underline(True)
- label.set_mnemonic_widget(self.usernameEntry)
+ label.set_mnemonic_widget(self.fullnameEntry)
label.set_alignment(0.0, 0.5)
table.attach(label, 0, 1, 0, 1, gtk.FILL)
- table.attach(self.usernameEntry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL, 5)
+ table.attach(self.fullnameEntry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL, 5)

- label = gtk.Label(_("Full Nam_e:"))
+ label = gtk.Label(_("_Username:"))
label.set_use_underline(True)
- label.set_mnemonic_widget(self.fullnameEntry)
+ label.set_mnemonic_widget(self.usernameEntry)
label.set_alignment(0.0, 0.5)
table.attach(label, 0, 1, 1, 2, gtk.FILL)
- table.attach(self.fullnameEntry, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5)
+ table.attach(self.usernameEntry, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5)

label = gtk.Label(_("_Password:"))
label.set_use_underline(True)
@@ -304,7 +310,7 @@ class moduleClass(Module):
self.vbox.pack_start(scuHBox, False, False)

def focus(self):
- self.usernameEntry.grab_focus()
+ self.fullnameEntry.grab_focus()

def initializeUI(self):
pass
@@ -355,6 +361,26 @@ class moduleClass(Module):
dlg.destroy()
return None

+ def fullnameEntry_changed(self, fn_entry):
+ if not self.guessUserName:
+ return
+
+ name = fn_entry.get_text()
+ try:
+ user = name.split()[0]
+ except IndexError:
+ user = ""
+ else:
+ user = user.encode("ascii", "ascii_transliterate")
+ user = user.lower()
+
+ self.usernameEntry.handler_block_by_func(self.user nameEntry_changed)
+ self.usernameEntry.set_text(user)
+ self.usernameEntry.handler_unblock_by_func(self.us ernameEntry_changed)
+
+ def usernameEntry_changed(self, un_entry):
+ self.guessUserName = not bool(un_entry.get_text())
+
def passwordEntry_changed(self, entry):
pw = entry.get_text()
if not pw:
--
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-22-2010, 04:02 PM
"Brian C. Lane"
 
Default Guess user name from full name (#517269)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/22/2010 06:11 AM, Martin Gracik wrote:
> ---
> modules/create_user.py | 42 ++++++++++++++++++++++++++++++++++--------
> 1 files changed, 34 insertions(+), 8 deletions(-)

Ack.

- --
Brian C. Lane <bcl@redhat.com>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBTEhrphF+jBaO/jp/AQJlyggAmlePRqHIecbzZQ8xrGKInOH+Su+3JNec
/iFuZoCrGPkn0Wk8MwGoGjWWk4amEej8nAbJ6h0EJPHCz3ZFwGP hK7NO56eugS0V
/9DuySXyaIwhK2ayM5oCOG2TvmkY+5pcYERU7JYqmM5wS0l+tgL XXUlLqjm+lAjO
lPCwpX+/S+zlDxeOdNuxZzZwfqt64pubgXKvdoR5U+8BilSsAn0IUV/vt7U4Q7Sd
V2knqE8zQXAGRXHNqAb2sGl5Oj1D84Tx0mTJvpiYVyw0m8+XyE 4zb9VM+qHhL8aI
8k+MVpTwmMRnTy37ZTN5lDLQe+NMxtDqBCLC4NZonmQhCult0I d7vg==
=+ef7
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 11-10-2010, 08:19 AM
Martin Gracik
 
Default Guess user name from full name (#517269)

---
modules/create_user.py | 42 ++++++++++++++++++++++++++++++++++--------
1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/modules/create_user.py b/modules/create_user.py
index ba37b2b..ee77072 100644
--- a/modules/create_user.py
+++ b/modules/create_user.py
@@ -221,8 +221,13 @@ class moduleClass(Module):
label.set_alignment(0.0, 0.5)
label.set_size_request(500, -1)

- self.usernameEntry = gtk.Entry()
self.fullnameEntry = gtk.Entry()
+ self.usernameEntry = gtk.Entry()
+
+ self.guessUserName = True
+ self.fullnameEntry.connect("changed", self.fullnameEntry_changed)
+ self.usernameEntry.connect("changed", self.usernameEntry_changed)
+
self.passwordEntry = gtk.Entry()
self.passwordEntry.set_visibility(False)
self.passwordEntry.set_property("primary-icon-stock",
@@ -240,19 +245,20 @@ class moduleClass(Module):
table = gtk.Table(2, 4)
table.set_row_spacings(6)
table.set_col_spacings(6)
- label = gtk.Label(_("_Username:"))
+
+ label = gtk.Label(_("Full Nam_e:"))
label.set_use_underline(True)
- label.set_mnemonic_widget(self.usernameEntry)
+ label.set_mnemonic_widget(self.fullnameEntry)
label.set_alignment(0.0, 0.5)
table.attach(label, 0, 1, 0, 1, gtk.FILL)
- table.attach(self.usernameEntry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL, 5)
+ table.attach(self.fullnameEntry, 1, 2, 0, 1, gtk.SHRINK, gtk.FILL, 5)

- label = gtk.Label(_("Full Nam_e:"))
+ label = gtk.Label(_("_Username:"))
label.set_use_underline(True)
- label.set_mnemonic_widget(self.fullnameEntry)
+ label.set_mnemonic_widget(self.usernameEntry)
label.set_alignment(0.0, 0.5)
table.attach(label, 0, 1, 1, 2, gtk.FILL)
- table.attach(self.fullnameEntry, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5)
+ table.attach(self.usernameEntry, 1, 2, 1, 2, gtk.SHRINK, gtk.FILL, 5)

label = gtk.Label(_("_Password:"))
label.set_use_underline(True)
@@ -306,7 +312,7 @@ class moduleClass(Module):
self.vbox.pack_start(scuHBox, False, False)

def focus(self):
- self.usernameEntry.grab_focus()
+ self.fullnameEntry.grab_focus()

def initializeUI(self):
pass
@@ -357,6 +363,26 @@ class moduleClass(Module):
dlg.destroy()
return None

+ def fullnameEntry_changed(self, fn_entry):
+ if not self.guessUserName:
+ return
+
+ name = fn_entry.get_text()
+ try:
+ user = name.split()[0]
+ except IndexError:
+ user = ""
+ else:
+ user = user.encode("ascii", "ascii_transliterate")
+ user = user.lower()
+
+ self.usernameEntry.handler_block_by_func(self.user nameEntry_changed)
+ self.usernameEntry.set_text(user)
+ self.usernameEntry.handler_unblock_by_func(self.us ernameEntry_changed)
+
+ def usernameEntry_changed(self, un_entry):
+ self.guessUserName = not bool(un_entry.get_text())
+
def passwordEntry_changed(self, entry):
pw = entry.get_text()
if not pw:
--
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 11-10-2010, 09:14 AM
Martin Gracik
 
Default Guess user name from full name (#517269)

I forgot to put the subject prefix, this patch is for firstboot, and the other one too

--

Martin Gracik

----- "Martin Gracik" <mgracik@redhat.com> wrote:

> ---
> modules/create_user.py | 42
> ++++++++++++++++++++++++++++++++++--------
> 1 files changed, 34 insertions(+), 8 deletions(-)
>
> diff --git a/modules/create_user.py b/modules/create_user.py
> index ba37b2b..ee77072 100644
> --- a/modules/create_user.py
> +++ b/modules/create_user.py
> @@ -221,8 +221,13 @@ class moduleClass(Module):
> label.set_alignment(0.0, 0.5)
> label.set_size_request(500, -1)
>
> - self.usernameEntry = gtk.Entry()
> self.fullnameEntry = gtk.Entry()
> + self.usernameEntry = gtk.Entry()
> +
> + self.guessUserName = True
> + self.fullnameEntry.connect("changed",
> self.fullnameEntry_changed)
> + self.usernameEntry.connect("changed",
> self.usernameEntry_changed)
> +
> self.passwordEntry = gtk.Entry()
> self.passwordEntry.set_visibility(False)
> self.passwordEntry.set_property("primary-icon-stock",
> @@ -240,19 +245,20 @@ class moduleClass(Module):
> table = gtk.Table(2, 4)
> table.set_row_spacings(6)
> table.set_col_spacings(6)
> - label = gtk.Label(_("_Username:"))
> +
> + label = gtk.Label(_("Full Nam_e:"))
> label.set_use_underline(True)
> - label.set_mnemonic_widget(self.usernameEntry)
> + label.set_mnemonic_widget(self.fullnameEntry)
> label.set_alignment(0.0, 0.5)
> table.attach(label, 0, 1, 0, 1, gtk.FILL)
> - table.attach(self.usernameEntry, 1, 2, 0, 1, gtk.SHRINK,
> gtk.FILL, 5)
> + table.attach(self.fullnameEntry, 1, 2, 0, 1, gtk.SHRINK,
> gtk.FILL, 5)
>
> - label = gtk.Label(_("Full Nam_e:"))
> + label = gtk.Label(_("_Username:"))
> label.set_use_underline(True)
> - label.set_mnemonic_widget(self.fullnameEntry)
> + label.set_mnemonic_widget(self.usernameEntry)
> label.set_alignment(0.0, 0.5)
> table.attach(label, 0, 1, 1, 2, gtk.FILL)
> - table.attach(self.fullnameEntry, 1, 2, 1, 2, gtk.SHRINK,
> gtk.FILL, 5)
> + table.attach(self.usernameEntry, 1, 2, 1, 2, gtk.SHRINK,
> gtk.FILL, 5)
>
> label = gtk.Label(_("_Password:"))
> label.set_use_underline(True)
> @@ -306,7 +312,7 @@ class moduleClass(Module):
> self.vbox.pack_start(scuHBox, False, False)
>
> def focus(self):
> - self.usernameEntry.grab_focus()
> + self.fullnameEntry.grab_focus()
>
> def initializeUI(self):
> pass
> @@ -357,6 +363,26 @@ class moduleClass(Module):
> dlg.destroy()
> return None
>
> + def fullnameEntry_changed(self, fn_entry):
> + if not self.guessUserName:
> + return
> +
> + name = fn_entry.get_text()
> + try:
> + user = name.split()[0]
> + except IndexError:
> + user = ""
> + else:
> + user = user.encode("ascii", "ascii_transliterate")
> + user = user.lower()
> +
> +
> self.usernameEntry.handler_block_by_func(self.user nameEntry_changed)
> + self.usernameEntry.set_text(user)
> +
> self.usernameEntry.handler_unblock_by_func(self.us ernameEntry_changed)
> +
> + def usernameEntry_changed(self, un_entry):
> + self.guessUserName = not bool(un_entry.get_text())
> +
> def passwordEntry_changed(self, entry):
> pw = entry.get_text()
> if not pw:
> --
> 1.7.1.1
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 11-10-2010, 07:04 PM
"Brian C. Lane"
 
Default Guess user name from full name (#517269)

Looks good to me. Is sudo going to change the wheel line? Preferably
the one that requires the user to enter a password.

--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 11-11-2010, 08:01 AM
Martin Gracik
 
Default Guess user name from full name (#517269)

Yes, I hope so, this was why I did the patch, you can see the discussion in the bugzilla...

--

Martin Gracik

----- "Brian C. Lane" <bcl@redhat.com> wrote:

> Looks good to me. Is sudo going to change the wheel line? Preferably
> the one that requires the user to enter a password.
>
> --
> Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA
> (PST8PDT)
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:27 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org