Capitalize last names
svn: r1271
This commit is contained in:
parent
d2b30fc46f
commit
254ac30ed2
@ -828,6 +828,8 @@ class EditPerson:
|
||||
"""Check to see if any of the data has changed from the
|
||||
original record"""
|
||||
surname = self.surname_field.get_text()
|
||||
if GrampsCfg.capitalize:
|
||||
surname = surname.upper()
|
||||
ntype = self.ntype_field.entry.get_text()
|
||||
suffix = self.suffix.get_text()
|
||||
prefix = self.prefix.get_text()
|
||||
@ -850,8 +852,12 @@ class EditPerson:
|
||||
changed = 1
|
||||
if prefix != name.getSurnamePrefix():
|
||||
changed = 1
|
||||
if surname != name.getSurname():
|
||||
changed = 1
|
||||
if GrampsCfg.capitalize:
|
||||
if surname != name.getSurname():
|
||||
changed = 1
|
||||
else:
|
||||
if surname.upper() != name.getSurname().upper():
|
||||
changed = 1
|
||||
if ntype != name.getType():
|
||||
changed = 1
|
||||
if given != name.getFirstName():
|
||||
@ -1206,9 +1212,14 @@ class EditPerson:
|
||||
if ntype != name.getType():
|
||||
name.setType(ntype)
|
||||
|
||||
if surname != name.getSurname():
|
||||
name.setSurname(surname)
|
||||
self.db.addSurname(surname)
|
||||
if GrampsCfg.capitalize:
|
||||
if surname.upper() != name.getSurname().upper():
|
||||
name.setSurname(surname.upper())
|
||||
self.db.addSurname(surname.upper())
|
||||
else:
|
||||
if surname != name.getSurname():
|
||||
name.setSurname(surname)
|
||||
self.db.addSurname(surname)
|
||||
|
||||
if given != name.getFirstName():
|
||||
name.setFirstName(given)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2001 David R. Hampton
|
||||
# Copyright (C) 2003 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
class ReportError(Exception):
|
||||
|
||||
"""Error used to report Report errors"""
|
||||
def __init__(self,value):
|
||||
self.value = value
|
||||
|
||||
@ -27,7 +27,7 @@ class ReportError(Exception):
|
||||
return self.value
|
||||
|
||||
class GedcomError(Exception):
|
||||
|
||||
"""Error used to report GEDCOM errors"""
|
||||
def __init__(self,value):
|
||||
self.value = value
|
||||
|
||||
@ -35,7 +35,7 @@ class GedcomError(Exception):
|
||||
return self.value
|
||||
|
||||
class PluginError(Exception):
|
||||
|
||||
"""Error used to report plugin errors"""
|
||||
def __init__(self,value):
|
||||
self.value = value
|
||||
|
||||
|
@ -144,6 +144,7 @@ index_visible = 0
|
||||
mediaref = 1
|
||||
globalprop = 1
|
||||
localprop = 1
|
||||
capitalize = 0
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -223,6 +224,7 @@ def loadConfig(call):
|
||||
vc_comment = get_bool("/apps/gramps/use-comment")
|
||||
uncompress = get_bool("/apps/gramps/dont-compress-xml")
|
||||
id_edit = get_bool("/apps/gramps/id-edit")
|
||||
capitalize = get_bool("/apps/gramps/capitalize")
|
||||
index_visible = get_bool("/apps/gramps/index-visible")
|
||||
status_bar = get_int("/apps/gramps/statusbar")
|
||||
toolbar = get_int("/apps/gramps/toolbar",2)
|
||||
@ -544,6 +546,7 @@ class GrampsPreferences:
|
||||
auto = self.top.get_widget("autoload")
|
||||
asave_int = self.top.get_widget("autosave_interval")
|
||||
idedit = self.top.get_widget("gid_edit")
|
||||
cap = self.top.get_widget('capitalize')
|
||||
index_vis = self.top.get_widget("show_child_id")
|
||||
lds = self.top.get_widget("uselds")
|
||||
ac = self.top.get_widget("autocomp")
|
||||
@ -571,6 +574,7 @@ class GrampsPreferences:
|
||||
vcom.set_active(vc_comment)
|
||||
compress.set_active(uncompress)
|
||||
idedit.set_active(id_edit)
|
||||
cap.set_active(capitalize)
|
||||
index_vis.set_active(index_visible)
|
||||
|
||||
self.top.get_widget("iprefix").set_text(iprefix)
|
||||
@ -792,6 +796,7 @@ class GrampsPreferences:
|
||||
global vc_comment
|
||||
global uncompress
|
||||
global id_edit
|
||||
global capitalize
|
||||
global index_visible
|
||||
global status_bar
|
||||
global toolbar
|
||||
@ -816,6 +821,8 @@ class GrampsPreferences:
|
||||
vc_comment = self.top.get_widget("vc_comment").get_active()
|
||||
uncompress = self.top.get_widget("uncompress").get_active()
|
||||
id_edit = self.top.get_widget("gid_edit").get_active()
|
||||
capitalize = self.top.get_widget('capitalize').get_active()
|
||||
|
||||
index_visible = self.top.get_widget("show_child_id").get_active()
|
||||
paper_obj = self.top.get_widget("paper_size").get_menu().get_active()
|
||||
|
||||
@ -878,6 +885,7 @@ class GrampsPreferences:
|
||||
set_bool("/apps/gramps/use-comment",vc_comment)
|
||||
set_bool("/apps/gramps/dont-compress-xml",uncompress)
|
||||
set_bool("/apps/gramps/id-edit",id_edit)
|
||||
set_bool("/apps/gramps/capitalize",capitalize)
|
||||
set_bool("/apps/gramps/index-visible",index_visible)
|
||||
set_int("/apps/gramps/statusbar",status_bar)
|
||||
set_int("/apps/gramps/toolbar",toolbar+1)
|
||||
|
@ -1021,7 +1021,6 @@ class Person(Persistent):
|
||||
bday.getQuoteDate(), dday.getQuoteDate(),
|
||||
sort.build_sort_name(self.getPrimaryName()),
|
||||
sort.build_sort_date(bday),sort.build_sort_date(dday)]
|
||||
|
||||
|
||||
def setPrimaryName(self,name):
|
||||
"""sets the primary name of the Person to the specified
|
||||
|
@ -285,7 +285,8 @@ class GedcomParser:
|
||||
if self.backoff == 0:
|
||||
next_line = self.f.readline()
|
||||
self.text = string.translate(next_line.strip(),self.trans,self.delc)
|
||||
if self.text == '':
|
||||
|
||||
if not self.text:
|
||||
raise Errors.GedcomError(_("GEDCOM file ended unexpectedly"))
|
||||
|
||||
try:
|
||||
@ -293,7 +294,7 @@ class GedcomParser:
|
||||
except:
|
||||
self.text = string.translate(self.text,self.trans2)
|
||||
|
||||
self.index = self.index + 1
|
||||
self.index += 1
|
||||
l = string.split(self.text, None, 2)
|
||||
ln = len(l)
|
||||
try:
|
||||
|
@ -281,7 +281,7 @@
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">0</property>
|
||||
@ -304,8 +304,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
@ -341,8 +341,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
@ -412,8 +412,8 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="y_options"></property>
|
||||
@ -437,6 +437,29 @@
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_padding">3</property>
|
||||
<property name="y_padding">3</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="capitalize">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Capitalize surnames</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_padding">3</property>
|
||||
@ -893,26 +916,6 @@
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="stat3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Active person's name and attribute</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">stat1</property>
|
||||
<signal name="toggled" handler="on_object_toggled" object="propertybox"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
@ -1006,59 +1009,6 @@
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="border_width">3</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="attr_display">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Display attribute on Edit Person form</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_object_toggled" object="propertybox"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="attr_name">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
<signal name="changed" handler="on_object_toggled" object="propertybox"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
@ -1102,26 +1052,6 @@
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="display_altnames">
|
||||
<property name="border_width">3</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Do not display alternate names in person list</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_object_toggled" object="propertybox"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="show_child_id">
|
||||
<property name="border_width">3</property>
|
||||
|
Loading…
Reference in New Issue
Block a user