Merge dynamic-initials-field branch, enhances usability of initials field
This commit is contained in:
commit
303ed23225
|
@ -358,6 +358,7 @@
|
|||
<property name="width_chars">4</property>
|
||||
<property name="input_purpose">alpha</property>
|
||||
<signal name="activate" handler="entry_focus_next" swapped="no"/>
|
||||
<signal name="grab-focus" handler="initials_entry_focused" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -231,17 +231,12 @@ class MugshotWindow(Window):
|
|||
name, office, office_phone, home_phone = details.split(',', 3)
|
||||
break
|
||||
|
||||
# Expand the user's fullname into first, last, and initials.
|
||||
# Expand the user's fullname into first and last.
|
||||
try:
|
||||
first_name, last_name = name.split(' ', 1)
|
||||
initials = first_name[0] + last_name[0]
|
||||
except:
|
||||
first_name = name
|
||||
last_name = ''
|
||||
if first_name:
|
||||
initials = first_name[0]
|
||||
else:
|
||||
initials = ''
|
||||
|
||||
# If the variables are defined as 'none', use blank for cleanliness.
|
||||
if home_phone == 'none':
|
||||
|
@ -251,7 +246,6 @@ class MugshotWindow(Window):
|
|||
|
||||
# Get dconf settings
|
||||
logger.debug('Getting initials, email, and fax from dconf')
|
||||
if self.settings['initials'] != '':
|
||||
initials = self.settings['initials']
|
||||
email = self.settings['email']
|
||||
fax = self.settings['fax']
|
||||
|
@ -290,6 +284,17 @@ class MugshotWindow(Window):
|
|||
self.menuitem1.set_visible(False)
|
||||
self.image_remove.set_visible(False)
|
||||
|
||||
def suggest_initials(self, first_name, last_name):
|
||||
"""Generate initials from first and last name."""
|
||||
try:
|
||||
initials = first_name[0] + last_name[0]
|
||||
except:
|
||||
if first_name:
|
||||
initials = first_name[0]
|
||||
else:
|
||||
initials = ''
|
||||
return initials
|
||||
|
||||
def filter_numbers(self, entry, *args):
|
||||
"""Allow only numbers and + in phone entry fields."""
|
||||
text = entry.get_text().strip()
|
||||
|
@ -337,6 +342,14 @@ class MugshotWindow(Window):
|
|||
vbox = widget.get_parent().get_parent().get_parent().get_parent()
|
||||
vbox.child_focus(Gtk.DirectionType.TAB_FORWARD)
|
||||
|
||||
def initials_entry_focused(self, widget):
|
||||
"""Paste initials into empty field."""
|
||||
logger.debug('Initials field focused.')
|
||||
first_name = get_entry_value(self.first_name_entry)
|
||||
last_name = get_entry_value(self.last_name_entry)
|
||||
if get_entry_value(self.initials_entry) == '':
|
||||
self.initials_entry.set_text(self.suggest_initials(first_name, last_name))
|
||||
|
||||
def on_cancel_button_clicked(self, widget):
|
||||
"""When the window cancel button is clicked, close the program."""
|
||||
logger.debug('Cancel clicked, goodbye.')
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-04-01 06:18-0400\n"
|
||||
"POT-Creation-Date: 2014-04-01 20:36-0400\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"
|
||||
|
@ -61,7 +61,7 @@ msgstr ""
|
|||
msgid "Browse…"
|
||||
msgstr ""
|
||||
|
||||
#: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:507
|
||||
#: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:520
|
||||
msgid "Mugshot"
|
||||
msgstr ""
|
||||
|
||||
|
@ -131,37 +131,37 @@ msgid "Retry"
|
|||
msgstr ""
|
||||
|
||||
#. Password was incorrect, complain.
|
||||
#: ../mugshot/MugshotWindow.py:306
|
||||
#: ../mugshot/MugshotWindow.py:311
|
||||
msgid "Authentication Failed"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:307
|
||||
#: ../mugshot/MugshotWindow.py:312
|
||||
msgid "User details were not updated."
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:437
|
||||
#: ../mugshot/MugshotWindow.py:450
|
||||
msgid "Update Pidgin buddy icon?"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:438
|
||||
#: ../mugshot/MugshotWindow.py:451
|
||||
msgid "Would you also like to update your Pidgin buddy icon?"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:508
|
||||
#: ../mugshot/MugshotWindow.py:521
|
||||
msgid "Enter your password to change user details."
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:510
|
||||
#: ../mugshot/MugshotWindow.py:523
|
||||
msgid ""
|
||||
"This is a security measure to prevent unwanted updates\n"
|
||||
"to your personal information."
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:657
|
||||
#: ../mugshot/MugshotWindow.py:670
|
||||
msgid "Update LibreOffice user details?"
|
||||
msgstr ""
|
||||
|
||||
#: ../mugshot/MugshotWindow.py:658
|
||||
#: ../mugshot/MugshotWindow.py:671
|
||||
msgid "Would you also like to update your user details in LibreOffice?"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue