* src/GrampsDb/_ReadXML.py: new types

* src/GrampsDb/_ConstXML.py: new types
	* src/GrampsDb/_WriteXML.py: new types
	* src/Editors/_EditUrl.py: new types
	* src/Editors/_EditPerson.py: new types
	* src/Editors/_EditRepository.py: new types
	* src/Editors/_EditName.py: new types
	* src/Editors/_EditChildRef.py: new types
	* src/RelLib/__init__.py: new types
	* src/RelLib/_Url.py: new types
	* src/RelLib/_RepositoryType.py: new types
	* src/RelLib/_GrampsType.py: new types
	* src/RelLib/_UrlType.py: new types
	* src/RelLib/_Repository.py: new types
	* src/RelLib/_NameType.py: new types
	* src/RelLib/_ChildRefType.py: new types
	* src/DisplayTabs.py: new types
	* src/GrampsWidgets.py: new types
	* src/Utils.py: new types


svn: r6360
This commit is contained in:
Don Allingham 2006-04-19 03:57:10 +00:00
parent 08cfe67716
commit b82376fb66
20 changed files with 302 additions and 198 deletions

View File

@ -1,4 +1,23 @@
2006-04-18 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadXML.py: new types
* src/GrampsDb/_ConstXML.py: new types
* src/GrampsDb/_WriteXML.py: new types
* src/Editors/_EditUrl.py: new types
* src/Editors/_EditPerson.py: new types
* src/Editors/_EditRepository.py: new types
* src/Editors/_EditName.py: new types
* src/Editors/_EditChildRef.py: new types
* src/RelLib/__init__.py: new types
* src/RelLib/_Url.py: new types
* src/RelLib/_RepositoryType.py: new types
* src/RelLib/_GrampsType.py: new types
* src/RelLib/_UrlType.py: new types
* src/RelLib/_Repository.py: new types
* src/RelLib/_NameType.py: new types
* src/RelLib/_ChildRefType.py: new types
* src/DisplayTabs.py: new types
* src/GrampsWidgets.py: new types
* src/Utils.py: new types
* src/Editors/_EditFamily.py: button messages
* src/DisplayTabs.py: remove property button stuff

View File

@ -2125,11 +2125,7 @@ class WebModel(gtk.ListStore):
gtk.ListStore.__init__(self, str, str, str, object)
self.db = db
for obj in obj_list:
self.append(row=[self.show_type(obj.type),
obj.path, obj.desc, obj])
def show_type(self, rtype):
return Utils.format_web_type(rtype)
self.append(row=[str(obj.type), obj.path, obj.desc, obj])
#-------------------------------------------------------------------------
#

View File

@ -45,6 +45,7 @@ import gtk.glade
#
#-------------------------------------------------------------------------
import const
import RelLib
from _EditSecondary import EditSecondary
from DisplayTabs import *
@ -81,12 +82,14 @@ class EditChildRef(EditSecondary):
self.top.get_widget('frel'),
self.obj.set_father_relation,
self.obj.get_father_relation,
RelLib.ChildRefType,
)
self.mrel = MonitoredDataType(
self.top.get_widget('mrel'),
self.obj.set_mother_relation,
self.obj.get_mother_relation,
RelLib.ChildRefType,
)
self.priv = PrivacyButton(

View File

@ -140,14 +140,18 @@ class EditName(EditSecondary):
self.top.get_widget("alt_prefix"), self.obj.set_surname_prefix,
self.obj.get_surname_prefix, self.db.readonly)
self.date = MonitoredDate(self.top.get_widget("date"),
self.top.get_widget("date_stat"),
self.obj.get_date_object(),self.window)
self.date = MonitoredDate(
self.top.get_widget("date"),
self.top.get_widget("date_stat"),
self.obj.get_date_object(),
self.window)
self.obj_combo = MonitoredDataType(
self.top.get_widget("name_type"),
self.obj.set_type,
self.obj.get_type)
self.obj.get_type,
RelLib.Name,
)
self.privacy = PrivacyButton(
self.top.get_widget("priv"), self.obj)

View File

@ -172,7 +172,7 @@ class EditPerson(EditPrimary):
self.ntype_field = GrampsWidgets.MonitoredDataType(
self.top.get_widget("ntype"),
self.pname.set_type,
self.pname.get_type,
self.pname.get_type,
self.db.readonly)
self.marker = GrampsWidgets.MonitoredType(

View File

@ -72,12 +72,11 @@ class EditRepository(EditPrimary):
self.obj.get_name,
self.db.readonly)
self.type = MonitoredType(
self.type = MonitoredDataType(
self.glade.get_widget("repository_type"),
self.obj.set_type,
self.obj.get_type,
dict(Utils.repository_types),
RelLib.Repository.CUSTOM)
self.obj.get_type
)
self.call_number = MonitoredEntry(
self.glade.get_widget('gid'),

View File

@ -73,19 +73,25 @@ class EditUrl(EditSecondary):
def _setup_fields(self):
self.des = MonitoredEntry(
self.top.get_widget("url_des"), self.obj.set_description,
self.obj.get_description, self.db.readonly)
self.top.get_widget("url_des"),
self.obj.set_description,
self.obj.get_description,
self.db.readonly)
self.addr = MonitoredEntry(
self.top.get_widget("url_addr"), self.obj.set_path,
self.obj.get_path, self.db.readonly)
self.top.get_widget("url_addr"),
self.obj.set_path,
self.obj.get_path,
self.db.readonly)
self.priv = PrivacyButton(self.top.get_widget("priv"),
self.obj, self.db.readonly)
self.type_sel = MonitoredType(
self.top.get_widget("type"), self.obj.set_type,
self.obj.get_type, dict(Utils.web_types), RelLib.Url.CUSTOM)
self.type_sel = MonitoredDataType(
self.top.get_widget("type"),
self.obj.set_type,
self.obj.get_type,
)
def build_menu_names(self,obj):
etitle =_('Internet Address Editor')

View File

@ -101,12 +101,12 @@ family_relations = (
(RelLib.Family.UNKNOWN , "Unknown"),
)
name_types = (
(RelLib.NameType.UNKNOWN , "Unknown"),
(RelLib.NameType.AKA , "Also Known As"),
(RelLib.NameType.BIRTH , "Birth Name"),
(RelLib.NameType.MARRIED , "Married Name"),
)
# name_types = (
# (RelLib.NameType.UNKNOWN , "Unknown"),
# (RelLib.NameType.AKA , "Also Known As"),
# (RelLib.NameType.BIRTH , "Birth Name"),
# (RelLib.NameType.MARRIED , "Married Name"),
# )
source_media_types = (
(RelLib.RepoRef.UNKNOWN , "Unknown"),
@ -137,18 +137,18 @@ event_roles = (
(RelLib.EventRef.FAMILY , "Family"),
)
repository_types = (
(RelLib.Repository.UNKNOWN , "Unknown"),
(RelLib.Repository.LIBRARY , "Library"),
(RelLib.Repository.CEMETERY , "Cemetery"),
(RelLib.Repository.CHURCH , "Church"),
(RelLib.Repository.ARCHIVE , "Archive"),
(RelLib.Repository.ALBUM , "Album"),
(RelLib.Repository.WEBSITE , "Web site"),
(RelLib.Repository.BOOKSTORE , "Bookstore"),
(RelLib.Repository.COLLECTION , "Collection"),
(RelLib.Repository.SAFE , "Safe"),
)
# repository_types = (
# (RelLib.Repository.UNKNOWN , "Unknown"),
# (RelLib.Repository.LIBRARY , "Library"),
# (RelLib.Repository.CEMETERY , "Cemetery"),
# (RelLib.Repository.CHURCH , "Church"),
# (RelLib.Repository.ARCHIVE , "Archive"),
# (RelLib.Repository.ALBUM , "Album"),
# (RelLib.Repository.WEBSITE , "Web site"),
# (RelLib.Repository.BOOKSTORE , "Bookstore"),
# (RelLib.Repository.COLLECTION , "Collection"),
# (RelLib.Repository.SAFE , "Safe"),
# )
marker_types = (
(RelLib.PrimaryObject.MARKER_NONE , ""),
@ -156,25 +156,25 @@ marker_types = (
(RelLib.PrimaryObject.MARKER_TODO , "todo"),
)
url_types = (
(RelLib.Url.UNKNOWN , "Unknown"),
(RelLib.Url.EMAIL , "Email"),
(RelLib.Url.WEB_HOME , "Home"),
(RelLib.Url.WEB_SEARCH , "Search"),
(RelLib.Url.WEB_FTP , "FTP"),
)
# url_types = (
# (RelLib.Url.UNKNOWN , "Unknown"),
# (RelLib.Url.EMAIL , "Email"),
# (RelLib.Url.WEB_HOME , "Home"),
# (RelLib.Url.WEB_SEARCH , "Search"),
# (RelLib.Url.WEB_FTP , "FTP"),
# )
# mapping from the tuple collection to the appropriate CUSTOM integer
custom_types = {
events : RelLib.Event.CUSTOM,
attributes : RelLib.Attribute.CUSTOM,
family_relations : RelLib.Family.CUSTOM,
name_types : RelLib.NameType.CUSTOM,
# name_types : RelLib.NameType.CUSTOM,
source_media_types : RelLib.RepoRef.CUSTOM,
event_roles : RelLib.EventRef.CUSTOM,
repository_types : RelLib.Repository.CUSTOM,
# repository_types : RelLib.Repository.CUSTOM,
marker_types : RelLib.PrimaryObject.MARKER_CUSTOM,
url_types : RelLib.Url.CUSTOM,
# url_types : RelLib.Url.CUSTOM,
}
def str_for_xml(tuples,the_tuple):

View File

@ -882,7 +882,7 @@ class GrampsParser:
if not mrel.is_default():
self.childref.set_mother_relation(mrel)
if not frel.is_default() ):
if not frel.is_default():
self.childref.set_father_relation(frel)
self.family.add_child_reference(self.childref)
@ -1386,8 +1386,8 @@ class GrampsParser:
self.event.type = _ConstXML.tuple_from_xml(_ConstXML.events,tag)
elif self.repo:
# Repository type
self.repo.type = _ConstXML.tuple_from_xml(
_ConstXML.repository_types,tag)
self.repo.type = RelLib.RepositoryType()
self.repo.type.set_from_xml_str(tag)
def stop_childref(self,tag):
self.childref = None

View File

@ -470,7 +470,7 @@ class XmlWriter:
self.write_primary_tag("repository",repo,index)
#name
self.write_line('rname',repo.name,index+1)
rtype = _ConstXML.str_for_xml(_ConstXML.repository_types,repo.type)
rtype = repo.type.xml_str()
if rtype:
self.write_line('type',rtype,index+1)
#address list

View File

@ -37,7 +37,6 @@ import AutoComp
import DateHandler
import DateEdit
import const
from RelLib import ChildRefType
_lock_path = os.path.join(const.image_dir, 'stock_lock.png')
_lock_open_path = os.path.join(const.image_dir, 'stock_lock-open.png')
@ -346,7 +345,8 @@ class MonitoredType:
class MonitoredDataType:
def __init__(self, obj, set_val, get_val, readonly=False, custom_values=None):
def __init__(self, obj, set_val, get_val, readonly=False,
custom_values=None):
self.set_val = set_val
self.get_val = get_val
@ -373,9 +373,9 @@ class MonitoredDataType:
def fix_value(self, value):
if value[0] == self.get_val().get_custom():
return ChildRefType(value)
return value
else:
return ChildRefType((value[0],''))
return (value[0],'')
def update(self):
if self.get_val():

View File

@ -37,20 +37,24 @@ class ChildRefType(GrampsType):
_CUSTOM = CUSTOM
_DEFAULT = BIRTH
_I2SMAP = {
NONE : _("None"),
BIRTH : _("Birth"),
ADOPTED : _("Adopted"),
STEPCHILD : _("Stepchild"),
SPONSORED : _("Sponsored"),
FOSTER : _("Foster"),
UNKNOWN : _("Unknown"),
CUSTOM : _("Custom"),
}
_DATAMAP = [
(NONE, _("None"), "None"),
(BIRTH, _("Birth"), "Birth"),
(ADOPTED, _("Adopted"), "Adopted"),
(STEPCHILD, _("Stepchild"), "Stepchild"),
(SPONSORED, _("Sponsored"), "Sponsored"),
(FOSTER, _("Foster"), "Foster"),
(UNKNOWN, _("Unknown"), "Unknown"),
(CUSTOM, _("Custom"), "Custom"),
]
_S2IMAP = init_map(_I2SMAP)
_I2SMAP = init_map(_DATAMAP, 0, 1)
_S2IMAP = init_map(_DATAMAP, 1, 0)
_I2EMAP = init_map(_DATAMAP, 0, 2)
_E2IMAP = init_map(_DATAMAP, 2, 0)
def __init__(self, value=None):
GrampsType.__init__(self, value)

View File

@ -22,19 +22,23 @@
from gettext import gettext as _
def init_map(data):
def init_map(data, key_col, data_col):
new_data = {}
for i in data.keys():
new_data[data[i]] = i
for item in data:
new_data[item[key_col]] = item[data_col]
return new_data
class GrampsType:
_CUSTOM = 0
_DEFAULT = 0
_I2SMAP = {}
_DATAMAP = []
_S2IMAP = init_map(_I2SMAP)
_I2SMAP = init_map(_DATAMAP, 0, 1)
_S2IMAP = init_map(_DATAMAP, 1, 0)
_I2EMAP = init_map(_DATAMAP, 0, 2)
_E2IMAP = init_map(_DATAMAP, 2, 0)
def __init__(self, value=None):
self.set(value)
@ -59,6 +63,24 @@ class GrampsType:
self.val = self._DEFAULT
self.string = ''
def set_from_xml_str(self, value):
"""
This method sets the type instance based on the untranslated
string (obtained e.g. from XML).
"""
if self._E2IMAP.has_key(value):
self.val = self._E2IMAP[value]
self.string = ''
else:
self.val = self._CUSTOM
self.string = value
def xml_str(self):
if self.val == self._CUSTOM:
return self.string
else:
return self._I2EMAP[self.val]
def serialize(self):
return (self.val, self.string)
@ -69,21 +91,9 @@ class GrampsType:
if self.val == self._CUSTOM:
return self.string
else:
return self._I2SMAP.get(self.val,_('UNKNOWN'))
def xml_str(self):
"""
This method returns an untranslated string for non-custom values,
or the value, if it is custom.
"""
# FIXME: this needs to be fixed.
return self.string
return self._I2SMAP.get(self.val,_('Unknown'))
def set_from_xml_str(self,the_str):
"""
This method sets the type instance based on the untranslated
string (obtained e.g. from XML).
"""
return self
def __int__(self):

View File

@ -20,7 +20,7 @@
# $Id: _Name.py 6326 2006-04-13 11:21:33Z loshawlos $
from _GrampsType import GrampsType
from _GrampsType import GrampsType, init_map
from gettext import gettext as _
class NameType(GrampsType):
@ -34,15 +34,19 @@ class NameType(GrampsType):
_CUSTOM = CUSTOM
_DEFAULT = BIRTH
_I2SMAP = {
UNKNOWN : _("Unknown"),
CUSTOM : _("Custom"),
AKA : _("Also Known As"),
BIRTH : _("Birth Name"),
MARRIED : _("Married Name"),
}
_DATAMAP = [
(UNKNOWN, _("Unknown"), "Unknown"),
(CUSTOM, _("Custom"), "Custom"),
(AKA, _("Also Known As"), "Also Known As"),
(BIRTH, _("Birth Name"), "Birth Name"),
(MARRIED, _("Married Name"), "Married Name"),
]
_I2SMAP = init_map(_DATAMAP, 0, 1)
_S2IMAP = init_map(_DATAMAP, 1, 0)
_I2EMAP = init_map(_DATAMAP, 0, 2)
_E2IMAP = init_map(_DATAMAP, 2, 0)
def __init__(self, value=None):
GrampsType.__init__(self, value)

View File

@ -40,6 +40,7 @@ from _PrimaryObject import PrimaryObject
from _NoteBase import NoteBase
from _AddressBase import AddressBase
from _UrlBase import UrlBase
from _RepositoryType import RepositoryType
#-------------------------------------------------------------------------
#
@ -49,29 +50,18 @@ from _UrlBase import UrlBase
class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase):
"""A location where collections of Sources are found"""
UNKNOWN = -1
CUSTOM = 0
LIBRARY = 1
CEMETERY = 2
CHURCH = 3
ARCHIVE = 4
ALBUM = 5
WEBSITE = 6
BOOKSTORE = 7
COLLECTION = 8
SAFE = 9
def __init__(self):
"""creates a new Repository instance"""
PrimaryObject.__init__(self)
NoteBase.__init__(self)
AddressBase.__init__(self)
UrlBase.__init__(self)
self.type = (Repository.LIBRARY,"")
self.type = RepositoryType()
self.name = ""
def serialize(self):
return (self.handle, self.gramps_id, self.type, unicode(self.name),
return (self.handle, self.gramps_id, self.type.serialize(),
unicode(self.name),
NoteBase.serialize(self),
AddressBase.serialize(self),
UrlBase.serialize(self),
@ -82,9 +72,10 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase):
Converts the data held in a tuple created by the serialize method
back into the data in an Repository structure.
"""
(self.handle, self.gramps_id, self.type, self.name, note,
(self.handle, self.gramps_id, the_type, self.name, note,
address_list, urls ,self.marker, self.private) = data
self.type = RepositoryType(the_type)
NoteBase.unserialize(self,note)
AddressBase.unserialize(self,address_list)
UrlBase.unserialize(self,urls)
@ -96,7 +87,7 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase):
@return: Returns the list of all textual attributes of the object.
@rtype: list
"""
return [self.name,self.type[1]]
return [self.name,str(self.type)]
def get_text_data_child_list(self):
"""
@ -149,15 +140,10 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase):
@param type: descriptive type of the Repository
@type type: str
"""
if not type(the_type) == tuple:
warn( "set_type now takes a tuple", DeprecationWarning, 2)
# Wrapper for old API
# remove when transitition done.
if the_type in range(-1,10):
the_type = (the_type,'')
else:
the_type = (Repository.CUSTOM,the_type)
self.type = the_type
if type(the_type) == tuple:
self.type = NameType(the_type)
else:
self.type = the_type
def get_type(self):
"""

View File

@ -0,0 +1,64 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: _Name.py 6326 2006-04-13 11:21:33Z loshawlos $
from _GrampsType import GrampsType, init_map
from gettext import gettext as _
class RepositoryType(GrampsType):
UNKNOWN = -1
CUSTOM = 0
LIBRARY = 1
CEMETERY = 2
CHURCH = 3
ARCHIVE = 4
ALBUM = 5
WEBSITE = 6
BOOKSTORE = 7
COLLECTION = 8
SAFE = 9
_CUSTOM = CUSTOM
_DEFAULT = LIBRARY
_DATAMAP = [
(UNKNOWN, _("Unknown"), "Unknown"),
(CUSTOM, _("Custom"), "Custom"),
(LIBRARY, _("Library"), "Library"),
(CEMETERY, _("Cemetery"), "Cemetery"),
(CHURCH, _("Church"), "Church"),
(ARCHIVE, _("Archive"), "Archive"),
(ALBUM, _("Album"), "Album"),
(WEBSITE, _("Web site"), "Web site"),
(BOOKSTORE, _("Bookstore"), "Bookstore"),
(COLLECTION, _("Collection"), "Collection"),
(SAFE, _("Safe"), "Safe"),
]
_I2SMAP = init_map(_DATAMAP, 0, 1)
_S2IMAP = init_map(_DATAMAP, 1, 0)
_I2EMAP = init_map(_DATAMAP, 0, 2)
_E2IMAP = init_map(_DATAMAP, 2, 0)
def __init__(self, value=None):
GrampsType.__init__(self, value)

View File

@ -38,6 +38,7 @@ from warnings import warn
#-------------------------------------------------------------------------
from _BaseObject import BaseObject
from _PrivacyBase import PrivacyBase
from _UrlType import UrlType
#-------------------------------------------------------------------------
#
@ -48,13 +49,6 @@ class Url(BaseObject,PrivacyBase):
"""Contains information related to internet Uniform Resource Locators,
allowing gramps to store information about internet resources"""
UNKNOWN = -1
CUSTOM = 0
EMAIL = 1
WEB_HOME = 2
WEB_SEARCH = 3
WEB_FTP = 4
def __init__(self,source=None):
"""creates a new URL instance, copying from the source if present"""
BaseObject.__init__(self)
@ -66,13 +60,14 @@ class Url(BaseObject,PrivacyBase):
else:
self.path = ""
self.desc = ""
self.type = (Url.CUSTOM,"")
self.type = UrlType()
def serialize(self):
return (self.private,self.path,self.desc,self.type)
return (self.private,self.path,self.desc,self.type.serialize())
def unserialize(self,data):
(self.private,self.path,self.desc,self.type) = data
(self.private,self.path,self.desc,type_value) = data
self.type.unserialize(type_value)
return self
def get_text_data_list(self):
@ -105,15 +100,12 @@ class Url(BaseObject,PrivacyBase):
@param type: descriptive type of the Url
@type type: str
"""
if not type(the_type) == tuple:
warn( "set_type now takes a tuple", DeprecationWarning, 2)
# Wrapper for old API
# remove when transitition done.
if the_type in range(-1,5):
the_type = (the_type,'')
else:
the_type = (Url.CUSTOM,the_type)
self.type = the_type
if type(the_type) == tuple:
self.type = UrlType(the_type)
else:
print the_type
assert(isinstance(the_type,UrlType))
self.type = the_type
def get_type(self):
"""

56
src/RelLib/_UrlType.py Normal file
View File

@ -0,0 +1,56 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: _Name.py 6326 2006-04-13 11:21:33Z loshawlos $
from _GrampsType import GrampsType, init_map
from gettext import gettext as _
class UrlType(GrampsType):
UNKNOWN = -1
CUSTOM = 0
EMAIL = 1
WEB_HOME = 2
WEB_SEARCH = 3
WEB_FTP = 4
_CUSTOM = CUSTOM
_DEFAULT = UNKNOWN
_DATAMAP = [
(UNKNOWN, _("Unknown"), "Unknown"),
(CUSTOM, _("Custom"), "Custom"),
(EMAIL, _("E-mail"), "E-mail"),
(WEB_HOME, _("Web Home"), "Web Home"),
(WEB_SEARCH, _("Web Search"), "Web Search"),
(WEB_FTP, _("FTP"), "FTP"),
]
_I2SMAP = init_map(_DATAMAP, 0, 1)
_S2IMAP = init_map(_DATAMAP, 1, 0)
_I2EMAP = init_map(_DATAMAP, 0, 2)
_E2IMAP = init_map(_DATAMAP, 2, 0)
def __init__(self, value=None):
GrampsType.__init__(self, value)

View File

@ -61,5 +61,7 @@ from _Researcher import Researcher
# Type classes
from _GrampsType import GrampsType
from _NameType import NameType
from _UrlType import UrlType
from _ChildRefType import ChildRefType
from _RepositoryType import RepositoryType

View File

@ -71,21 +71,6 @@ gender = {
def format_gender( type):
return gender.get(type[0],_("Invalid"))
# child_relations = {
# RelLib.ChildRef.CHILD_NONE : _("None"),
# RelLib.ChildRef.CHILD_BIRTH : _("Birth"),
# RelLib.ChildRef.CHILD_ADOPTED : _("Adopted"),
# RelLib.ChildRef.CHILD_STEPCHILD : _("Stepchild"),
# RelLib.ChildRef.CHILD_SPONSORED : _("Sponsored"),
# RelLib.ChildRef.CHILD_FOSTER : _("Foster"),
# RelLib.ChildRef.CHILD_UNKNOWN : _("Unknown"),
# RelLib.ChildRef.CHILD_CUSTOM : _("Custom"),
# }
# def format_child_relation( type):
# if type[0] == RelLib.ChildRef.CHILD_CUSTOM:
# return type[1]
# return child_relations.get(type[0],_("Invalid id %d ('%s')")%type)
confidence = {
RelLib.SourceRef.CONF_VERY_HIGH : _("Very High"),
RelLib.SourceRef.CONF_HIGH : _("High"),
@ -225,32 +210,6 @@ family_rel_descriptions = {
"a man and woman"),
}
# name_types = {
# RelLib.NameType.UNKNOWN : _("Unknown"),
# RelLib.NameType.CUSTOM : _("Custom"),
# RelLib.NameType.AKA : _("Also Known As"),
# RelLib.NameType.BIRTH : _("Birth Name"),
# RelLib.NameType.MARRIED : _("Married Name"),
# }
# def format_name_type( type):
# assert(False)
# if type[0] == RelLib.Name.CUSTOM:
# return type[1]
# return name_types.get(type[0],_("Invalid id %d ('%s')")%type)
web_types = {
RelLib.Url.UNKNOWN : _("Unknown"),
RelLib.Url.CUSTOM : _("Custom"),
RelLib.Url.EMAIL : _("E-mail"),
RelLib.Url.WEB_HOME : _("Web Home"),
RelLib.Url.WEB_SEARCH : _("Web Search"),
RelLib.Url.WEB_FTP : _("FTP"),
}
def format_web_type( type):
if type[0] == RelLib.Url.CUSTOM:
return type[1]
return web_types.get(type[0],_("Invalid id %d ('%s')")%type)
source_media_types = {
RelLib.RepoRef.UNKNOWN : _("Unknown"),
RelLib.RepoRef.CUSTOM : _("Custom"),
@ -307,23 +266,23 @@ def format_event_role( type):
val = family_event_roles.get(type[0],_("Invalid id %d ('%s')")%type)
return val
repository_types = {
RelLib.Repository.UNKNOWN : _("Unknown"),
RelLib.Repository.CUSTOM : _("Custom"),
RelLib.Repository.LIBRARY : _("Library"),
RelLib.Repository.CEMETERY : _("Cemetery"),
RelLib.Repository.CHURCH : _("Church"),
RelLib.Repository.ARCHIVE : _("Archive"),
RelLib.Repository.ALBUM : _("Album"),
RelLib.Repository.WEBSITE : _("Web site"),
RelLib.Repository.BOOKSTORE : _("Bookstore"),
RelLib.Repository.COLLECTION : _("Collection"),
RelLib.Repository.SAFE : _("Safe"),
}
def format_repository_type( type):
if type[0] == RelLib.Repository.CUSTOM:
return type[1]
return repository_types.get(type[0],_("Invalid id %d ('%s')")%type)
# repository_types = {
# RelLib.Repository.UNKNOWN : _("Unknown"),
# RelLib.Repository.CUSTOM : _("Custom"),
# RelLib.Repository.LIBRARY : _("Library"),
# RelLib.Repository.CEMETERY : _("Cemetery"),
# RelLib.Repository.CHURCH : _("Church"),
# RelLib.Repository.ARCHIVE : _("Archive"),
# RelLib.Repository.ALBUM : _("Album"),
# RelLib.Repository.WEBSITE : _("Web site"),
# RelLib.Repository.BOOKSTORE : _("Bookstore"),
# RelLib.Repository.COLLECTION : _("Collection"),
# RelLib.Repository.SAFE : _("Safe"),
# }
# def format_repository_type( type):
# if type[0] == RelLib.Repository.CUSTOM:
# return type[1]
# return repository_types.get(type[0],_("Invalid id %d ('%s')")%type)
marker_types = {