2007-05-07 Benny Malengier <bm@cage.ugent.be>

* src/Editors/_EditPlace.py:
	* src/Editors/_EditAddress.py:
	* src/Editors/_EditLdsOrd.py:
	* src/Editors/_EditSourceRef.py:
	* src/Editors/_EditSource.py:
	* src/Editors/_EditRepoRef.py:
	* src/Editors/_EditAttribute.py:
	* src/Editors/_EditPersonRef.py:
	* src/Editors/_EditNote.py:
	* src/Editors/_EditPerson.py:
	* src/Editors/_EditMediaRef.py:
	* src/Editors/_EditEventRef.py:
	* src/Editors/_EditMedia.py:
	* src/Editors/_EditRepository.py:
	* src/Editors/_EditName.py:
	* src/Editors/_EditChildRef.py:
	* src/Editors/_EditFamily.py:
	* src/Editors/_EditEvent.py:
	* src/RelLib/_NoteType.py:
	* src/DisplayTabs/_NoteTab.py:
	* src/GrampsWidgets.py:
	* TODO:
	Implement using a specific notetype instead of General for notes created as part of a
        primary or secondary object. Add list of types to ignore for inclusion in MonitoredDataType in a general manner.
        List remaining issues in TODO for multiple notes.



svn: r8441
This commit is contained in:
Benny Malengier 2007-05-07 20:41:16 +00:00
parent aafae7e1cd
commit 0182f42307
23 changed files with 233 additions and 37 deletions

View File

@ -1,3 +1,30 @@
2007-05-07 Benny Malengier <bm@cage.ugent.be>
* src/Editors/_EditPlace.py:
* src/Editors/_EditAddress.py:
* src/Editors/_EditLdsOrd.py:
* src/Editors/_EditSourceRef.py:
* src/Editors/_EditSource.py:
* src/Editors/_EditRepoRef.py:
* src/Editors/_EditAttribute.py:
* src/Editors/_EditPersonRef.py:
* src/Editors/_EditNote.py:
* src/Editors/_EditPerson.py:
* src/Editors/_EditMediaRef.py:
* src/Editors/_EditEventRef.py:
* src/Editors/_EditMedia.py:
* src/Editors/_EditRepository.py:
* src/Editors/_EditName.py:
* src/Editors/_EditChildRef.py:
* src/Editors/_EditFamily.py:
* src/Editors/_EditEvent.py:
* src/RelLib/_NoteType.py:
* src/DisplayTabs/_NoteTab.py:
* src/GrampsWidgets.py:
* TODO:
Implement using a specific notetype instead of General for notes created as part of a
primary or secondary object. Add list of types to ignore for inclusion in MonitoredDataType in a general manner.
List remaining issues in TODO for multiple notes.
2007-05-06 Don Allingham <don@gramps-project.org> 2007-05-06 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: add quick report * src/DataViews/_PersonView.py: add quick report
* src/GrampsDb/_GrampsDbBase.py: use NotImplementedError instead of assertion * src/GrampsDb/_GrampsDbBase.py: use NotImplementedError instead of assertion

16
TODO
View File

@ -12,6 +12,22 @@
necessarily need multiple notes. Determine which ones should and necessarily need multiple notes. Determine which ones should and
shouldn't. - DONE shouldn't. - DONE
* before release on multiple notes:
--> in note view: only show orphaned notes (notes are NOT in remove
orphaned notes tool which is what we want )
--> in note: also public/private (database, xml, editor)
--> on upgrade, the notetype should correspond to the object the note is made
from, so notetype SOURCE, SOURCEREF, ...
--> in sourceref:
* remove text tab.
* On import of GEDCOM text tag, or upgrade of < 2.2 database,
create a note with type TRANSCRIPT
* On export, do not write the text tag in sourceref, write a note instead
--> A GrampsWidget for use in report dialogs to select which notetypes to include
in a report
--> Support for multiple notes in all reports.
--> Empty text field on Saving Note should throw an error that Note is empty ! (?)
* Split views * Split views
* Export to spreadsheet, print, CSV of views - DONE * Export to spreadsheet, print, CSV of views - DONE

View File

@ -71,9 +71,11 @@ class NoteTab(EmbeddedList):
(_('Preview'), 1, 200), (_('Preview'), 1, 200),
] ]
def __init__(self, dbstate, uistate, track, data, callertitle=None): def __init__(self, dbstate, uistate, track, data, callertitle=None,
notetype=None):
self.data = data self.data = data
self.callertitle = callertitle self.callertitle = callertitle
self.notetype = notetype
EmbeddedList.__init__(self, dbstate, uistate, track, EmbeddedList.__init__(self, dbstate, uistate, track,
_("Notes"), NoteModel, move=True) _("Notes"), NoteModel, move=True)
@ -103,9 +105,11 @@ class NoteTab(EmbeddedList):
def add_button_clicked(self, obj): def add_button_clicked(self, obj):
note = RelLib.Note() note = RelLib.Note()
if self.notetype :
note.set_type(self.notetype)
try: try:
EditNote(self.dbstate, self.uistate, [], note, self.add_callback, EditNote(self.dbstate, self.uistate, [], note, self.add_callback,
self.callertitle) self.callertitle, extratype = [self.notetype])
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass
@ -120,7 +124,8 @@ class NoteTab(EmbeddedList):
note = self.dbstate.db.get_note_from_handle(handle) note = self.dbstate.db.get_note_from_handle(handle)
try: try:
EditNote(self.dbstate, self.uistate, [], note, EditNote(self.dbstate, self.uistate, [], note,
self.edit_callback, self.callertitle ) self.edit_callback, self.callertitle,
extratype = [self.notetype] )
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass

View File

@ -47,6 +47,7 @@ import gtk.glade
import const import const
import Config import Config
from _EditSecondary import EditSecondary from _EditSecondary import EditSecondary
from RelLib import NoteType
from DisplayTabs import SourceEmbedList, NoteTab from DisplayTabs import SourceEmbedList, NoteTab
from GrampsWidgets import * from GrampsWidgets import *
@ -135,7 +136,8 @@ class EditAddress(EditSecondary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=NoteType.ADDRESS))
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)
notebook.show_all() notebook.show_all()

View File

@ -50,6 +50,7 @@ import gtk.glade
import const import const
import Config import Config
from _EditSecondary import EditSecondary from _EditSecondary import EditSecondary
from RelLib import NoteType
from DisplayTabs import SourceEmbedList, NoteTab from DisplayTabs import SourceEmbedList, NoteTab
from GrampsWidgets import * from GrampsWidgets import *
@ -117,7 +118,8 @@ class EditAttribute(EditSecondary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype = NoteType.ATTRIBUTE))
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)
notebook.show_all() notebook.show_all()

View File

@ -46,6 +46,7 @@ import gtk.glade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
from _EditSecondary import EditSecondary from _EditSecondary import EditSecondary
from RelLib import NoteType
from DisplayTabs import SourceEmbedList, NoteTab from DisplayTabs import SourceEmbedList, NoteTab
from GrampsWidgets import * from GrampsWidgets import *
@ -120,7 +121,8 @@ class EditChildRef(EditSecondary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=NoteType.CHILDREF))
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)
notebook.show_all() notebook.show_all()

View File

@ -167,7 +167,7 @@ class EditEvent(EditPrimary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(), notetype=RelLib.NoteType.EVENT))
self.gallery_tab = self._add_tab( self.gallery_tab = self._add_tab(
notebook, notebook,

View File

@ -171,12 +171,14 @@ class EditEventRef(EditReference):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source.get_note_list())) self.source.get_note_list(),
notetype=RelLib.NoteType.EVENT))
self.note_ref_tab = self._add_tab( self.note_ref_tab = self._add_tab(
notebook_ref, notebook_ref,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source_ref.get_note_list())) self.source_ref.get_note_list(),
notetype=RelLib.NoteType.EVENTREF))
self.gallery_tab = self._add_tab( self.gallery_tab = self._add_tab(
notebook, notebook,

View File

@ -570,7 +570,8 @@ class EditFamily(EditPrimary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title())) self.obj.get_note_list(), self.get_menu_title(),
notetype=RelLib.NoteType.FAMILY))
self.gallery_tab = self._add_tab( self.gallery_tab = self._add_tab(
notebook, notebook,

View File

@ -250,7 +250,8 @@ class EditLdsOrd(EditSecondary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=RelLib.NoteType.LDS))
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)
notebook.show_all() notebook.show_all()
@ -414,7 +415,8 @@ class EditFamilyLdsOrd(EditSecondary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=RelLib.NoteType.LDS))
notebook.show_all() notebook.show_all()
self.top.get_widget('vbox').pack_start(notebook,True) self.top.get_widget('vbox').pack_start(notebook,True)

View File

@ -155,12 +155,14 @@ class EditMedia(EditPrimary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=RelLib.NoteType.MEDIA))
else: else:
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=RelLib.NoteType.MEDIA))
self.src_list = self._add_tab( self.src_list = self._add_tab(
notebook, notebook,

View File

@ -43,6 +43,7 @@ import const
import Config import Config
import Mime import Mime
import ImgManip import ImgManip
from RelLib import NoteType
from DisplayTabs import \ from DisplayTabs import \
SourceEmbedList,AttrEmbedList,MediaBackRefList,NoteTab SourceEmbedList,AttrEmbedList,MediaBackRefList,NoteTab
@ -176,7 +177,8 @@ class EditMediaRef(EditReference):
self.note_ref_tab = self._add_tab( self.note_ref_tab = self._add_tab(
notebook_ref, notebook_ref,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source_ref.get_note_list())) self.source_ref.get_note_list(),
notetype=NoteType.MEDIAREF))
self.src_srcref_list = self._add_tab( self.src_srcref_list = self._add_tab(
notebook_src, notebook_src,
@ -191,7 +193,8 @@ class EditMediaRef(EditReference):
self.src_note_ref_tab = self._add_tab( self.src_note_ref_tab = self._add_tab(
notebook_src, notebook_src,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source.get_note_list())) self.source.get_note_list(),
notetype=NoteType.MEDIA))
self._setup_notebook_tabs( notebook_src) self._setup_notebook_tabs( notebook_src)
self._setup_notebook_tabs( notebook_ref) self._setup_notebook_tabs( notebook_ref)

View File

@ -44,6 +44,7 @@ import Config
import Utils import Utils
from BasicUtils import NameDisplay from BasicUtils import NameDisplay
from _EditSecondary import EditSecondary from _EditSecondary import EditSecondary
from RelLib import NoteType
from DisplayTabs import SourceEmbedList,NoteTab from DisplayTabs import SourceEmbedList,NoteTab
from GrampsWidgets import * from GrampsWidgets import *
@ -191,7 +192,8 @@ class EditName(EditSecondary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=NoteType.PERSONNAME))
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)

View File

@ -55,9 +55,17 @@ from RelLib import Note
class EditNote(EditPrimary): class EditNote(EditPrimary):
def __init__(self, state, uistate, track, note, callback=None def __init__(self, state, uistate, track, note, callback=None
, callertitle = None): , callertitle = None, extratype = None):
"""Create an EditNote window. Associate a note with the window.""" """Create an EditNote window. Associate a note with the window.
@param callertitle: a text passed by calling object to add to title
@type callertitle: str
@param extratype: extra NoteType values to add to the default types
They are removed from the ignorelist of NoteType.
@type extratype: list of int
"""
self.callertitle = callertitle self.callertitle = callertitle
self.extratype = extratype
EditPrimary.__init__(self, state, uistate, track, note, EditPrimary.__init__(self, state, uistate, track, note,
state.db.get_note_from_handle, callback) state.db.get_note_from_handle, callback)
@ -71,13 +79,25 @@ class EditNote(EditPrimary):
def get_menu_title(self): def get_menu_title(self):
if self.obj.get_handle(): if self.obj.get_handle():
title = _('Note') + ': %s' % self.obj.get_gramps_id() if self.callertitle :
title = _('Note: %(id)s - %(context)s') % {
'id' : self.obj.get_gramps_id(),
'context' : self.callertitle
}
else :
title = _('Note: %s') % self.obj.get_gramps_id()
else: else:
title = _('New Note') if self.callertitle :
if self.callertitle : title = _('New Note - %(context)s') % {
title += ' - ' + self.callertitle 'context' : self.callertitle
}
else :
title = _('New Note')
return title return title
def get_custom_notetypes(self):
return self.dbstate.db.get_note_types()
def _local_init(self): def _local_init(self):
"""Local initialization function. """Local initialization function.
@ -103,7 +123,9 @@ class EditNote(EditPrimary):
self.top.get_widget('type'), self.top.get_widget('type'),
self.obj.set_type, self.obj.set_type,
self.obj.get_type, self.obj.get_type,
self.db.readonly) self.db.readonly,
custom_values=self.get_custom_notetypes(),
ignore_values=self.obj.get_type().get_ignore_list(self.extratype))
self.check = MonitoredCheckbox( self.check = MonitoredCheckbox(
self.obj, self.obj,

View File

@ -308,7 +308,8 @@ class EditPerson(EditPrimary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title())) self.obj.get_note_list(), self.get_menu_title(),
notetype=RelLib.NoteType.PERSON))
self.gallery_tab = self._add_tab( self.gallery_tab = self._add_tab(
notebook, notebook,

View File

@ -48,6 +48,7 @@ import const
import Config import Config
from BasicUtils import NameDisplay from BasicUtils import NameDisplay
from _EditSecondary import EditSecondary from _EditSecondary import EditSecondary
from RelLib import NoteType
from DisplayTabs import SourceEmbedList, NoteTab from DisplayTabs import SourceEmbedList, NoteTab
from GrampsWidgets import * from GrampsWidgets import *
@ -130,7 +131,8 @@ class EditPersonRef(EditSecondary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list())) self.obj.get_note_list(),
notetype=NoteType.ASSOCIATION))
self._setup_notebook_tabs( notebook) self._setup_notebook_tabs( notebook)
notebook.show_all() notebook.show_all()

View File

@ -179,7 +179,8 @@ class EditPlace(EditPrimary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title())) self.obj.get_note_list(), self.get_menu_title(),
notetype=RelLib.NoteType.PLACE))
self.gallery_tab = self._add_tab( self.gallery_tab = self._add_tab(
notebook, notebook,

View File

@ -42,6 +42,8 @@ import gtk
import const import const
import Config import Config
from RelLib import NoteType
from DisplayTabs import NoteTab,AddrEmbedList,WebEmbedList,SourceBackRefList from DisplayTabs import NoteTab,AddrEmbedList,WebEmbedList,SourceBackRefList
from GrampsWidgets import * from GrampsWidgets import *
from _EditReference import EditReference from _EditReference import EditReference
@ -128,12 +130,14 @@ class EditRepoRef(EditReference):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook_src, notebook_src,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source.get_note_list())) self.source.get_note_list(),
notetype=NoteType.REPO))
self.comment_tab = self._add_tab( self.comment_tab = self._add_tab(
notebook_ref, notebook_ref,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source_ref.get_note_list())) self.source_ref.get_note_list(),
notetype=NoteType.REPOREF))
self.address_tab = self._add_tab( self.address_tab = self._add_tab(
notebook_src, notebook_src,

View File

@ -124,7 +124,8 @@ class EditRepository(EditPrimary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title())) self.obj.get_note_list(), self.get_menu_title(),
notetype=RelLib.NoteType.REPO))
self.backref_tab = self._add_tab( self.backref_tab = self._add_tab(
notebook, notebook,

View File

@ -130,7 +130,8 @@ class EditSource(EditPrimary):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook, notebook,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title())) self.obj.get_note_list(), self.get_menu_title(),
RelLib.NoteType.SOURCE))
self.gallery_tab = self._add_tab( self.gallery_tab = self._add_tab(
notebook, notebook,

View File

@ -140,7 +140,8 @@ class EditSourceRef(EditReference):
self.note_tab = self._add_tab( self.note_tab = self._add_tab(
notebook_src, notebook_src,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source.get_note_list())) self.source.get_note_list(),
notetype=RelLib.NoteType.SOURCE))
self.gallery_tab = self._add_tab( self.gallery_tab = self._add_tab(
notebook_src, notebook_src,
@ -171,7 +172,8 @@ class EditSourceRef(EditReference):
self.comment_tab = self._add_tab( self.comment_tab = self._add_tab(
notebook_ref, notebook_ref,
NoteTab(self.dbstate, self.uistate, self.track, NoteTab(self.dbstate, self.uistate, self.track,
self.source_ref.get_note_list())) self.source_ref.get_note_list(),
notetype=RelLib.NoteType.SOURCEREF))
self._setup_notebook_tabs( notebook_src) self._setup_notebook_tabs( notebook_src)
self._setup_notebook_tabs( notebook_ref) self._setup_notebook_tabs( notebook_ref)

View File

@ -434,10 +434,27 @@ class MonitoredType:
self.set_val(self.sel.get_values()) self.set_val(self.sel.get_values())
class MonitoredDataType: class MonitoredDataType:
def __init__(self, obj, set_val, get_val, readonly=False, def __init__(self, obj, set_val, get_val, readonly=False,
custom_values=None): custom_values=None, ignore_values=None):
"""
Constructor for the MonitoredDataType class.
@param obj: Existing ComboBoxEntry widget to use.
@type obj: gtk.ComboBoxEntry
@param set_val: The function that sets value of the type in the object
@type set_val: method
@param get_val: The function that gets value of the type in the object.
This returns a GrampsType, of which get_map returns all possible types
@type get_val: method
@param custom_values: Extra values to show in the combobox. These can be
text of custom type, tuple with type info or GrampsType class
@type : list of str, tuple or GrampsType
@ignore_values: list of values not to show in the combobox. If the result
of get_val is in these, it is not ignored
@type : list of int
"""
self.set_val = set_val self.set_val = set_val
self.get_val = get_val self.get_val = get_val
@ -449,9 +466,19 @@ class MonitoredDataType:
default = int(val) default = int(val)
else: else:
default = None default = None
map = get_val().get_map().copy()
if ignore_values :
for key in map.keys():
try :
i = ignore_values.index(key)
except ValueError:
i = None
if (not i==None) and (not ignore_values[i] == default) :
del map[key]
self.sel = AutoComp.StandardCustomSelector( self.sel = AutoComp.StandardCustomSelector(
get_val().get_map(), map,
obj, obj,
get_val().get_custom(), get_val().get_custom(),
default, default,

View File

@ -46,16 +46,62 @@ class NoteType(GrampsType):
CUSTOM = 0 CUSTOM = 0
GENERAL = 1 GENERAL = 1
RESEARCH = 2 RESEARCH = 2
TRANSCRIPT = 3
#per object with notes a Type to distinguish the notes
PERSON = 4
ATTRIBUTE = 5
ADDRESS = 6
ASSOCIATION= 7
LDS = 8
FAMILY = 9
EVENT = 10
EVENTREF = 11
SOURCE = 12
SOURCEREF = 13
PLACE = 14
REPO = 15
REPOREF = 16
MEDIA = 17
MEDIAREF = 18
CHILDREF = 19
PERSONNAME = 20
# other common types
_CUSTOM = CUSTOM _CUSTOM = CUSTOM
_DEFAULT = GENERAL _DEFAULT = GENERAL
_DATAMAP = [ _DATAMAPREAL = [
(UNKNOWN, _("Unknown"), "Unknown"), (UNKNOWN, _("Unknown"), "Unknown"),
(CUSTOM, _("Custom"), "Custom"), (CUSTOM, _("Custom"), "Custom"),
(GENERAL, _("General"), "General"), (GENERAL, _("General"), "General"),
(RESEARCH, _("Research"), "Research"), (RESEARCH, _("Research"), "Research"),
(TRANSCRIPT, _("Transcript"), "Transcript"),
] ]
_DATAMAPIGNORE = [
(PERSON, _("Person Note"),"Person Note"),
(PERSONNAME, _("Name Note"), "Name Note"),
(ATTRIBUTE, _("Attribute Note"), "Attribute Note"),
(ADDRESS, _("Address Note"), "Address Note"),
(ASSOCIATION,_("Association Note"), "Association Note"),
(LDS, _("LDS Note"), "LDS Note"),
(FAMILY, _("Family Note"),"Family Note"),
(EVENT, _("Event Note"), "Event Note"),
(EVENTREF, _("Event Reference Note"), "Event Reference Note"),
(SOURCE, _("Source Note"), "Source Note"),
(SOURCEREF, _("Source Reference Note"), "Source Reference Note"),
(PLACE, _("Place Note"), "Place Note"),
(REPO, _("Repository Note"), "Repository Note"),
(REPOREF, _("Repository Reference Note"),
"Repository Reference Note"),
(MEDIA, _("Media Note"), "Media Note"),
(MEDIAREF, _("Media Reference Note"), "Media Reference Note"),
(CHILDREF, _("Child Reference Note"), "Child Reference Note"),
]
_DATAMAP = _DATAMAPREAL + _DATAMAPIGNORE
_I2SMAP = init_map(_DATAMAP, 0, 1) _I2SMAP = init_map(_DATAMAP, 0, 1)
_S2IMAP = init_map(_DATAMAP, 1, 0) _S2IMAP = init_map(_DATAMAP, 1, 0)
@ -64,3 +110,26 @@ class NoteType(GrampsType):
def __init__(self, value=None): def __init__(self, value=None):
GrampsType.__init__(self, value) GrampsType.__init__(self, value)
def get_ignore_list(self, exception):
"""
Return a list of the types to ignore and not include in default lists
Exception is a sublist of types that may not be ignored
@param exception: list of integer values corresponding with types that
have to be excluded from the ignore list
@type exception: list
@returns: list of integers corresponding with the types to ignore when
showing a list of different NoteType's
@rtype: list
"""
ignlist = [x[0] for x in self._DATAMAPIGNORE]
if exception:
for type in exception :
try:
del ignlist[ignlist.index(type)]
except ValueError:
pass
return ignlist