From ac3e84d2071deeea520c955f030d84e6f8781f5b Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Sun, 25 Feb 2007 12:19:47 +0000 Subject: [PATCH] * src/DataViews/_NoteView.py: Enable filter editor * src/FilterEditor/_FilterEditor.py: Note Filter Editor * src/FilterEditor/_EditRule.py: Note Filter Editor * src/Filters/Rules/Note/_HasNote.py: Rename label * src/Filters/Rules/Note/__init__.py: Add more rules * src/Filters/Rules/__init__.py: Add Note Rules svn: r8232 --- ChangeLog | 8 ++++++++ src/DataViews/_NoteView.py | 5 +++-- src/FilterEditor/_EditRule.py | 7 +++++++ src/FilterEditor/_FilterEditor.py | 2 ++ src/Filters/Rules/Note/_HasNote.py | 2 +- src/Filters/Rules/Note/__init__.py | 9 +++++---- src/Filters/Rules/__init__.py | 1 + 7 files changed, 27 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d7561a1b..33bef487c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-25 Martin Hawlisch + * src/DataViews/_NoteView.py: Enable filter editor + * src/FilterEditor/_FilterEditor.py: Note Filter Editor + * src/FilterEditor/_EditRule.py: Note Filter Editor + * src/Filters/Rules/Note/_HasNote.py: Rename label + * src/Filters/Rules/Note/__init__.py: Add more rules + * src/Filters/Rules/__init__.py: Add Note Rules + 2007-02-24 Don Allingham * src/DisplayTabs/_NoteModel.py: added * src/DisplayTabs/_NoteTab.py: support new list diff --git a/src/DataViews/_NoteView.py b/src/DataViews/_NoteView.py index 456458454..2237667bf 100644 --- a/src/DataViews/_NoteView.py +++ b/src/DataViews/_NoteView.py @@ -106,8 +106,8 @@ class NoteView(PageView.ListView): PageView.ListView.define_actions(self) # self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES, # _('_Column Editor'), callback=self.column_editor) -# self.add_action('FilterEdit', None, _('Place Filter Editor'), -# callback=self.filter_editor,) + self.add_action('FilterEdit', None, _('Note Filter Editor'), + callback=self.filter_editor,) # def drag_info(self): # return DdTargets.PLACE_LINK @@ -149,6 +149,7 @@ class NoteView(PageView.ListView): + diff --git a/src/FilterEditor/_EditRule.py b/src/FilterEditor/_EditRule.py index 89775bbcb..995ef056f 100644 --- a/src/FilterEditor/_EditRule.py +++ b/src/FilterEditor/_EditRule.py @@ -85,6 +85,7 @@ _name2typeclass = { _('Family attribute:') : RelLib.AttributeType, _('Relationship type:') : RelLib.FamilyRelType, _('Marker type:') : RelLib.MarkerType, + _('Note type:') : RelLib.NoteType, } #------------------------------------------------------------------------- @@ -232,6 +233,7 @@ class MyID(gtk.HBox): 'Source' : _('Source'), 'MediaObject' : _('Media Object'), 'Repository' : _('Repository'), + 'Note' : _('Note'), } def __init__(self, dbstate, uistate, track, namespace='Person'): @@ -292,6 +294,9 @@ class MyID(gtk.HBox): elif self.namespace == 'Repository': repo = self.db.get_repository_from_gramps_id(gramps_id) name = repo.get_name() + elif self.namespace == 'Note': + note = self.db.get_note_from_gramps_id(gramps_id) + name = note.get() return name def set_text(self,val): @@ -388,6 +393,8 @@ class EditRule(ManagedWindow.ManagedWindow): class_list = Rules.MediaObject.editor_rule_list elif self.space == 'Repository': class_list = Rules.Repository.editor_rule_list + elif self.space == 'Note': + class_list = Rules.Note.editor_rule_list for class_obj in class_list: arglist = class_obj.labels diff --git a/src/FilterEditor/_FilterEditor.py b/src/FilterEditor/_FilterEditor.py index 408c3a154..933eacfda 100644 --- a/src/FilterEditor/_FilterEditor.py +++ b/src/FilterEditor/_FilterEditor.py @@ -199,3 +199,5 @@ class FilterEditor(ManagedWindow.ManagedWindow): return self.db.get_media_object_handles() elif self.space == 'Repository': return self.db.get_repository_handles() + elif self.space == 'Note': + return self.db.get_note_handles() diff --git a/src/Filters/Rules/Note/_HasNote.py b/src/Filters/Rules/Note/_HasNote.py index e7651e15f..20a03833a 100644 --- a/src/Filters/Rules/Note/_HasNote.py +++ b/src/Filters/Rules/Note/_HasNote.py @@ -45,7 +45,7 @@ class HasNote(Rule): labels = [ _('Text:'), - _('Type:'), + _('Note type:'), ] name = _('Notes matching parameters') description = _("Matches Notes with particular parameters") diff --git a/src/Filters/Rules/Note/__init__.py b/src/Filters/Rules/Note/__init__.py index e5bb1b278..661eb2c11 100644 --- a/src/Filters/Rules/Note/__init__.py +++ b/src/Filters/Rules/Note/__init__.py @@ -29,8 +29,8 @@ __author__ = "Don Allingham" from _AllNotes import AllNotes from _HasIdOf import HasIdOf from _RegExpIdOf import RegExpIdOf -#from _HasNoteRegexp import HasNoteRegexp -#from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf +from _HasNoteRegexp import HasNoteRegexp +from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf from _NotePrivate import NotePrivate from _MatchesFilter import MatchesFilter from _HasNote import HasNote @@ -39,8 +39,9 @@ editor_rule_list = [ AllNotes, HasIdOf, RegExpIdOf, -# HasNoteRegexp, -# HasNoteMatchingSubstringOf, + HasNote, + HasNoteRegexp, + HasNoteMatchingSubstringOf, NotePrivate, MatchesFilter, ] diff --git a/src/Filters/Rules/__init__.py b/src/Filters/Rules/__init__.py index 0ad8d8c69..17c2b3ca6 100644 --- a/src/Filters/Rules/__init__.py +++ b/src/Filters/Rules/__init__.py @@ -43,3 +43,4 @@ import Source import Place import MediaObject import Repository +import Note