Preparation to extend navigation to all object types

svn: r13955
This commit is contained in:
Nick Hall 2010-01-01 19:55:09 +00:00
parent 0f78f5c918
commit c43f162b2f
14 changed files with 58 additions and 21 deletions

View File

@ -70,7 +70,7 @@ import GrampsCfg
import Errors import Errors
from QuestionDialog import (ErrorDialog, WarningDialog, QuestionDialog2, from QuestionDialog import (ErrorDialog, WarningDialog, QuestionDialog2,
InfoDialog) InfoDialog)
import gui.views.pageview as PageView import gui.views.navigationview as NavigationView
import Navigation import Navigation
from BasicUtils import name_displayer from BasicUtils import name_displayer
from gui import widgets from gui import widgets
@ -343,8 +343,8 @@ class ViewManager(CLIManager):
self.toolbar.insert(openbtn, 0) self.toolbar.insert(openbtn, 0)
self.person_nav = Navigation.PersonNavigation(self.dbstate, self.uistate) self.person_nav = Navigation.PersonNavigation(self.dbstate, self.uistate)
self._navigation_type[PageView.NAVIGATION_PERSON] = (self.person_nav, self._navigation_type[NavigationView.NAVIGATION_PERSON] = \
None) (self.person_nav, None)
self.recent_manager = DisplayState.RecentDocsMenu( self.recent_manager = DisplayState.RecentDocsMenu(
self.uistate, self.dbstate, self._read_recent_file) self.uistate, self.dbstate, self._read_recent_file)
self.recent_manager.build() self.recent_manager.build()
@ -532,8 +532,15 @@ class ViewManager(CLIManager):
] ]
self._navigation_type = { self._navigation_type = {
PageView.NAVIGATION_NONE: (None, None), None: (None, None),
PageView.NAVIGATION_PERSON: (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): def __keypress(self, action):
@ -876,7 +883,7 @@ class ViewManager(CLIManager):
Create the Views Create the Views
""" """
self.pages = [] self.pages = []
self.prev_nav = PageView.NAVIGATION_NONE self.prev_nav = None
self.ui_category = {} self.ui_category = {}
self.view_toggle_actions = {} self.view_toggle_actions = {}
self.cat_view_group = None self.cat_view_group = None

View File

@ -50,8 +50,15 @@ from gui.views.pageview import PageView
from TransUtils import sgettext as _ from TransUtils import sgettext as _
NAVIGATION_NONE = -1 NAVIGATION_NONE = -1
NAVIGATION_PERSON = 0 NAVIGATION_PERSON = 0
NAVIGATION_FAMILY = 1
NAVIGATION_EVENT = 2
NAVIGATION_PLACE = 3
NAVIGATION_SOURCE = 4
NAVIGATION_REPOSITORY = 5
NAVIGATION_MEDIA = 6
NAVIGATION_NOTE = 7
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #

View File

@ -49,9 +49,6 @@ from gettext import gettext as _
from gui.dbguielement import DbGUIElement from gui.dbguielement import DbGUIElement
from gui.widgets.menutoolbuttonaction import MenuToolButtonAction from gui.widgets.menutoolbuttonaction import MenuToolButtonAction
NAVIGATION_NONE = -1
NAVIGATION_PERSON = 0
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# PageView # PageView
@ -133,7 +130,7 @@ class PageView(DbGUIElement):
Indictates the navigation type. Currently, we only support navigation Indictates the navigation type. Currently, we only support navigation
for views that are Person centric. for views that are Person centric.
""" """
return NAVIGATION_NONE return None
def ui_definition(self): def ui_definition(self):
""" """

View File

@ -44,6 +44,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
from gui.views.navigationview import NAVIGATION_PLACE
from gui.views.listview import ListView from gui.views.listview import ListView
from gui.utils import add_menuitem from gui.utils import add_menuitem
import Errors import Errors
@ -121,6 +122,9 @@ class PlaceBaseView(ListView):
config.connect("interface.filter", config.connect("interface.filter",
self.filter_toggle) self.filter_toggle)
def navigation_type(self):
return NAVIGATION_PLACE
def column_ord_setfunc(self, clist): def column_ord_setfunc(self, clist):
self.dbstate.db.set_place_column_order(clist) self.dbstate.db.set_place_column_order(clist)

View File

@ -46,6 +46,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
from gui.views.navigationview import NAVIGATION_EVENT
from gui.views.listview import ListView from gui.views.listview import ListView
from gui.views.treemodels import EventModel from gui.views.treemodels import EventModel
import Utils import Utils
@ -110,6 +111,9 @@ class EventView(ListView):
config.connect("interface.filter", config.connect("interface.filter",
self.filter_toggle) self.filter_toggle)
def navigation_type(self):
return NAVIGATION_EVENT
def column_ord_setfunc(self, clist): def column_ord_setfunc(self, clist):
self.dbstate.db.set_event_column_order(clist) self.dbstate.db.set_event_column_order(clist)

View File

@ -44,6 +44,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
from gui.views.navigationview import NAVIGATION_FAMILY
from gui.views.listview import ListView from gui.views.listview import ListView
from gui.views.treemodels import FamilyModel from gui.views.treemodels import FamilyModel
from gui.editors import EditFamily from gui.editors import EditFamily
@ -99,6 +100,9 @@ class FamilyView(ListView):
config.connect("interface.filter", config.connect("interface.filter",
self.filter_toggle) self.filter_toggle)
def navigation_type(self):
return NAVIGATION_FAMILY
def column_ord_setfunc(self, clist): def column_ord_setfunc(self, clist):
self.dbstate.db.set_family_list_column_order(clist) self.dbstate.db.set_family_list_column_order(clist)

View File

@ -47,6 +47,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gui.utils import open_file_with_default_application 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.listview import ListView
from gui.views.treemodels import MediaModel from gui.views.treemodels import MediaModel
import ThumbNails import ThumbNails
@ -118,6 +119,9 @@ class MediaView(ListView):
config.connect("interface.filter", config.connect("interface.filter",
self.filter_toggle) self.filter_toggle)
def navigation_type(self):
return NAVIGATION_MEDIA
def column_ord_setfunc(self, clist): def column_ord_setfunc(self, clist):
self.dbstate.db.set_media_column_order(clist) self.dbstate.db.set_media_column_order(clist)

View File

@ -44,6 +44,7 @@ import gtk
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gui.views.navigationview import NAVIGATION_NOTE
from gui.views.listview import ListView from gui.views.listview import ListView
from gui.views.treemodels import NoteModel from gui.views.treemodels import NoteModel
import Utils import Utils
@ -102,6 +103,9 @@ class NoteView(ListView):
config.connect("interface.filter", config.connect("interface.filter",
self.filter_toggle) self.filter_toggle)
def navigation_type(self):
return NAVIGATION_NOTE
def column_ord_setfunc(self, clist): def column_ord_setfunc(self, clist):
self.dbstate.db.set_note_column_order(clist) self.dbstate.db.set_note_column_order(clist)

View File

@ -51,8 +51,7 @@ except:
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
import gui.views.pageview as PageView from gui.views.navigationview import NavigationView, NAVIGATION_PERSON
from gui.views.navigationview import NavigationView
from BasicUtils import name_displayer from BasicUtils import name_displayer
from Utils import (media_path_full, probably_alive, find_children, from Utils import (media_path_full, probably_alive, find_children,
find_parents, find_witnessed_people) find_parents, find_witnessed_people)
@ -552,7 +551,7 @@ class PedigreeView(NavigationView):
self.build_tree() self.build_tree()
def navigation_type(self): def navigation_type(self):
return PageView.NAVIGATION_PERSON return NAVIGATION_PERSON
def goto_handle(self, handle=None): def goto_handle(self, handle=None):
self.dirty = True self.dirty = True

View File

@ -53,7 +53,7 @@ except:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
import gui.views.pageview as PageView 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 BasicUtils import name_displayer
from Utils import (media_path_full, probably_alive, find_children, from Utils import (media_path_full, probably_alive, find_children,
find_parents, find_witnessed_people) find_parents, find_witnessed_people)
@ -677,7 +677,7 @@ class PedigreeViewExt(NavigationView):
self.build_tree() self.build_tree()
def navigation_type(self): def navigation_type(self):
return PageView.NAVIGATION_PERSON return NAVIGATION_PERSON
def goto_handle(self, handle=None): def goto_handle(self, handle=None):
"""Callback function for change active person in other GRAMPS page.""" """Callback function for change active person in other GRAMPS page."""

View File

@ -46,7 +46,7 @@ _LOG = logging.getLogger(".gui.personview")
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib 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.listview import ListView
from gui.views.treemodels import PeopleModel from gui.views.treemodels import PeopleModel
import Utils import Utils

View File

@ -47,9 +47,8 @@ import pango
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
import gui.views.pageview as PageView
from gui.editors import EditPerson, EditFamily 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 BasicUtils import name_displayer
from Utils import media_path_full, probably_alive from Utils import media_path_full, probably_alive
import DateHandler import DateHandler
@ -164,7 +163,7 @@ class RelationshipView(NavigationView):
self.callman.add_db_signal('person-delete', self.redraw) self.callman.add_db_signal('person-delete', self.redraw)
def navigation_type(self): def navigation_type(self):
return PageView.NAVIGATION_PERSON return NAVIGATION_PERSON
def goto_handle(self, handle): def goto_handle(self, handle):
self.redraw() self.redraw()

View File

@ -37,6 +37,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
from gui.views.navigationview import NAVIGATION_REPOSITORY
from gui.views.listview import ListView from gui.views.listview import ListView
from gui.views.treemodels import RepositoryModel from gui.views.treemodels import RepositoryModel
import Bookmarks import Bookmarks
@ -109,6 +110,9 @@ class RepositoryView(ListView):
config.connect("interface.filter", config.connect("interface.filter",
self.filter_toggle) self.filter_toggle)
def navigation_type(self):
return NAVIGATION_REPOSITORY
def column_ord_setfunc(self, clist): def column_ord_setfunc(self, clist):
self.dbstate.db.set_repository_column_order(clist) self.dbstate.db.set_repository_column_order(clist)

View File

@ -38,6 +38,7 @@ import gtk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
import config import config
from gui.views.navigationview import NAVIGATION_SOURCE
from gui.views.listview import ListView from gui.views.listview import ListView
from gui.views.treemodels import SourceModel from gui.views.treemodels import SourceModel
import Utils import Utils
@ -104,6 +105,9 @@ class SourceView(ListView):
config.connect("interface.filter", config.connect("interface.filter",
self.filter_toggle) self.filter_toggle)
def navigation_type(self):
return NAVIGATION_SOURCE
def column_ord_setfunc(self, clist): def column_ord_setfunc(self, clist):
self.dbstate.db.set_source_column_order(clist) self.dbstate.db.set_source_column_order(clist)