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
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

View File

@ -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
#------------------------------------------------------------------------------
#

View File

@ -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):
"""

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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."""

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -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)