Package gen :: Package lib :: Module notetype
[frames] | no frames]

Source Code for Module gen.lib.notetype

  1  # 
  2  # Gramps - a GTK+/GNOME based genealogy program 
  3  # 
  4  # Copyright (C) 2000-2007  Donald N. Allingham 
  5  # 
  6  # This program is free software; you can redistribute it and/or modify 
  7  # it under the terms of the GNU General Public License as published by 
  8  # the Free Software Foundation; either version 2 of the License, or 
  9  # (at your option) any later version. 
 10  # 
 11  # This program is distributed in the hope that it will be useful, 
 12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
 13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 14  # GNU General Public License for more details. 
 15  # 
 16  # You should have received a copy of the GNU General Public License 
 17  # along with this program; if not, write to the Free Software 
 18  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 19  # 
 20   
 21  # $Id: notetype.py 10103 2008-02-24 13:55:55Z acraphae $ 
 22   
 23  """ 
 24  Note types. 
 25  """ 
 26   
 27  #------------------------------------------------------------------------- 
 28  # 
 29  # standard python modules 
 30  # 
 31  #------------------------------------------------------------------------- 
 32  from gettext import gettext as _ 
 33   
 34  #------------------------------------------------------------------------- 
 35  # 
 36  # GRAMPS modules 
 37  # 
 38  #------------------------------------------------------------------------- 
 39  from gen.lib.grampstype import GrampsType, init_map 
 40   
41 -class NoteType(GrampsType):
42 43 UNKNOWN = -1 44 CUSTOM = 0 45 GENERAL = 1 46 RESEARCH = 2 47 TRANSCRIPT = 3 48 #per object with notes a Type to distinguish the notes 49 PERSON = 4 50 ATTRIBUTE = 5 51 ADDRESS = 6 52 ASSOCIATION = 7 53 LDS = 8 54 FAMILY = 9 55 EVENT = 10 56 EVENTREF = 11 57 SOURCE = 12 58 SOURCEREF = 13 59 PLACE = 14 60 REPO = 15 61 REPOREF = 16 62 MEDIA = 17 63 MEDIAREF = 18 64 CHILDREF = 19 65 PERSONNAME = 20 66 # other common types 67 SOURCE_TEXT = 21 # this is used for verbatim source text in SourceRef 68 CITATION = 22 69 REPORT_TEXT = 23 # this is used for notes used for reports 70 71 _CUSTOM = CUSTOM 72 _DEFAULT = GENERAL 73 74 75 _DATAMAPREAL = [ 76 (UNKNOWN, _("Unknown"), "Unknown"), 77 (CUSTOM, _("Custom"), "Custom"), 78 (GENERAL, _("General"), "General"), 79 (RESEARCH, _("Research"), "Research"), 80 (TRANSCRIPT, _("Transcript"), "Transcript"), 81 (SOURCE_TEXT, _("Source text"), "Source text"), 82 (CITATION, _('Citation'), "Citation"), 83 (REPORT_TEXT, _("Report"), "Report"), 84 ] 85 86 _DATAMAPIGNORE = [ 87 (PERSON, _("Person Note"),"Person Note"), 88 (PERSONNAME, _("Name Note"), "Name Note"), 89 (ATTRIBUTE, _("Attribute Note"), "Attribute Note"), 90 (ADDRESS, _("Address Note"), "Address Note"), 91 (ASSOCIATION,_("Association Note"), "Association Note"), 92 (LDS, _("LDS Note"), "LDS Note"), 93 (FAMILY, _("Family Note"),"Family Note"), 94 (EVENT, _("Event Note"), "Event Note"), 95 (EVENTREF, _("Event Reference Note"), "Event Reference Note"), 96 (SOURCE, _("Source Note"), "Source Note"), 97 (SOURCEREF, _("Source Reference Note"), "Source Reference Note"), 98 (PLACE, _("Place Note"), "Place Note"), 99 (REPO, _("Repository Note"), "Repository Note"), 100 (REPOREF, _("Repository Reference Note"), 101 "Repository Reference Note"), 102 (MEDIA, _("Media Note"), "Media Note"), 103 (MEDIAREF, _("Media Reference Note"), "Media Reference Note"), 104 (CHILDREF, _("Child Reference Note"), "Child Reference Note"), 105 ] 106 107 _DATAMAP = _DATAMAPREAL + _DATAMAPIGNORE 108 109 _I2SMAP = init_map(_DATAMAP, 0, 1) 110 _S2IMAP = init_map(_DATAMAP, 1, 0) 111 _I2EMAP = init_map(_DATAMAP, 0, 2) 112 _E2IMAP = init_map(_DATAMAP, 2, 0) 113
114 - def __init__(self, value=None):
115 GrampsType.__init__(self, value)
116
117 - def get_ignore_list(self, exception):
118 """ 119 Return a list of the types to ignore and not include in default lists. 120 121 Exception is a sublist of types that may not be ignored 122 123 @param exception: list of integer values corresponding with types that 124 have to be excluded from the ignore list 125 @type exception: list 126 @returns: list of integers corresponding with the types to ignore when 127 showing a list of different NoteType's 128 @rtype: list 129 """ 130 ignlist = [x[0] for x in self._DATAMAPIGNORE] 131 if exception: 132 for type in exception : 133 try: 134 del ignlist[ignlist.index(type)] 135 except ValueError: 136 pass 137 return ignlist
138