bug report #2162: handle surnames that have spaces within them
svn: r10769
This commit is contained in:
parent
803379c6ce
commit
f2359c52bf
@ -957,7 +957,17 @@ class GuiSurnameColourOption(gtk.HBox):
|
|||||||
self.pack_end(self.vbbox, expand=False)
|
self.pack_end(self.vbbox, expand=False)
|
||||||
|
|
||||||
# populate the surname/colour treeview
|
# populate the surname/colour treeview
|
||||||
tmp = self.__option.get_value().split()
|
#
|
||||||
|
# For versions prior to 3.0.2, the fields were delimited with
|
||||||
|
# whitespace. However, this causes problems when the surname
|
||||||
|
# also has a space within it. When populating the control,
|
||||||
|
# support both the new and old format -- look for the \xb0
|
||||||
|
# delimiter, and if it isn't there, assume this is the old-
|
||||||
|
# style space-delimited format. (Bug #2162.)
|
||||||
|
if (self.__option.get_value().find(u'\xb0') >= 0):
|
||||||
|
tmp = self.__option.get_value().split(u'\xb0')
|
||||||
|
else:
|
||||||
|
tmp = self.__option.get_value().split(' ')
|
||||||
while len(tmp) > 1:
|
while len(tmp) > 1:
|
||||||
surname = tmp.pop(0)
|
surname = tmp.pop(0)
|
||||||
colour = tmp.pop(0)
|
colour = tmp.pop(0)
|
||||||
@ -975,10 +985,16 @@ class GuiSurnameColourOption(gtk.HBox):
|
|||||||
surname = self.__model.get_value(i, 0)
|
surname = self.__model.get_value(i, 0)
|
||||||
#surname = surname.encode('iso-8859-1','xmlcharrefreplace')
|
#surname = surname.encode('iso-8859-1','xmlcharrefreplace')
|
||||||
colour = self.__model.get_value(i, 1)
|
colour = self.__model.get_value(i, 1)
|
||||||
# tried to use a dictionary, and tried to save it as a tuple,
|
# Tried to use a dictionary, and tried to save it as a tuple,
|
||||||
# but coulnd't get this to work right -- this is lame, but now
|
# but coulnd't get this to work right -- this is lame, but now
|
||||||
# the surnames and colours are saved as a plain text string
|
# the surnames and colours are saved as a plain text string
|
||||||
surname_colours += surname + ' ' + colour + ' '
|
#
|
||||||
|
# Hmmm...putting whitespace between the fields causes
|
||||||
|
# problems when the surname has whitespace -- for example,
|
||||||
|
# with surnames like "Del Monte". So now we insert a non-
|
||||||
|
# whitespace character which is unlikely to appear in
|
||||||
|
# a surname. (See bug report #2162.)
|
||||||
|
surname_colours += surname + u'\xb0' + colour + u'\xb0'
|
||||||
i = self.__model.iter_next(i)
|
i = self.__model.iter_next(i)
|
||||||
self.__option.set_value( surname_colours )
|
self.__option.set_value( surname_colours )
|
||||||
|
|
||||||
|
@ -276,7 +276,12 @@ class FamilyLinesReport(Report):
|
|||||||
|
|
||||||
# convert the 'surnameColours' string to a dictionary of names and colours
|
# convert the 'surnameColours' string to a dictionary of names and colours
|
||||||
self.surnameColours = {}
|
self.surnameColours = {}
|
||||||
tmp = options.handler.options_dict['FLsurnameColours'].split()
|
tmp = options.handler.options_dict['FLsurnameColours']
|
||||||
|
if (tmp.find(u'\xb0') >= 0):
|
||||||
|
tmp = tmp.split(u'\xb0') # new style delimiter (see bug report #2162)
|
||||||
|
else:
|
||||||
|
tmp = tmp.split(' ') # old style delimiter
|
||||||
|
|
||||||
while len(tmp) > 1:
|
while len(tmp) > 1:
|
||||||
surname = tmp.pop(0).encode('iso-8859-1', 'xmlcharrefreplace')
|
surname = tmp.pop(0).encode('iso-8859-1', 'xmlcharrefreplace')
|
||||||
colour = tmp.pop(0)
|
colour = tmp.pop(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user