From c43f162b2ffaf03441070cbd8860f1bc0f46b75e Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 1 Jan 2010 19:55:09 +0000 Subject: [PATCH] Preparation to extend navigation to all object types svn: r13955 --- src/gui/viewmanager.py | 19 +++++++++++++------ src/gui/views/navigationview.py | 9 ++++++++- src/gui/views/pageview.py | 5 +---- src/gui/views/placebaseview.py | 4 ++++ src/plugins/view/eventview.py | 4 ++++ src/plugins/view/familyview.py | 4 ++++ src/plugins/view/mediaview.py | 6 +++++- src/plugins/view/noteview.py | 4 ++++ src/plugins/view/pedigreeview.py | 5 ++--- src/plugins/view/pedigreeviewext.py | 4 ++-- src/plugins/view/personview.py | 2 +- src/plugins/view/relview.py | 5 ++--- src/plugins/view/repoview.py | 4 ++++ src/plugins/view/sourceview.py | 4 ++++ 14 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/gui/viewmanager.py b/src/gui/viewmanager.py index 2647526a0..fee3b9a09 100644 --- a/src/gui/viewmanager.py +++ b/src/gui/viewmanager.py @@ -70,7 +70,7 @@ import GrampsCfg import Errors from QuestionDialog import (ErrorDialog, WarningDialog, QuestionDialog2, InfoDialog) -import gui.views.pageview as PageView +import gui.views.navigationview as NavigationView import Navigation from BasicUtils import name_displayer from gui import widgets @@ -343,8 +343,8 @@ class ViewManager(CLIManager): self.toolbar.insert(openbtn, 0) self.person_nav = Navigation.PersonNavigation(self.dbstate, self.uistate) - self._navigation_type[PageView.NAVIGATION_PERSON] = (self.person_nav, - None) + self._navigation_type[NavigationView.NAVIGATION_PERSON] = \ + (self.person_nav, None) self.recent_manager = DisplayState.RecentDocsMenu( self.uistate, self.dbstate, self._read_recent_file) self.recent_manager.build() @@ -532,8 +532,15 @@ class ViewManager(CLIManager): ] self._navigation_type = { - PageView.NAVIGATION_NONE: (None, None), - PageView.NAVIGATION_PERSON: (None, None), + None: (None, None), + NavigationView.NAVIGATION_PERSON: (None, None), + NavigationView.NAVIGATION_FAMILY: (None, None), + NavigationView.NAVIGATION_EVENT: (None, None), + NavigationView.NAVIGATION_PLACE: (None, None), + NavigationView.NAVIGATION_SOURCE: (None, None), + NavigationView.NAVIGATION_REPOSITORY: (None, None), + NavigationView.NAVIGATION_MEDIA: (None, None), + NavigationView.NAVIGATION_NOTE: (None, None) } def __keypress(self, action): @@ -876,7 +883,7 @@ class ViewManager(CLIManager): Create the Views """ self.pages = [] - self.prev_nav = PageView.NAVIGATION_NONE + self.prev_nav = None self.ui_category = {} self.view_toggle_actions = {} self.cat_view_group = None diff --git a/src/gui/views/navigationview.py b/src/gui/views/navigationview.py index ec22483da..67b6a0319 100644 --- a/src/gui/views/navigationview.py +++ b/src/gui/views/navigationview.py @@ -50,8 +50,15 @@ from gui.views.pageview import PageView from TransUtils import sgettext as _ -NAVIGATION_NONE = -1 +NAVIGATION_NONE = -1 NAVIGATION_PERSON = 0 +NAVIGATION_FAMILY = 1 +NAVIGATION_EVENT = 2 +NAVIGATION_PLACE = 3 +NAVIGATION_SOURCE = 4 +NAVIGATION_REPOSITORY = 5 +NAVIGATION_MEDIA = 6 +NAVIGATION_NOTE = 7 #------------------------------------------------------------------------------ # diff --git a/src/gui/views/pageview.py b/src/gui/views/pageview.py index 413598cac..a8ed0cd23 100644 --- a/src/gui/views/pageview.py +++ b/src/gui/views/pageview.py @@ -49,9 +49,6 @@ from gettext import gettext as _ from gui.dbguielement import DbGUIElement from gui.widgets.menutoolbuttonaction import MenuToolButtonAction -NAVIGATION_NONE = -1 -NAVIGATION_PERSON = 0 - #------------------------------------------------------------------------------ # # PageView @@ -133,7 +130,7 @@ class PageView(DbGUIElement): Indictates the navigation type. Currently, we only support navigation for views that are Person centric. """ - return NAVIGATION_NONE + return None def ui_definition(self): """ diff --git a/src/gui/views/placebaseview.py b/src/gui/views/placebaseview.py index 7bcce0870..6559bf7dd 100644 --- a/src/gui/views/placebaseview.py +++ b/src/gui/views/placebaseview.py @@ -44,6 +44,7 @@ import gtk # #------------------------------------------------------------------------- import gen.lib +from gui.views.navigationview import NAVIGATION_PLACE from gui.views.listview import ListView from gui.utils import add_menuitem import Errors @@ -121,6 +122,9 @@ class PlaceBaseView(ListView): config.connect("interface.filter", self.filter_toggle) + def navigation_type(self): + return NAVIGATION_PLACE + def column_ord_setfunc(self, clist): self.dbstate.db.set_place_column_order(clist) diff --git a/src/plugins/view/eventview.py b/src/plugins/view/eventview.py index 5c5e5ef6c..268f77c81 100644 --- a/src/plugins/view/eventview.py +++ b/src/plugins/view/eventview.py @@ -46,6 +46,7 @@ import gtk # #------------------------------------------------------------------------- import gen.lib +from gui.views.navigationview import NAVIGATION_EVENT from gui.views.listview import ListView from gui.views.treemodels import EventModel import Utils @@ -110,6 +111,9 @@ class EventView(ListView): config.connect("interface.filter", self.filter_toggle) + def navigation_type(self): + return NAVIGATION_EVENT + def column_ord_setfunc(self, clist): self.dbstate.db.set_event_column_order(clist) diff --git a/src/plugins/view/familyview.py b/src/plugins/view/familyview.py index 27da008ba..d094bca91 100644 --- a/src/plugins/view/familyview.py +++ b/src/plugins/view/familyview.py @@ -44,6 +44,7 @@ import gtk # #------------------------------------------------------------------------- import gen.lib +from gui.views.navigationview import NAVIGATION_FAMILY from gui.views.listview import ListView from gui.views.treemodels import FamilyModel from gui.editors import EditFamily @@ -99,6 +100,9 @@ class FamilyView(ListView): config.connect("interface.filter", self.filter_toggle) + def navigation_type(self): + return NAVIGATION_FAMILY + def column_ord_setfunc(self, clist): self.dbstate.db.set_family_list_column_order(clist) diff --git a/src/plugins/view/mediaview.py b/src/plugins/view/mediaview.py index 59dffc89b..cbd9f1acf 100644 --- a/src/plugins/view/mediaview.py +++ b/src/plugins/view/mediaview.py @@ -47,6 +47,7 @@ import gtk # #------------------------------------------------------------------------- from gui.utils import open_file_with_default_application +from gui.views.navigationview import NAVIGATION_MEDIA from gui.views.listview import ListView from gui.views.treemodels import MediaModel import ThumbNails @@ -118,6 +119,9 @@ class MediaView(ListView): config.connect("interface.filter", self.filter_toggle) + def navigation_type(self): + return NAVIGATION_MEDIA + def column_ord_setfunc(self, clist): self.dbstate.db.set_media_column_order(clist) @@ -333,7 +337,7 @@ class MediaView(ListView): Utils.media_path_full(self.dbstate.db, obj.get_path())) self.image.set_from_pixbuf(pix) self.dbstate.emit('media-changed', (handle, )) - + def ui_definition(self): """ Return the UIManager XML description of the menus diff --git a/src/plugins/view/noteview.py b/src/plugins/view/noteview.py index 28cd65878..1dc70f03b 100644 --- a/src/plugins/view/noteview.py +++ b/src/plugins/view/noteview.py @@ -44,6 +44,7 @@ import gtk # gramps modules # #------------------------------------------------------------------------- +from gui.views.navigationview import NAVIGATION_NOTE from gui.views.listview import ListView from gui.views.treemodels import NoteModel import Utils @@ -102,6 +103,9 @@ class NoteView(ListView): config.connect("interface.filter", self.filter_toggle) + def navigation_type(self): + return NAVIGATION_NOTE + def column_ord_setfunc(self, clist): self.dbstate.db.set_note_column_order(clist) diff --git a/src/plugins/view/pedigreeview.py b/src/plugins/view/pedigreeview.py index 76981a842..2444f42ee 100644 --- a/src/plugins/view/pedigreeview.py +++ b/src/plugins/view/pedigreeview.py @@ -51,8 +51,7 @@ except: # #------------------------------------------------------------------------- import gen.lib -import gui.views.pageview as PageView -from gui.views.navigationview import NavigationView +from gui.views.navigationview import NavigationView, NAVIGATION_PERSON from BasicUtils import name_displayer from Utils import (media_path_full, probably_alive, find_children, find_parents, find_witnessed_people) @@ -552,7 +551,7 @@ class PedigreeView(NavigationView): self.build_tree() def navigation_type(self): - return PageView.NAVIGATION_PERSON + return NAVIGATION_PERSON def goto_handle(self, handle=None): self.dirty = True diff --git a/src/plugins/view/pedigreeviewext.py b/src/plugins/view/pedigreeviewext.py index 379b85e91..77e664787 100644 --- a/src/plugins/view/pedigreeviewext.py +++ b/src/plugins/view/pedigreeviewext.py @@ -53,7 +53,7 @@ except: #------------------------------------------------------------------------- import gen.lib import gui.views.pageview as PageView -from gui.views.navigationview import NavigationView +from gui.views.navigationview import NavigationView, NAVIGATION_PERSON from BasicUtils import name_displayer from Utils import (media_path_full, probably_alive, find_children, find_parents, find_witnessed_people) @@ -677,7 +677,7 @@ class PedigreeViewExt(NavigationView): self.build_tree() def navigation_type(self): - return PageView.NAVIGATION_PERSON + return NAVIGATION_PERSON def goto_handle(self, handle=None): """Callback function for change active person in other GRAMPS page.""" diff --git a/src/plugins/view/personview.py b/src/plugins/view/personview.py index 3081850bd..ca910f901 100644 --- a/src/plugins/view/personview.py +++ b/src/plugins/view/personview.py @@ -46,7 +46,7 @@ _LOG = logging.getLogger(".gui.personview") # #------------------------------------------------------------------------- import gen.lib -from gui.views.pageview import NAVIGATION_PERSON +from gui.views.navigationview import NAVIGATION_PERSON from gui.views.listview import ListView from gui.views.treemodels import PeopleModel import Utils diff --git a/src/plugins/view/relview.py b/src/plugins/view/relview.py index 333bfcdc1..be6346035 100644 --- a/src/plugins/view/relview.py +++ b/src/plugins/view/relview.py @@ -47,9 +47,8 @@ import pango # #------------------------------------------------------------------------- import gen.lib -import gui.views.pageview as PageView from gui.editors import EditPerson, EditFamily -from gui.views.navigationview import NavigationView +from gui.views.navigationview import NavigationView, NAVIGATION_PERSON from BasicUtils import name_displayer from Utils import media_path_full, probably_alive import DateHandler @@ -164,7 +163,7 @@ class RelationshipView(NavigationView): self.callman.add_db_signal('person-delete', self.redraw) def navigation_type(self): - return PageView.NAVIGATION_PERSON + return NAVIGATION_PERSON def goto_handle(self, handle): self.redraw() diff --git a/src/plugins/view/repoview.py b/src/plugins/view/repoview.py index 7e00c60a5..512bc2791 100644 --- a/src/plugins/view/repoview.py +++ b/src/plugins/view/repoview.py @@ -37,6 +37,7 @@ import gtk # #------------------------------------------------------------------------- import gen.lib +from gui.views.navigationview import NAVIGATION_REPOSITORY from gui.views.listview import ListView from gui.views.treemodels import RepositoryModel import Bookmarks @@ -109,6 +110,9 @@ class RepositoryView(ListView): config.connect("interface.filter", self.filter_toggle) + def navigation_type(self): + return NAVIGATION_REPOSITORY + def column_ord_setfunc(self, clist): self.dbstate.db.set_repository_column_order(clist) diff --git a/src/plugins/view/sourceview.py b/src/plugins/view/sourceview.py index 2d6df7eb2..101330de9 100644 --- a/src/plugins/view/sourceview.py +++ b/src/plugins/view/sourceview.py @@ -38,6 +38,7 @@ import gtk #------------------------------------------------------------------------- import gen.lib import config +from gui.views.navigationview import NAVIGATION_SOURCE from gui.views.listview import ListView from gui.views.treemodels import SourceModel import Utils @@ -104,6 +105,9 @@ class SourceView(ListView): config.connect("interface.filter", self.filter_toggle) + def navigation_type(self): + return NAVIGATION_SOURCE + def column_ord_setfunc(self, clist): self.dbstate.db.set_source_column_order(clist)