From 0f2327429e904205da18c9fce6dc8308ac89d5a4 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 18 Oct 2007 21:52:08 +0000 Subject: [PATCH] 2007-10-18 Benny Malengier * src/DisplayTabs/__init__.py: add note backref * src/glade/gramps.glade: add notebook to note editor to show backref * src/DisplayTabs/_NoteTab.py: import editnote in method to avoid import loop * src/Editors/_EditNote.py: add notetab of backreferences * src/DisplayTabs/_NoteBackRefList.py: note backreferences list * src/DisplayTabs/Makefile.am: new backref file * po/POTFILES.in: new backref file svn: r9209 --- ChangeLog | 9 + po/POTFILES.in | 1 + src/DisplayTabs/Makefile.am | 1 + src/DisplayTabs/_NoteBackRefList.py | 39 ++ src/DisplayTabs/_NoteTab.py | 3 +- src/DisplayTabs/__init__.py | 1 + src/Editors/_EditNote.py | 19 + src/glade/gramps.glade | 595 +++++++++++++++------------- 8 files changed, 389 insertions(+), 279 deletions(-) create mode 100644 src/DisplayTabs/_NoteBackRefList.py diff --git a/ChangeLog b/ChangeLog index 12a3bff51..404e00e74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-10-18 Benny Malengier + * src/DisplayTabs/__init__.py: add note backref + * src/glade/gramps.glade: add notebook to note editor to show backref + * src/DisplayTabs/_NoteTab.py: import editnote in method to avoid import loop + * src/Editors/_EditNote.py: add notetab of backreferences + * src/DisplayTabs/_NoteBackRefList.py: note backreferences list + * src/DisplayTabs/Makefile.am: new backref file + * po/POTFILES.in: new backref file + 2007-10-18 Benny Malengier * src/DisplayModels/_BaseModel.py: remove comments * src/DisplayModels/_NoteModel.py: show all notes again in note view diff --git a/po/POTFILES.in b/po/POTFILES.in index cd7bb85ce..3c593ccc5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -149,6 +149,7 @@ src/DisplayTabs/_LocationModel.py src/DisplayTabs/_MediaBackRefList.py src/DisplayTabs/_NameEmbedList.py #src/DisplayTabs/_NameModel.py +src/DisplayTabs/_NoteBackRefList.py src/DisplayTabs/_NoteTab.py src/DisplayTabs/_TextTab.py src/DisplayTabs/_PersonEventEmbedList.py diff --git a/src/DisplayTabs/Makefile.am b/src/DisplayTabs/Makefile.am index bf068854c..b7851b7c7 100644 --- a/src/DisplayTabs/Makefile.am +++ b/src/DisplayTabs/Makefile.am @@ -28,6 +28,7 @@ pkgdata_PYTHON = \ _MediaBackRefList.py \ _NameEmbedList.py \ _NameModel.py \ + _NoteBackRefList.py \ _NoteTab.py \ _NoteModel.py \ _TextTab.py \ diff --git a/src/DisplayTabs/_NoteBackRefList.py b/src/DisplayTabs/_NoteBackRefList.py new file mode 100644 index 000000000..6655c7695 --- /dev/null +++ b/src/DisplayTabs/_NoteBackRefList.py @@ -0,0 +1,39 @@ +# +# 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: _NoteBackRefList.py 7068 2006-07-24 23:06:49Z rshura $ + +#------------------------------------------------------------------------- +# +# GRAMPS classes +# +#------------------------------------------------------------------------- + +from _BackRefModel import BackRefModel +from _BackRefList import BackRefList + +class NoteBackRefList(BackRefList): + + def __init__(self, dbstate, uistate, track, obj, callback=None): + BackRefList.__init__(self, dbstate, uistate, track, obj, + BackRefModel, callback=callback) + + def get_icon_name(self): + return 'gramps-notes' diff --git a/src/DisplayTabs/_NoteTab.py b/src/DisplayTabs/_NoteTab.py index 4ef0679ad..f6eeb0925 100644 --- a/src/DisplayTabs/_NoteTab.py +++ b/src/DisplayTabs/_NoteTab.py @@ -46,7 +46,6 @@ import gen.lib from DisplayTabs import log from _NoteModel import NoteModel from _EmbeddedList import EmbeddedList -from Editors import EditNote from DdTargets import DdTargets #------------------------------------------------------------------------- @@ -108,6 +107,7 @@ class NoteTab(EmbeddedList): if self.notetype : note.set_type(self.notetype) try: + from Editors import EditNote EditNote(self.dbstate, self.uistate, self.track, note, self.add_callback, self.callertitle, extratype = [self.notetype]) @@ -124,6 +124,7 @@ class NoteTab(EmbeddedList): if handle: note = self.dbstate.db.get_note_from_handle(handle) try: + from Editors import EditNote EditNote(self.dbstate, self.uistate, self.track, note, self.edit_callback, self.callertitle, extratype = [self.notetype] ) diff --git a/src/DisplayTabs/__init__.py b/src/DisplayTabs/__init__.py index c37d9ec10..3421b38d5 100644 --- a/src/DisplayTabs/__init__.py +++ b/src/DisplayTabs/__init__.py @@ -47,6 +47,7 @@ from _LdsEmbedList import LdsEmbedList from _LocationEmbedList import LocationEmbedList from _MediaBackRefList import MediaBackRefList from _NameEmbedList import NameEmbedList +from _NoteBackRefList import NoteBackRefList from _NoteTab import NoteTab from _TextTab import TextTab from _PersonEventEmbedList import PersonEventEmbedList diff --git a/src/Editors/_EditNote.py b/src/Editors/_EditNote.py index 97bd9f5ff..e4cfa6bfa 100644 --- a/src/Editors/_EditNote.py +++ b/src/Editors/_EditNote.py @@ -46,6 +46,7 @@ import Config import GrampsDisplay import MarkupText from _EditPrimary import EditPrimary +from DisplayTabs import NoteBackRefList from GrampsWidgets import * from gen.lib import Note @@ -185,7 +186,25 @@ class EditNote(EditPrimary): self.define_ok_button(self.top.get_widget('ok'),self.save) self.define_cancel_button(self.top.get_widget('cancel')) self.define_help_button(self.top.get_widget('help'), '') + + def _create_tabbed_pages(self): + """ + Creates the notebook tabs and inserts them into the main + window. + """ + notebook = self.top.get_widget("note_notebook") + self.backref_tab = self._add_tab( + notebook, + NoteBackRefList(self.dbstate, self.uistate, self.track, + self.dbstate.db.find_backlink_handles( + self.obj.handle)) + ) + + self._setup_notebook_tabs( notebook) + + notebook.show_all() + def build_interface(self): FORMAT_TOOLBAR = ''' diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index 11ca1e28d..0ae111c31 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -15298,106 +15298,124 @@ Very High - + True - False - 0 + True + True + True + GTK_POS_TOP + False + False - - 6 + True False - 6 + 0 - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 0 - True - True - GTK_PACK_END - - - - - + + 6 True False 6 - + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + True + True + GTK_PACK_END + - + True False 6 - + + + + + True - Spelling: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + False + 6 + + + + True + Spelling: + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + True + + + 0 + True + True + + 0 False - False - - - - - - True - False - True - - - 0 - True True + GTK_PACK_END @@ -15405,7 +15423,213 @@ Very High 0 False True - GTK_PACK_END + + + + + 0 + True + True + + + + + + 6 + True + 2 + 5 + False + 6 + 6 + + + + True + Type: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + False + True + True + + + 1 + 2 + 1 + 2 + fill + + + + + + True + ID: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + True + True + 0 + + True + + False + + + 1 + 2 + 0 + 1 + + + + + + + True + Marker: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 0 + 1 + fill + + + + + + + True + True + Preformatted + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 3 + 4 + 1 + 2 + fill + + + + + + + True + False + True + True + + + 3 + 5 + 0 + 1 + fill + + + + + + True + True + GTK_RELIEF_NONE + True + False + False + + + + True + 1 + gtk-dialog-authentication + 0.5 + 0.5 + 0 + 0 + + + + + 4 + 5 + 1 + 2 + fill + @@ -15417,216 +15641,31 @@ Very High - 0 - True - True + False + True - - 6 + True - 2 - 5 - False - 6 - 6 - - - - True - Type: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - False - True - True - - - 1 - 2 - 1 - 2 - fill - - - - - - True - ID: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - True - True - 0 - - True - - False - - - 1 - 2 - 0 - 1 - - - - - - - True - Marker: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 2 - 3 - 0 - 1 - fill - - - - - - - True - True - Preformatted - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 3 - 4 - 1 - 2 - fill - - - - - - - True - False - True - True - - - 3 - 5 - 0 - 1 - fill - - - - - - True - True - GTK_RELIEF_NONE - True - False - False - - - - True - 1 - gtk-dialog-authentication - 0.5 - 0.5 - 0 - 0 - - - - - 4 - 5 - 1 - 2 - fill - - - + <b>_Note</b> + True + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 - 0 - False - True + tab