From 0182f42307277699f403dbccf2e5958fda19377b Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Mon, 7 May 2007 20:41:16 +0000 Subject: [PATCH] 2007-05-07 Benny Malengier * 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 --- ChangeLog | 27 +++++++++++++ TODO | 16 ++++++++ src/DisplayTabs/_NoteTab.py | 11 ++++-- src/Editors/_EditAddress.py | 4 +- src/Editors/_EditAttribute.py | 4 +- src/Editors/_EditChildRef.py | 4 +- src/Editors/_EditEvent.py | 2 +- src/Editors/_EditEventRef.py | 6 ++- src/Editors/_EditFamily.py | 3 +- src/Editors/_EditLdsOrd.py | 6 ++- src/Editors/_EditMedia.py | 6 ++- src/Editors/_EditMediaRef.py | 7 +++- src/Editors/_EditName.py | 4 +- src/Editors/_EditNote.py | 36 +++++++++++++---- src/Editors/_EditPerson.py | 3 +- src/Editors/_EditPersonRef.py | 4 +- src/Editors/_EditPlace.py | 3 +- src/Editors/_EditRepoRef.py | 8 +++- src/Editors/_EditRepository.py | 3 +- src/Editors/_EditSource.py | 3 +- src/Editors/_EditSourceRef.py | 6 ++- src/GrampsWidgets.py | 33 ++++++++++++++-- src/RelLib/_NoteType.py | 71 +++++++++++++++++++++++++++++++++- 23 files changed, 233 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5daef350..8257ecbf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2007-05-07 Benny Malengier + * 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 * src/DataViews/_PersonView.py: add quick report * src/GrampsDb/_GrampsDbBase.py: use NotImplementedError instead of assertion diff --git a/TODO b/TODO index fe76a8c9a..7fb2d6c67 100644 --- a/TODO +++ b/TODO @@ -12,6 +12,22 @@ necessarily need multiple notes. Determine which ones should and 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 * Export to spreadsheet, print, CSV of views - DONE diff --git a/src/DisplayTabs/_NoteTab.py b/src/DisplayTabs/_NoteTab.py index edac3e3f5..cbcc14963 100644 --- a/src/DisplayTabs/_NoteTab.py +++ b/src/DisplayTabs/_NoteTab.py @@ -71,9 +71,11 @@ class NoteTab(EmbeddedList): (_('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.callertitle = callertitle + self.notetype = notetype EmbeddedList.__init__(self, dbstate, uistate, track, _("Notes"), NoteModel, move=True) @@ -103,9 +105,11 @@ class NoteTab(EmbeddedList): def add_button_clicked(self, obj): note = RelLib.Note() + if self.notetype : + note.set_type(self.notetype) try: EditNote(self.dbstate, self.uistate, [], note, self.add_callback, - self.callertitle) + self.callertitle, extratype = [self.notetype]) except Errors.WindowActiveError: pass @@ -120,7 +124,8 @@ class NoteTab(EmbeddedList): note = self.dbstate.db.get_note_from_handle(handle) try: EditNote(self.dbstate, self.uistate, [], note, - self.edit_callback, self.callertitle ) + self.edit_callback, self.callertitle, + extratype = [self.notetype] ) except Errors.WindowActiveError: pass diff --git a/src/Editors/_EditAddress.py b/src/Editors/_EditAddress.py index f621c414d..36402dcd8 100644 --- a/src/Editors/_EditAddress.py +++ b/src/Editors/_EditAddress.py @@ -47,6 +47,7 @@ import gtk.glade import const import Config from _EditSecondary import EditSecondary +from RelLib import NoteType from DisplayTabs import SourceEmbedList, NoteTab from GrampsWidgets import * @@ -135,7 +136,8 @@ class EditAddress(EditSecondary): self.note_tab = self._add_tab( notebook, 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) notebook.show_all() diff --git a/src/Editors/_EditAttribute.py b/src/Editors/_EditAttribute.py index 16a8f7258..c576d2ca2 100644 --- a/src/Editors/_EditAttribute.py +++ b/src/Editors/_EditAttribute.py @@ -50,6 +50,7 @@ import gtk.glade import const import Config from _EditSecondary import EditSecondary +from RelLib import NoteType from DisplayTabs import SourceEmbedList, NoteTab from GrampsWidgets import * @@ -117,7 +118,8 @@ class EditAttribute(EditSecondary): self.note_tab = self._add_tab( notebook, 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) notebook.show_all() diff --git a/src/Editors/_EditChildRef.py b/src/Editors/_EditChildRef.py index 0739f0d09..cf11fad87 100644 --- a/src/Editors/_EditChildRef.py +++ b/src/Editors/_EditChildRef.py @@ -46,6 +46,7 @@ import gtk.glade #------------------------------------------------------------------------- import const from _EditSecondary import EditSecondary +from RelLib import NoteType from DisplayTabs import SourceEmbedList, NoteTab from GrampsWidgets import * @@ -120,7 +121,8 @@ class EditChildRef(EditSecondary): self.note_tab = self._add_tab( notebook, 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) notebook.show_all() diff --git a/src/Editors/_EditEvent.py b/src/Editors/_EditEvent.py index c16afcb34..04e5610c0 100644 --- a/src/Editors/_EditEvent.py +++ b/src/Editors/_EditEvent.py @@ -167,7 +167,7 @@ class EditEvent(EditPrimary): self.note_tab = self._add_tab( notebook, 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( notebook, diff --git a/src/Editors/_EditEventRef.py b/src/Editors/_EditEventRef.py index eda52e76d..ab5beba63 100644 --- a/src/Editors/_EditEventRef.py +++ b/src/Editors/_EditEventRef.py @@ -171,12 +171,14 @@ class EditEventRef(EditReference): self.note_tab = self._add_tab( notebook, 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( notebook_ref, 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( notebook, diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 042a411b4..87b09db85 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -570,7 +570,8 @@ class EditFamily(EditPrimary): self.note_tab = self._add_tab( notebook, 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( notebook, diff --git a/src/Editors/_EditLdsOrd.py b/src/Editors/_EditLdsOrd.py index 29f9b606f..d1d7cb920 100644 --- a/src/Editors/_EditLdsOrd.py +++ b/src/Editors/_EditLdsOrd.py @@ -250,7 +250,8 @@ class EditLdsOrd(EditSecondary): self.note_tab = self._add_tab( notebook, 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) notebook.show_all() @@ -414,7 +415,8 @@ class EditFamilyLdsOrd(EditSecondary): self.note_tab = self._add_tab( notebook, NoteTab(self.dbstate, self.uistate, self.track, - self.obj.get_note_list())) + self.obj.get_note_list(), + notetype=RelLib.NoteType.LDS)) notebook.show_all() self.top.get_widget('vbox').pack_start(notebook,True) diff --git a/src/Editors/_EditMedia.py b/src/Editors/_EditMedia.py index 8d461cbd5..c9a471f21 100644 --- a/src/Editors/_EditMedia.py +++ b/src/Editors/_EditMedia.py @@ -155,12 +155,14 @@ class EditMedia(EditPrimary): self.note_tab = self._add_tab( notebook, NoteTab(self.dbstate, self.uistate, self.track, - self.obj.get_note_list())) + self.obj.get_note_list(), + notetype=RelLib.NoteType.MEDIA)) else: self.note_tab = self._add_tab( notebook, 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( notebook, diff --git a/src/Editors/_EditMediaRef.py b/src/Editors/_EditMediaRef.py index 997208f08..c22cc9162 100644 --- a/src/Editors/_EditMediaRef.py +++ b/src/Editors/_EditMediaRef.py @@ -43,6 +43,7 @@ import const import Config import Mime import ImgManip +from RelLib import NoteType from DisplayTabs import \ SourceEmbedList,AttrEmbedList,MediaBackRefList,NoteTab @@ -176,7 +177,8 @@ class EditMediaRef(EditReference): self.note_ref_tab = self._add_tab( notebook_ref, 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( notebook_src, @@ -191,7 +193,8 @@ class EditMediaRef(EditReference): self.src_note_ref_tab = self._add_tab( notebook_src, 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_ref) diff --git a/src/Editors/_EditName.py b/src/Editors/_EditName.py index d8a7d301c..402772999 100644 --- a/src/Editors/_EditName.py +++ b/src/Editors/_EditName.py @@ -44,6 +44,7 @@ import Config import Utils from BasicUtils import NameDisplay from _EditSecondary import EditSecondary +from RelLib import NoteType from DisplayTabs import SourceEmbedList,NoteTab from GrampsWidgets import * @@ -191,7 +192,8 @@ class EditName(EditSecondary): self.note_tab = self._add_tab( notebook, 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) diff --git a/src/Editors/_EditNote.py b/src/Editors/_EditNote.py index c093706b2..9da3b1740 100644 --- a/src/Editors/_EditNote.py +++ b/src/Editors/_EditNote.py @@ -55,9 +55,17 @@ from RelLib import Note class EditNote(EditPrimary): def __init__(self, state, uistate, track, note, callback=None - , callertitle = None): - """Create an EditNote window. Associate a note with the window.""" + , callertitle = None, extratype = None): + """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.extratype = extratype EditPrimary.__init__(self, state, uistate, track, note, state.db.get_note_from_handle, callback) @@ -71,13 +79,25 @@ class EditNote(EditPrimary): def get_menu_title(self): 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: - title = _('New Note') - if self.callertitle : - title += ' - ' + self.callertitle + if self.callertitle : + title = _('New Note - %(context)s') % { + 'context' : self.callertitle + } + else : + title = _('New Note') return title + + def get_custom_notetypes(self): + return self.dbstate.db.get_note_types() def _local_init(self): """Local initialization function. @@ -103,7 +123,9 @@ class EditNote(EditPrimary): self.top.get_widget('type'), self.obj.set_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.obj, diff --git a/src/Editors/_EditPerson.py b/src/Editors/_EditPerson.py index 864e4de24..be8f07e88 100644 --- a/src/Editors/_EditPerson.py +++ b/src/Editors/_EditPerson.py @@ -308,7 +308,8 @@ class EditPerson(EditPrimary): self.note_tab = self._add_tab( notebook, 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( notebook, diff --git a/src/Editors/_EditPersonRef.py b/src/Editors/_EditPersonRef.py index 3eef81591..78fffee48 100644 --- a/src/Editors/_EditPersonRef.py +++ b/src/Editors/_EditPersonRef.py @@ -48,6 +48,7 @@ import const import Config from BasicUtils import NameDisplay from _EditSecondary import EditSecondary +from RelLib import NoteType from DisplayTabs import SourceEmbedList, NoteTab from GrampsWidgets import * @@ -130,7 +131,8 @@ class EditPersonRef(EditSecondary): self.note_tab = self._add_tab( notebook, 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) notebook.show_all() diff --git a/src/Editors/_EditPlace.py b/src/Editors/_EditPlace.py index 026e83162..da56a82f2 100644 --- a/src/Editors/_EditPlace.py +++ b/src/Editors/_EditPlace.py @@ -179,7 +179,8 @@ class EditPlace(EditPrimary): self.note_tab = self._add_tab( notebook, 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( notebook, diff --git a/src/Editors/_EditRepoRef.py b/src/Editors/_EditRepoRef.py index ca8c4f0f7..e91ca8d35 100644 --- a/src/Editors/_EditRepoRef.py +++ b/src/Editors/_EditRepoRef.py @@ -42,6 +42,8 @@ import gtk import const import Config +from RelLib import NoteType + from DisplayTabs import NoteTab,AddrEmbedList,WebEmbedList,SourceBackRefList from GrampsWidgets import * from _EditReference import EditReference @@ -128,12 +130,14 @@ class EditRepoRef(EditReference): self.note_tab = self._add_tab( notebook_src, 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( notebook_ref, 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( notebook_src, diff --git a/src/Editors/_EditRepository.py b/src/Editors/_EditRepository.py index eb3831054..fe868cf1d 100644 --- a/src/Editors/_EditRepository.py +++ b/src/Editors/_EditRepository.py @@ -124,7 +124,8 @@ class EditRepository(EditPrimary): self.note_tab = self._add_tab( notebook, 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( notebook, diff --git a/src/Editors/_EditSource.py b/src/Editors/_EditSource.py index 49499bb5c..e9dc4574e 100644 --- a/src/Editors/_EditSource.py +++ b/src/Editors/_EditSource.py @@ -130,7 +130,8 @@ class EditSource(EditPrimary): self.note_tab = self._add_tab( notebook, 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( notebook, diff --git a/src/Editors/_EditSourceRef.py b/src/Editors/_EditSourceRef.py index 8811f8417..eebdb3550 100644 --- a/src/Editors/_EditSourceRef.py +++ b/src/Editors/_EditSourceRef.py @@ -140,7 +140,8 @@ class EditSourceRef(EditReference): self.note_tab = self._add_tab( notebook_src, 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( notebook_src, @@ -171,7 +172,8 @@ class EditSourceRef(EditReference): self.comment_tab = self._add_tab( notebook_ref, 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_ref) diff --git a/src/GrampsWidgets.py b/src/GrampsWidgets.py index edd87202a..6ab2b712c 100644 --- a/src/GrampsWidgets.py +++ b/src/GrampsWidgets.py @@ -434,10 +434,27 @@ class MonitoredType: self.set_val(self.sel.get_values()) class MonitoredDataType: + 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.get_val = get_val @@ -449,9 +466,19 @@ class MonitoredDataType: default = int(val) else: 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( - get_val().get_map(), + map, obj, get_val().get_custom(), default, diff --git a/src/RelLib/_NoteType.py b/src/RelLib/_NoteType.py index 155ce3094..a492bdddd 100644 --- a/src/RelLib/_NoteType.py +++ b/src/RelLib/_NoteType.py @@ -46,16 +46,62 @@ class NoteType(GrampsType): CUSTOM = 0 GENERAL = 1 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 _DEFAULT = GENERAL + - _DATAMAP = [ + _DATAMAPREAL = [ (UNKNOWN, _("Unknown"), "Unknown"), (CUSTOM, _("Custom"), "Custom"), (GENERAL, _("General"), "General"), (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) _S2IMAP = init_map(_DATAMAP, 1, 0) @@ -64,3 +110,26 @@ class NoteType(GrampsType): def __init__(self, value=None): 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 + \ No newline at end of file