* src/RelLib/_Name.py: default utf8 strings

* src/RelLib/_MarkerType.py: default utf8 strings
	* src/RelLib/_Place.py: default utf8 strings
	* src/RelLib/_GrampsType.py: default utf8 strings
	* src/Filters/SideBar/_EventSidebarFilter.py: default utf8 strings
	* src/Filters/SideBar/_FamilySidebarFilter.py: default utf8 strings
	* src/Filters/SideBar/_PersonSidebarFilter.py: default utf8 strings
	as a fallback. (bug #779), convert string to unicode if needed (bug #604)


svn: r7883
This commit is contained in:
Don Allingham 2007-01-08 21:40:51 +00:00
parent 4057c002cf
commit 8d809438c0
9 changed files with 56 additions and 47 deletions

View File

@ -1,6 +1,13 @@
2007-01-08 Don Allingham <don@gramps-project.org>
* src/RelLib/_Name.py: default utf8 strings
* src/RelLib/_MarkerType.py: default utf8 strings
* src/RelLib/_Place.py: default utf8 strings
* src/RelLib/_GrampsType.py: default utf8 strings
* src/Filters/SideBar/_EventSidebarFilter.py: default utf8 strings
* src/Filters/SideBar/_FamilySidebarFilter.py: default utf8 strings
* src/Filters/SideBar/_PersonSidebarFilter.py: default utf8 strings
* src/ansel_utf8.py (utf8_to_ansel): handle single character indexes
as a fallback. (bug #779)
as a fallback. (bug #779), convert string to unicode if needed (bug #604)
* src/StartupDialog.py: removed - no longer used
* src/Makefile.am: remove StartupDialog.py installation
* po/POTFILES.in: removed StartupDialog.py

View File

@ -62,7 +62,7 @@ class EventSidebarFilter(SidebarFilter):
self.filter_id = gtk.Entry()
self.filter_desc = gtk.Entry()
self.filter_event = RelLib.Event()
self.filter_event.set_type((RelLib.EventType.CUSTOM,''))
self.filter_event.set_type((RelLib.EventType.CUSTOM,u''))
self.etype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
@ -92,12 +92,12 @@ class EventSidebarFilter(SidebarFilter):
self.add_entry(None, self.filter_regex)
def clear(self, obj):
self.filter_id.set_text('')
self.filter_desc.set_text('')
self.filter_date.set_text('')
self.filter_place.set_text('')
self.filter_note.set_text('')
self.etype.child.set_text('')
self.filter_id.set_text(u'')
self.filter_desc.set_text(u'')
self.filter_date.set_text(u'')
self.filter_place.set_text(u'')
self.filter_note.set_text(u'')
self.etype.child.set_text(u'')
self.generic.set_active(0)
def get_filter(self):

View File

@ -65,11 +65,11 @@ class FamilySidebarFilter(SidebarFilter):
self.filter_child = gtk.Entry()
self.filter_event = RelLib.Event()
self.filter_event.set_type((RelLib.EventType.CUSTOM,''))
self.filter_event.set_type((RelLib.EventType.CUSTOM,u''))
self.etype = gtk.ComboBoxEntry()
self.family_stub = RelLib.Family()
self.family_stub.set_relationship((RelLib.FamilyRelType.CUSTOM,''))
self.family_stub.set_relationship((RelLib.FamilyRelType.CUSTOM,u''))
self.rtype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
@ -83,7 +83,7 @@ class FamilySidebarFilter(SidebarFilter):
self.family_stub.get_relationship)
self.filter_marker = RelLib.Family()
self.filter_marker.set_marker((RelLib.MarkerType.CUSTOM,''))
self.filter_marker.set_marker((RelLib.MarkerType.CUSTOM,u''))
self.mtype = gtk.ComboBoxEntry()
self.marker_menu = GrampsWidgets.MonitoredDataType(
self.mtype,
@ -112,14 +112,14 @@ class FamilySidebarFilter(SidebarFilter):
self.add_entry(None, self.filter_regex)
def clear(self, obj):
self.filter_id.set_text('')
self.filter_father.set_text('')
self.filter_mother.set_text('')
self.filter_child.set_text('')
self.filter_note.set_text('')
self.etype.child.set_text('')
self.rtype.child.set_text('')
self.mtype.child.set_text('')
self.filter_id.set_text(u'')
self.filter_father.set_text(u'')
self.filter_mother.set_text(u'')
self.filter_child.set_text(u'')
self.filter_note.set_text(u'')
self.etype.child.set_text(u'')
self.rtype.child.set_text(u'')
self.mtype.child.set_text(u'')
self.generic.set_active(0)
def get_filter(self):
@ -169,7 +169,7 @@ class FamilySidebarFilter(SidebarFilter):
generic_filter.add_rule(rule)
if etype:
rule = HasEvent([etype, '', '', ''])
rule = HasEvent([etype, u'', u'', u''])
generic_filter.add_rule(rule)
if rtype:

View File

@ -63,7 +63,7 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_birth = gtk.Entry()
self.filter_death = gtk.Entry()
self.filter_event = RelLib.Event()
self.filter_event.set_type((RelLib.EventType.CUSTOM,''))
self.filter_event.set_type((RelLib.EventType.CUSTOM,u''))
self.etype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
self.etype,
@ -71,7 +71,7 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_event.get_type)
self.filter_marker = RelLib.Person()
self.filter_marker.set_marker((RelLib.MarkerType.CUSTOM,''))
self.filter_marker.set_marker((RelLib.MarkerType.CUSTOM,u''))
self.mtype = gtk.ComboBoxEntry()
self.marker_menu = GrampsWidgets.MonitoredDataType(
self.mtype,
@ -104,14 +104,14 @@ class PersonSidebarFilter(SidebarFilter):
self.add_entry(None, self.filter_regex)
def clear(self, obj):
self.filter_name.set_text('')
self.filter_id.set_text('')
self.filter_birth.set_text('')
self.filter_death.set_text('')
self.filter_note.set_text('')
self.filter_name.set_text(u'')
self.filter_id.set_text(u'')
self.filter_birth.set_text(u'')
self.filter_death.set_text(u'')
self.filter_note.set_text(u'')
self.filter_gender.set_active(0)
self.etype.child.set_text('')
self.mtype.child.set_text('')
self.etype.child.set_text(u'')
self.mtype.child.set_text(u'')
self.generic.set_active(0)
def get_filter(self):
@ -158,14 +158,14 @@ class PersonSidebarFilter(SidebarFilter):
generic_filter.add_rule(rule)
if etype:
rule = HasEvent([etype, '', '', ''])
rule = HasEvent([etype, u'', u'', u''])
generic_filter.add_rule(rule)
if birth:
rule = HasBirth([birth,'',''])
rule = HasBirth([birth,u'',u''])
generic_filter.add_rule(rule)
if death:
rule = HasDeath([death,'',''])
rule = HasDeath([death,u'',u''])
generic_filter.add_rule(rule)
if note:
if regex:

View File

@ -60,16 +60,16 @@ class GrampsType:
self.string = value[1]
elif type(value) == int:
self.val = value
self.string = ''
self.string = u''
elif type(value) in (str,unicode):
self.val = self._S2IMAP.get(value, self._CUSTOM)
if self.val == self._CUSTOM:
self.string = value
else:
self.string = ''
self.string = u''
else:
self.val = self._DEFAULT
self.string = ''
self.string = u''
def set_from_xml_str(self, value):
"""
@ -78,7 +78,7 @@ class GrampsType:
"""
if self._E2IMAP.has_key(value):
self.val = self._E2IMAP[value]
self.string = ''
self.string = u''
else:
self.val = self._CUSTOM
self.string = value

View File

@ -61,28 +61,28 @@ class MarkerType(GrampsType):
sets the marker value
"""
if isinstance(value, self.__class__):
if value.val == self.CUSTOM and value.string == '':
if value.val == self.CUSTOM and value.string == u'':
self.val = self.NONE
self.string = ''
self.string = u''
else:
self.val = value.val
self.string = value.string
elif type(value) == tuple:
if value[0] == self.CUSTOM and value[1] == '':
if value[0] == self.CUSTOM and value[1] == u'':
self.value = self.NONE
self.string = ''
self.string = u''
else:
self.val = value[0]
self.string = value[1]
elif type(value) == int:
self.val = value
self.string = ''
self.string = u''
elif type(value) == str:
self.val = self._S2IMAP.get(value, self._CUSTOM)
if self.val == self._CUSTOM:
self.string = value
else:
self.string = ''
self.string = u''
else:
self.val = self._DEFAULT
self.string = ''
self.string = u''

View File

@ -96,7 +96,7 @@ class Name(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase):
self.group_as = ""
self.sort_as = self.DEF
self.display_as = self.DEF
self.call = ''
self.call = u''
def serialize(self):
"""

View File

@ -304,5 +304,5 @@ class Place(PrimaryObject, SourceBase, NoteBase, MediaBase, UrlBase):
self.main_loc.city.upper(), self.main_loc.county.upper(),
self.main_loc.state.upper(), self.main_loc.country.upper()]
else:
return [self.title, self.gramps_id, '', '', '', '', '',
self.title.upper(), '', '', '', '', '']
return [self.title, self.gramps_id, u'', u'', u'', u'', u'',
self.title.upper(), u'', u'', u'', u'', u'']

View File

@ -309,6 +309,8 @@ def ansel_to_utf8(s):
def utf8_to_ansel(s):
"""Converts an UTF8 encoded string to ANSEL"""
if type(s) != unicode:
s = unicode(s)
buff = cStringIO.StringIO()
while s:
c0 = ord(s[0])