Extend history functionality (back/forward) and active-changed signals to all primary objects
svn: r14023
This commit is contained in:
parent
141100fdbf
commit
b503fa2e25
@ -105,7 +105,7 @@ class Bookmarks :
|
||||
"""
|
||||
Connect the person-delete signal
|
||||
"""
|
||||
self.dbstate.db.connect('person-delete', self.remove_handles)
|
||||
raise NotImplementedError
|
||||
|
||||
def update_bookmarks(self, bookmarks):
|
||||
"""
|
||||
@ -140,16 +140,15 @@ class Bookmarks :
|
||||
text.write(TOP)
|
||||
|
||||
self.undisplay()
|
||||
|
||||
|
||||
actions = []
|
||||
count = 0
|
||||
|
||||
if len(self.bookmarks.get()) > 0:
|
||||
text.write('<placeholder name="GoToBook">')
|
||||
|
||||
for item in self.bookmarks.get():
|
||||
try:
|
||||
label, obj = self.make_label(item)
|
||||
label = self.make_label(item)
|
||||
func = self.callback(item)
|
||||
action_id = "BM:%s" % item
|
||||
actions.append((action_id, None, label, None, None, func))
|
||||
@ -167,12 +166,10 @@ class Bookmarks :
|
||||
text.close()
|
||||
|
||||
def make_label(self, handle):
|
||||
person = self.dbstate.db.get_person_from_handle(handle)
|
||||
name = name_displayer.display(person)
|
||||
return ("%s [%s]" % (name, person.gramps_id), person)
|
||||
raise NotImplementedError
|
||||
|
||||
def callback(self, handle):
|
||||
return make_callback(handle, self.dbstate.change_active_handle)
|
||||
raise NotImplementedError
|
||||
|
||||
def add(self, person_handle):
|
||||
"""Append the person to the bottom of the bookmarks."""
|
||||
@ -326,6 +323,19 @@ class ListBookmarks(Bookmarks):
|
||||
def do_callback(self, handle):
|
||||
self.goto_handle(handle)
|
||||
|
||||
class PersonBookmarks(ListBookmarks) :
|
||||
"Handle the bookmarks interface for Gramps."
|
||||
|
||||
def __init__(self, dbstate, uistate, bookmarks, goto_handle):
|
||||
ListBookmarks.__init__(self, dbstate, uistate, bookmarks,
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
return Utils.navigation_label(self.dbstate.db, 'Person', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('person-delete', self.remove_handles)
|
||||
|
||||
class FamilyBookmarks(ListBookmarks) :
|
||||
"Handle the bookmarks interface for Gramps."
|
||||
|
||||
@ -334,9 +344,7 @@ class FamilyBookmarks(ListBookmarks) :
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
obj = self.dbstate.db.get_family_from_handle(handle)
|
||||
name = Utils.family_name(obj, self.dbstate.db)
|
||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||
return Utils.navigation_label(self.dbstate.db, 'Family', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('family-delete', self.remove_handles)
|
||||
@ -349,12 +357,7 @@ class EventBookmarks(ListBookmarks) :
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
obj = self.dbstate.db.get_event_from_handle(handle)
|
||||
if obj.get_description() == "":
|
||||
name = str(obj.get_type())
|
||||
else:
|
||||
name = obj.get_description()
|
||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||
return Utils.navigation_label(self.dbstate.db, 'Event', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('event-delete', self.remove_handles)
|
||||
@ -366,9 +369,7 @@ class SourceBookmarks(ListBookmarks) :
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
obj = self.dbstate.db.get_source_from_handle(handle)
|
||||
name = obj.get_title()
|
||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||
return Utils.navigation_label(self.dbstate.db, 'Source', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('source-delete', self.remove_handles)
|
||||
@ -381,9 +382,7 @@ class MediaBookmarks(ListBookmarks) :
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
name = obj.get_description()
|
||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||
return Utils.navigation_label(self.dbstate.db, 'Media', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('media-delete', self.remove_handles)
|
||||
@ -396,9 +395,7 @@ class RepoBookmarks(ListBookmarks) :
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
obj = self.dbstate.db.get_repository_from_handle(handle)
|
||||
name = obj.get_name()
|
||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||
return Utils.navigation_label(self.dbstate.db, 'Repository', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('repository-delete', self.remove_handles)
|
||||
@ -411,9 +408,7 @@ class PlaceBookmarks(ListBookmarks) :
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
obj = self.dbstate.db.get_place_from_handle(handle)
|
||||
name = obj.get_title()
|
||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||
return Utils.navigation_label(self.dbstate.db, 'Place', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('place-delete', self.remove_handles)
|
||||
@ -426,13 +421,7 @@ class NoteBookmarks(ListBookmarks) :
|
||||
goto_handle)
|
||||
|
||||
def make_label(self, handle):
|
||||
obj = self.dbstate.db.get_note_from_handle(handle)
|
||||
name = obj.get().replace('\n', ' ')
|
||||
#String must be unicode for truncation to work for non ascii characters
|
||||
name = unicode(name)
|
||||
if len(name) > 40:
|
||||
name = name[:40]+"..."
|
||||
return ("%s [%s]" % (name, obj.gramps_id), obj)
|
||||
return Utils.navigation_label(self.dbstate.db, 'Note', handle)
|
||||
|
||||
def connect_signals(self):
|
||||
self.dbstate.db.connect('note-delete', self.remove_handles)
|
||||
|
172
src/DbState.py
172
src/DbState.py
@ -25,29 +25,6 @@ Provide the database state class
|
||||
from gen.db import DbBsddbRead
|
||||
from gen.utils import Callback
|
||||
import config
|
||||
# FIXME: this brings in gtk
|
||||
#from gui.views.navigationview import (NAVIGATION_PERSON, NAVIGATION_FAMILY,
|
||||
# NAVIGATION_EVENT, NAVIGATION_PLACE,
|
||||
# NAVIGATION_SOURCE, NAVIGATION_REPOSITORY,
|
||||
# NAVIGATION_MEDIA, NAVIGATION_NOTE)
|
||||
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
|
||||
|
||||
ACTIVE_SIGNALS = ['person-active',
|
||||
'family-active',
|
||||
'event-active',
|
||||
'place-active',
|
||||
'source-active',
|
||||
'repository-active',
|
||||
'media-active',
|
||||
'note-active']
|
||||
|
||||
class DbState(Callback):
|
||||
"""
|
||||
@ -55,17 +32,8 @@ class DbState(Callback):
|
||||
"""
|
||||
|
||||
__signals__ = {
|
||||
'database-changed' : (DbBsddbRead, ),
|
||||
'active-changed' : (str, ),
|
||||
'person-active' : (str, ),
|
||||
'family-active' : (str, ),
|
||||
'event-active' : (str, ),
|
||||
'place-active' : (str, ),
|
||||
'source-active' : (str, ),
|
||||
'repository-active' : (str, ),
|
||||
'media-active' : (str, ),
|
||||
'note-active' : (str, ),
|
||||
'no-database' : None,
|
||||
'database-changed' : (DbBsddbRead, ),
|
||||
'no-database' : None,
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
@ -76,27 +44,6 @@ class DbState(Callback):
|
||||
Callback.__init__(self)
|
||||
self.db = DbBsddbRead()
|
||||
self.open = False
|
||||
self.active = None # Retained for backward compatibility.
|
||||
self.__active_objects = [None] * 8
|
||||
self.sighndl = None
|
||||
|
||||
def change_active_person(self, person):
|
||||
"""
|
||||
Change the active person and emits a signal to notify those who
|
||||
are interested.
|
||||
"""
|
||||
print 'DbState: change_active_person is deprecated, ' + \
|
||||
'use set_active_person instead.'
|
||||
if person:
|
||||
self.set_active_person(person.get_handle())
|
||||
|
||||
def change_active_handle(self, handle):
|
||||
"""
|
||||
Change the active person based on the person's handle
|
||||
"""
|
||||
print 'DbState: change_active_handle is deprecated, ' + \
|
||||
'use set_active_person instead.'
|
||||
self.set_active_person(handle)
|
||||
|
||||
def change_database(self, database):
|
||||
"""
|
||||
@ -120,8 +67,6 @@ class DbState(Callback):
|
||||
config.get('preferences.eprefix'),
|
||||
config.get('preferences.rprefix'),
|
||||
config.get('preferences.nprefix') )
|
||||
|
||||
self.active = None
|
||||
self.open = True
|
||||
|
||||
def signal_change(self):
|
||||
@ -137,8 +82,6 @@ class DbState(Callback):
|
||||
self.db.close()
|
||||
self.db = DbBsddbRead()
|
||||
self.db.db_is_open = False
|
||||
self.active = None # Retained for backward compatibility.
|
||||
self.__active_objects = [None] * 8
|
||||
self.open = False
|
||||
self.emit('database-changed', (self.db, ))
|
||||
|
||||
@ -147,114 +90,3 @@ class DbState(Callback):
|
||||
Get a reference to the current database.
|
||||
"""
|
||||
return self.db
|
||||
|
||||
def set_active(self, navigation_type, handle):
|
||||
"""
|
||||
Set the active handle for the given navigation type.
|
||||
"""
|
||||
handle = str(handle) # This is sometimes unicode.
|
||||
old_handle = self.__active_objects[navigation_type]
|
||||
if old_handle != handle:
|
||||
self.__active_objects[navigation_type] = handle
|
||||
signal = ACTIVE_SIGNALS[navigation_type]
|
||||
try:
|
||||
self.emit(signal, (handle, ))
|
||||
except:
|
||||
self.emit(signal, ("", ))
|
||||
|
||||
# Retained for backward compatibility.
|
||||
if navigation_type == NAVIGATION_PERSON:
|
||||
self.active = self.db.get_person_from_handle(handle)
|
||||
try:
|
||||
self.emit('active-changed', (handle, ))
|
||||
except:
|
||||
self.emit('active-changed', ("", ))
|
||||
|
||||
def get_active(self, navigation_type):
|
||||
"""
|
||||
Return the active handle for the given navigation type.
|
||||
"""
|
||||
handle = self.__active_objects[navigation_type]
|
||||
if navigation_type == NAVIGATION_PERSON:
|
||||
return self.db.get_person_from_handle(handle)
|
||||
elif navigation_type == NAVIGATION_FAMILY:
|
||||
return self.db.get_family_from_handle(handle)
|
||||
elif navigation_type == NAVIGATION_EVENT:
|
||||
return self.db.get_event_from_handle(handle)
|
||||
elif navigation_type == NAVIGATION_PLACE:
|
||||
return self.db.get_place_from_handle(handle)
|
||||
elif navigation_type == NAVIGATION_SOURCE:
|
||||
return self.db.get_source_from_handle(handle)
|
||||
elif navigation_type == NAVIGATION_REPOSITORY:
|
||||
return self.db.get_repository_from_handle(handle)
|
||||
elif navigation_type == NAVIGATION_MEDIA:
|
||||
return self.db.get_object_from_handle(handle)
|
||||
elif navigation_type == NAVIGATION_NOTE:
|
||||
return self.db.get_note_from_handle(handle)
|
||||
|
||||
###########################################################################
|
||||
# Convenience functions
|
||||
###########################################################################
|
||||
def set_active_person(self, handle):
|
||||
"""Set the active person to the given handle."""
|
||||
self.set_active(NAVIGATION_PERSON, handle)
|
||||
|
||||
def get_active_person(self):
|
||||
"""Return the handle for the active person."""
|
||||
return self.get_active(NAVIGATION_PERSON)
|
||||
|
||||
def set_active_family(self, handle):
|
||||
"""Set the active family to the given handle."""
|
||||
self.set_active(NAVIGATION_FAMILY, handle)
|
||||
|
||||
def get_active_family(self):
|
||||
"""Return the handle for the active family."""
|
||||
return self.get_active(NAVIGATION_FAMILY)
|
||||
|
||||
def set_active_event(self, handle):
|
||||
"""Set the active event to the given handle."""
|
||||
self.set_active(NAVIGATION_EVENT, handle)
|
||||
|
||||
def get_active_event(self):
|
||||
"""Return the handle for the active event."""
|
||||
return self.get_active(NAVIGATION_EVENT)
|
||||
|
||||
def set_active_place(self, handle):
|
||||
"""Set the active place to the given handle."""
|
||||
self.set_active(NAVIGATION_PLACE, handle)
|
||||
|
||||
def get_active_place(self):
|
||||
"""Return the handle for the active place."""
|
||||
return self.get_active(NAVIGATION_PLACE)
|
||||
|
||||
def set_active_source(self, handle):
|
||||
"""Set the active source to the given handle."""
|
||||
self.set_active(NAVIGATION_SOURCE, handle)
|
||||
|
||||
def get_active_source(self):
|
||||
"""Return the handle for the active source."""
|
||||
return self.get_active(NAVIGATION_SOURCE)
|
||||
|
||||
def set_active_repository(self, handle):
|
||||
"""Set the active repository to the given handle."""
|
||||
self.set_active(NAVIGATION_REPOSITORY, handle)
|
||||
|
||||
def get_active_repository(self):
|
||||
"""Return the handle for the active repository."""
|
||||
return self.get_active(NAVIGATION_REPOSITORY)
|
||||
|
||||
def set_active_media(self, handle):
|
||||
"""Set the active media to the given handle."""
|
||||
self.set_active(NAVIGATION_MEDIA, handle)
|
||||
|
||||
def get_active_media(self):
|
||||
"""Return the handle for the active media."""
|
||||
return self.get_active(NAVIGATION_MEDIA)
|
||||
|
||||
def set_active_note(self, handle):
|
||||
"""Set the active note to the given handle."""
|
||||
self.set_active(NAVIGATION_NOTE, handle)
|
||||
|
||||
def get_active_note(self):
|
||||
"""Return the handle for the active note."""
|
||||
return self.get_active(NAVIGATION_NOTE)
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2008 Brian G. Matherly
|
||||
# Copyright (C) 2010 Nick Hall
|
||||
#
|
||||
# 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
|
||||
@ -53,12 +54,14 @@ import gobject
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.utils
|
||||
from gui.utils import process_pending_events
|
||||
from gui.views.navigationview import NavigationView
|
||||
import config
|
||||
from BasicUtils import name_displayer
|
||||
import const
|
||||
import ManagedWindow
|
||||
import Relationship
|
||||
from glade import Glade
|
||||
from Utils import navigation_label
|
||||
|
||||
DISABLED = -1
|
||||
|
||||
@ -74,7 +77,7 @@ class History(gen.utils.Callback):
|
||||
"""
|
||||
|
||||
__signals__ = {
|
||||
'changed' : (list, ),
|
||||
'active-changed' : (str, ),
|
||||
'menu-changed' : (list, ),
|
||||
}
|
||||
|
||||
@ -108,7 +111,8 @@ class History(gen.utils.Callback):
|
||||
mhc = self.mhistory.count(del_id)
|
||||
for c in range(mhc):
|
||||
self.mhistory.remove(del_id)
|
||||
self.emit('changed', (self.history, ))
|
||||
if self.history:
|
||||
self.emit('active-changed', (self.history[self.index],))
|
||||
self.emit('menu-changed', (self.mhistory, ))
|
||||
|
||||
def push(self, handle):
|
||||
@ -117,14 +121,15 @@ class History(gen.utils.Callback):
|
||||
"""
|
||||
self.prune()
|
||||
if len(self.history) == 0 or handle != self.history[-1]:
|
||||
self.history.append(handle)
|
||||
self.history.append(str(handle))
|
||||
if handle in self.mhistory:
|
||||
self.mhistory.remove(handle)
|
||||
self.mhistory.append(handle)
|
||||
self.index += 1
|
||||
if self.history:
|
||||
self.emit('active-changed', (self.history[self.index],))
|
||||
self.emit('menu-changed', (self.mhistory, ))
|
||||
self.emit('changed', (self.history, ))
|
||||
|
||||
|
||||
def forward(self, step=1):
|
||||
"""
|
||||
Moves forward in the history list
|
||||
@ -134,6 +139,8 @@ class History(gen.utils.Callback):
|
||||
if handle not in self.mhistory:
|
||||
self.mhistory.append(handle)
|
||||
self.emit('menu-changed', (self.mhistory, ))
|
||||
if self.history:
|
||||
self.emit('active-changed', (self.history[self.index],))
|
||||
return str(self.history[self.index])
|
||||
|
||||
def back(self, step=1):
|
||||
@ -146,6 +153,8 @@ class History(gen.utils.Callback):
|
||||
if handle not in self.mhistory:
|
||||
self.mhistory.append(handle)
|
||||
self.emit('menu-changed', (self.mhistory, ))
|
||||
if self.history:
|
||||
self.emit('active-changed', (self.history[self.index],))
|
||||
return str(self.history[self.index])
|
||||
except IndexError:
|
||||
return u""
|
||||
@ -316,7 +325,7 @@ class DisplayState(gen.utils.Callback):
|
||||
self.status = status
|
||||
self.status_id = status.get_context_id('GRAMPS')
|
||||
self.progress = progress
|
||||
self.phistory = History()
|
||||
self.history_lookup = {}
|
||||
self.gwm = ManagedWindow.GrampsWindowManager(uimanager)
|
||||
self.widget = None
|
||||
self.disprel_old = ''
|
||||
@ -336,6 +345,37 @@ class DisplayState(gen.utils.Callback):
|
||||
# but this connection is still made!
|
||||
# self.dbstate.connect('database-changed', self.db_changed)
|
||||
|
||||
def get_history(self, nav_type, nav_group=0):
|
||||
"""
|
||||
Return the history object for the given navigation type and group.
|
||||
"""
|
||||
return self.history_lookup.get((nav_type, nav_group))
|
||||
|
||||
def register(self, nav_type, nav_group):
|
||||
"""
|
||||
Create a history and navigation object for the specified
|
||||
navigation type and group, if they don't exist.
|
||||
"""
|
||||
if (nav_type, nav_group) not in self.history_lookup:
|
||||
history = History()
|
||||
self.history_lookup[(nav_type, nav_group)] = history
|
||||
|
||||
def get_active(self, nav_type, nav_group=0):
|
||||
"""
|
||||
Return the handle for the active obejct specified by the given
|
||||
navigation type and group.
|
||||
"""
|
||||
history = self.get_history(nav_type, nav_group)
|
||||
return history.present()
|
||||
|
||||
def set_active(self, handle, nav_type, nav_group=0):
|
||||
"""
|
||||
Set the active object for the specified navigation type and group to
|
||||
the given handle.
|
||||
"""
|
||||
history = self.get_history(nav_type, nav_group)
|
||||
history.push(handle)
|
||||
|
||||
def set_sensitive(self, state):
|
||||
self.window.set_sensitive(state)
|
||||
|
||||
@ -356,7 +396,7 @@ class DisplayState(gen.utils.Callback):
|
||||
"""
|
||||
self.relationship.set_depth(value)
|
||||
|
||||
def display_relationship(self, dbstate):
|
||||
def display_relationship(self, dbstate, active_handle):
|
||||
""" Construct the relationship in order to show it in the statusbar
|
||||
This can be a time intensive calculation, so we only want to do
|
||||
it if persons are different than before.
|
||||
@ -368,34 +408,24 @@ class DisplayState(gen.utils.Callback):
|
||||
"""
|
||||
self.relationship.connect_db_signals(dbstate)
|
||||
default_person = dbstate.db.get_default_person()
|
||||
active = dbstate.get_active_person()
|
||||
if default_person is None or active is None:
|
||||
if default_person is None or active_handle is None:
|
||||
return u''
|
||||
if default_person.handle == self.disprel_defpers and \
|
||||
active.handle == self.disprel_active :
|
||||
active_handle == self.disprel_active :
|
||||
return self.disprel_old
|
||||
|
||||
|
||||
active = dbstate.db.get_person_from_handle(active_handle)
|
||||
name = self.relationship.get_one_relationship(
|
||||
dbstate.db, default_person, active)
|
||||
#store present call data
|
||||
self.disprel_old = name
|
||||
self.disprel_defpers = default_person.handle
|
||||
self.disprel_active = active.handle
|
||||
self.disprel_active = active_handle
|
||||
if name:
|
||||
return name
|
||||
else:
|
||||
return u""
|
||||
|
||||
def clear_history(self, handle=None):
|
||||
"""Clear the history. If handle is given, then the history is
|
||||
immediately initialized with a first entry
|
||||
(you'd eg want active person you view there as History contains the
|
||||
present object too!)
|
||||
"""
|
||||
self.phistory.clear()
|
||||
if handle :
|
||||
self.phistory.push(handle)
|
||||
|
||||
def set_busy_cursor(self, value):
|
||||
if value == self.busy:
|
||||
return
|
||||
@ -427,22 +457,29 @@ class DisplayState(gen.utils.Callback):
|
||||
self.status.push(1, '', self.last_bar)
|
||||
|
||||
def modify_statusbar(self, dbstate, active=None):
|
||||
view = self.viewmanager.active_page
|
||||
if not isinstance(view, NavigationView):
|
||||
return
|
||||
|
||||
nav_type = view.navigation_type()
|
||||
active_handle = self.get_active(nav_type, view.navigation_group())
|
||||
|
||||
self.status.pop(self.status_id)
|
||||
if dbstate.active is None:
|
||||
self.status.push(self.status_id, "")
|
||||
else:
|
||||
person = dbstate.get_active_person()
|
||||
if person:
|
||||
pname = name_displayer.display(person)
|
||||
name = "[%s] %s" % (person.get_gramps_id(), pname)
|
||||
if config.get('interface.statusbar') > 1:
|
||||
if person.handle != dbstate.db.get_default_handle():
|
||||
msg = self.display_relationship(dbstate)
|
||||
if msg:
|
||||
name = "%s (%s)" % (name, msg.strip())
|
||||
else:
|
||||
name = _("No active person")
|
||||
self.status.push(self.status_id, name)
|
||||
|
||||
name = navigation_label(dbstate.db, nav_type, active_handle)
|
||||
|
||||
# Append relationship to default person if funtionality is enabled.
|
||||
if nav_type == 'Person' and active_handle \
|
||||
and config.get('interface.statusbar') > 1:
|
||||
if active_handle != dbstate.db.get_default_handle():
|
||||
msg = self.display_relationship(dbstate, active_handle)
|
||||
if msg:
|
||||
name = '%s (%s)' % (name, msg.strip())
|
||||
|
||||
if not name:
|
||||
name = _('No active object')
|
||||
|
||||
self.status.push(self.status_id, name)
|
||||
process_pending_events()
|
||||
|
||||
def pulse_progressbar(self, value):
|
||||
|
@ -124,9 +124,9 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
#set up callback method for the export plugins
|
||||
self.callback = self.pulse_progressbar
|
||||
|
||||
if self.dbstate.active:
|
||||
self.person = self.dbstate.get_active_person()
|
||||
else:
|
||||
person_handle = self.uistate.get_active('Person')
|
||||
self.person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
if not self.person:
|
||||
self.person = self.dbstate.db.find_initial_person()
|
||||
|
||||
self.logo = gtk.gdk.pixbuf_new_from_file(_gramps_png)
|
||||
@ -401,7 +401,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
|
||||
The "prepare" signal is emitted when a new page is set as the
|
||||
assistant's current page, but before making the new page visible.
|
||||
|
||||
:param page: the new page to prepare for display.
|
||||
:param page: the new page to prepare for display.
|
||||
|
||||
"""
|
||||
#determine if we go backward or forward
|
||||
|
@ -1,173 +0,0 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2007 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
|
||||
#
|
||||
|
||||
"""
|
||||
Base history navigation class. Builds the action group and ui for the
|
||||
uimanager. Changes to the associated history objects are tracked. When
|
||||
the history changes, the UI XML string and the action groups are updated.
|
||||
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#-------------------------------------------------------------------
|
||||
import gtk
|
||||
from BasicUtils import name_displayer
|
||||
|
||||
DISABLED = -1
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
#
|
||||
# UI Manager XML code
|
||||
#
|
||||
#-------------------------------------------------------------------
|
||||
_top = [
|
||||
'<ui>'
|
||||
'<menubar name="MenuBar">'
|
||||
'<menu action="GoMenu">'
|
||||
'<placeholder name="CommonHistory">'
|
||||
]
|
||||
|
||||
_btm = [
|
||||
'</placeholder>'
|
||||
'</menu>'
|
||||
'</menubar>'
|
||||
'</ui>'
|
||||
]
|
||||
|
||||
|
||||
class BaseNavigation(object):
|
||||
"""
|
||||
Base history navigation class. Builds the action group and ui for the
|
||||
uimanager. Changes to the associated history objects are tracked. When
|
||||
the history changes, the UI XML string and the action groups are updated.
|
||||
|
||||
Import variables:
|
||||
|
||||
self.title - name used for Action group name and Actions
|
||||
self.ui - XML string used to build menu items for UIManager
|
||||
self.action_group - associate action group for selecting items
|
||||
self.active - merge ID for the action group. DISABLED if not active
|
||||
self.items - history handles associated with the menu
|
||||
self.func - array of functions to take action based off of.
|
||||
|
||||
"""
|
||||
def __init__(self, dbstate, uistate, history, title):
|
||||
self.title = title
|
||||
self.ui = "".join(_top) + "".join(_btm)
|
||||
self.dbstate = dbstate
|
||||
self.uistate = uistate
|
||||
self.action_group = gtk.ActionGroup(self.title)
|
||||
self.active = DISABLED
|
||||
self.items = []
|
||||
self.func = []
|
||||
self.history = history
|
||||
|
||||
def clear(self):
|
||||
"""
|
||||
Clears out the specified history
|
||||
"""
|
||||
self.history.clear()
|
||||
|
||||
def disable(self):
|
||||
"""
|
||||
Remove the UI and action groups if the navigation is enabled
|
||||
"""
|
||||
if self.active != DISABLED:
|
||||
self.uistate.uimanager.remove_ui(self.active)
|
||||
self.uistate.uimanager.remove_action_group(self.action_group)
|
||||
self.active = DISABLED
|
||||
|
||||
def enable(self):
|
||||
"""
|
||||
Enables the UI and action groups
|
||||
"""
|
||||
if self.active == DISABLED:
|
||||
self.uistate.uimanager.insert_action_group(self.action_group, 1)
|
||||
self.active = self.uistate.uimanager.add_ui_from_string(self.ui)
|
||||
self.uistate.uimanager.ensure_update()
|
||||
|
||||
def build_item_name(self, handle):
|
||||
"""
|
||||
Builds a string from the passed handle. Must be overridden by the
|
||||
derived class.
|
||||
"""
|
||||
return "ERROR"
|
||||
|
||||
def update_menu(self, items):
|
||||
"""
|
||||
Builds the UI and action group.
|
||||
"""
|
||||
self.items = items
|
||||
self.disable()
|
||||
menu_len = min(len(items), 10)
|
||||
entry = '<menuitem action="%s%02d"/>'
|
||||
|
||||
data = [ entry % (self.title, index) for index in range(0, menu_len) ]
|
||||
self.ui = "".join(_top) + "".join(data) + "".join(_btm)
|
||||
self.action_group = gtk.ActionGroup(self.title)
|
||||
data = []
|
||||
index = 0
|
||||
|
||||
mitems = items[:]
|
||||
mitems.reverse()
|
||||
for item in mitems[:10]:
|
||||
name = self.build_item_name(item)
|
||||
func = self.func[index]
|
||||
data.append(('%s%02d'%(self.title, index), None, name,
|
||||
"<alt>%d" % index, None, func))
|
||||
index += 1
|
||||
|
||||
self.action_group.add_actions(data)
|
||||
self.enable()
|
||||
|
||||
|
||||
class PersonNavigation(BaseNavigation):
|
||||
"""
|
||||
Builds a navigation item for the Person class.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate):
|
||||
"""
|
||||
Associates the functions with the associated items. Builds the function
|
||||
array so that there are unique functions for each possible index (0-9)
|
||||
The callback simply calls change_active_handle
|
||||
"""
|
||||
BaseNavigation.__init__(self, dbstate, uistate,
|
||||
uistate.phistory, 'PersonHistory')
|
||||
fcn_ptr = self.dbstate.change_active_handle
|
||||
|
||||
self.func = [ generate(fcn_ptr, self.items, index) \
|
||||
for index in range(0, 10) ]
|
||||
|
||||
def build_item_name(self, item):
|
||||
"""
|
||||
Builds a name in the format of 'NAME [GRAMPSID]'
|
||||
"""
|
||||
person = self.dbstate.db.get_person_from_handle(item)
|
||||
return "%s [%s]" % (name_displayer.display(person),
|
||||
person.gramps_id)
|
||||
|
||||
def generate(func, items, index):
|
||||
"""
|
||||
Generates a callback function based off the passed arguments
|
||||
"""
|
||||
return lambda x: func(items[index])
|
@ -433,7 +433,8 @@ class GuiPersonOption(gtk.HBox):
|
||||
self.pack_start(pevt, False)
|
||||
self.pack_end(person_button, False)
|
||||
|
||||
person = self.__dbstate.get_active_person()
|
||||
person_handle = self.__uistate.get_active('Person')
|
||||
person = self.__dbstate.db.get_person_from_handle(person_handle)
|
||||
if not person:
|
||||
person = self.__db.get_default_person()
|
||||
self.__update_person(person)
|
||||
@ -461,7 +462,8 @@ class GuiPersonOption(gtk.HBox):
|
||||
rfilter.add_rule(Rules.Person.HasIdOf([gid]))
|
||||
|
||||
# Add the selected person if one exists.
|
||||
active_person = self.__dbstate.get_active_person()
|
||||
person_handle = self.__uistate.get_active('Person')
|
||||
active_person = self.__dbstate.db.get_person_from_handle(person_handle)
|
||||
if active_person:
|
||||
gid = active_person.get_gramps_id()
|
||||
rfilter.add_rule(Rules.Person.HasIdOf([gid]))
|
||||
@ -540,7 +542,8 @@ class GuiFamilyOption(gtk.HBox):
|
||||
family_list = []
|
||||
|
||||
# First try the family of the active person
|
||||
person = self.__dbstate.get_active_person()
|
||||
person_handle = self.__uistate.get_active('Person')
|
||||
person = self.__dbstate.db.get_person_from_handle(person_handle)
|
||||
if person:
|
||||
family_list = person.get_family_handle_list()
|
||||
|
||||
|
@ -74,7 +74,7 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
reports. This is used to build the selection tree on the left
|
||||
hand side of the dialog box.
|
||||
"""
|
||||
self.active = state.active
|
||||
self.active = uistate.get_active('Person')
|
||||
self.imap = {}
|
||||
self.msg = msg
|
||||
self.content = content
|
||||
@ -238,7 +238,9 @@ class PluginDialog(ManagedWindow.ManagedWindow):
|
||||
return
|
||||
|
||||
if pdata.ptype == REPORT:
|
||||
report(self.state, self.uistate, self.state.active,
|
||||
active_handle = self.uistate.get_active('Person')
|
||||
report(self.state, self.uistate,
|
||||
self.state.db.get_person_from_handle(active_handle),
|
||||
eval('mod.' + pdata.reportclass),
|
||||
eval('mod.' + pdata.optionclass),
|
||||
pdata.name, pdata.id,
|
||||
|
@ -482,7 +482,7 @@ class ToolManagedWindowBase(ManagedWindow.ManagedWindow):
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
else:
|
||||
self.dbstate.change_active_person(person)
|
||||
self.uistate.set_active(person_handle, 'Person')
|
||||
return True # handled event
|
||||
return False # did not handle event
|
||||
|
||||
|
@ -76,7 +76,6 @@ class Tool(object):
|
||||
def __init__(self, dbstate, options_class, name):
|
||||
from PluginUtils import MenuToolOptions
|
||||
self.db = dbstate.db
|
||||
self.person = dbstate.active
|
||||
try:
|
||||
if issubclass(options_class, MenuToolOptions):
|
||||
# FIXME: pass in person_id
|
||||
@ -125,9 +124,9 @@ class ActivePersonTool(Tool):
|
||||
for tools that depend on active person.
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, options_class, name):
|
||||
def __init__(self, dbstate, uistate, options_class, name):
|
||||
|
||||
if not dbstate.get_active_person():
|
||||
if not uistate.get_active('Person'):
|
||||
from QuestionDialog import ErrorDialog
|
||||
|
||||
ErrorDialog(_('Active person has not been set'),
|
||||
|
@ -202,9 +202,9 @@ class SimpleTable(object):
|
||||
import gobject
|
||||
# If you emmit the signal here and it causes this table to be deleted,
|
||||
# then you'll crash Python:
|
||||
#self.simpledoc.doc.dbstate.set_active_person(handle)
|
||||
#self.simpledoc.doc.uistate.set_active(handle, 'Person')
|
||||
# So, let's return from this, then change the active person:
|
||||
return gobject.timeout_add(100, self.simpledoc.doc.dbstate.set_active_person, handle)
|
||||
return gobject.timeout_add(100, self.simpledoc.doc.uistate.set_active, handle, 'Person')
|
||||
return True
|
||||
return False # didn't handle event
|
||||
|
||||
|
55
src/Utils.py
55
src/Utils.py
@ -1136,3 +1136,58 @@ def find_witnessed_people(db,p):
|
||||
if pref.ref != p.get_handle and pref.ref not in people:
|
||||
people.append(pref.ref)
|
||||
return people
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Function to return a label to display the active object in the status bar
|
||||
# and to describe bookmarked objects.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def navigation_label(db, nav_type, handle):
|
||||
|
||||
label = None
|
||||
if nav_type == 'Person':
|
||||
obj = db.get_person_from_handle(handle)
|
||||
if obj:
|
||||
label = name_displayer.display(obj)
|
||||
elif nav_type == 'Family':
|
||||
obj = db.get_family_from_handle(handle)
|
||||
if obj:
|
||||
label = family_name(obj, db)
|
||||
elif nav_type == 'Event':
|
||||
obj = db.get_event_from_handle(handle)
|
||||
if obj:
|
||||
type = obj.get_type()
|
||||
who = get_participant_from_event(db, handle)
|
||||
desc = obj.get_description()
|
||||
label = '%s - %s' % (type, who)
|
||||
if desc:
|
||||
label = '%s - %s' % (label, desc)
|
||||
elif nav_type == 'Place':
|
||||
obj = db.get_place_from_handle(handle)
|
||||
if obj:
|
||||
label = obj.get_title()
|
||||
elif nav_type == 'Source':
|
||||
obj = db.get_source_from_handle(handle)
|
||||
if obj:
|
||||
label = obj.get_title()
|
||||
elif nav_type == 'Repository':
|
||||
obj = db.get_repository_from_handle(handle)
|
||||
if obj:
|
||||
label = obj.get_name()
|
||||
elif nav_type == 'Media':
|
||||
obj = db.get_object_from_handle(handle)
|
||||
if obj:
|
||||
label = obj.get_description()
|
||||
elif nav_type == 'Note':
|
||||
obj = db.get_note_from_handle(handle)
|
||||
if obj:
|
||||
label = obj.get()
|
||||
label = " ".join(label.split())
|
||||
if len(label) > 40:
|
||||
label = label[:40] + "..."
|
||||
|
||||
if label:
|
||||
label = '[%s] %s' % (obj.get_gramps_id(), label)
|
||||
|
||||
return label
|
||||
|
@ -274,8 +274,8 @@ class CLIManager(object):
|
||||
config.set('paths.recent-file', filename)
|
||||
|
||||
try:
|
||||
self.dbstate.change_active_person(
|
||||
self.dbstate.db.find_initial_person())
|
||||
initial_person = self.dbstate.db.find_initial_person().get_handle()
|
||||
self.uistate.set_active(initial_person, 'Person')
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -27,7 +27,7 @@ class Gramplet(object):
|
||||
"""
|
||||
Base class for non-graphical gramplet code.
|
||||
"""
|
||||
def __init__(self, gui):
|
||||
def __init__(self, gui, nav_group=0):
|
||||
"""
|
||||
Internal constructor for non-graphical gramplets.
|
||||
"""
|
||||
@ -41,22 +41,34 @@ class Gramplet(object):
|
||||
# links to each other:
|
||||
self.gui = gui # plugin gramplet has link to gui
|
||||
gui.pui = self # gui has link to plugin ui
|
||||
self.nav_group = nav_group
|
||||
self.dbstate = gui.dbstate
|
||||
self.uistate = gui.uistate
|
||||
self.init()
|
||||
self.on_load()
|
||||
self.build_options()
|
||||
self.connect(self.dbstate, "database-changed", self._db_changed)
|
||||
self.connect(self.dbstate, "active-changed", self._active_changed)
|
||||
self.connect(self.gui.textview, "button-press-event",
|
||||
self.gui.on_button_press)
|
||||
self.connect(self.gui.textview, "motion-notify-event",
|
||||
self.gui.on_motion)
|
||||
if self.dbstate.active: # already changed
|
||||
self.connect_signal('Person', self._active_changed)
|
||||
|
||||
active_person = self.get_active('Person')
|
||||
if active_person: # already changed
|
||||
self._db_changed(self.dbstate.db)
|
||||
self._active_changed(self.dbstate.active.handle)
|
||||
self._active_changed(active_person)
|
||||
self.post_init()
|
||||
|
||||
def connect_signal(self, nav_type, method):
|
||||
"""
|
||||
Connect the given method to the active-changed signal for the
|
||||
navigation type requested.
|
||||
"""
|
||||
self.uistate.register(nav_type, self.nav_group)
|
||||
history = self.uistate.get_history(nav_type, self.nav_group)
|
||||
self.connect(history, "active-changed", method)
|
||||
|
||||
def init(self): # once, constructor
|
||||
"""
|
||||
External constructor for developers to put their initialization
|
||||
@ -95,6 +107,18 @@ class Gramplet(object):
|
||||
"""
|
||||
return
|
||||
|
||||
def get_active(self, nav_type):
|
||||
"""
|
||||
Return the handle of the active object for the given navigation type.
|
||||
"""
|
||||
return self.uistate.get_active(nav_type, self.nav_group)
|
||||
|
||||
def set_active(self, nav_type, handle):
|
||||
"""
|
||||
Change the handle of the active object for the given navigation type.
|
||||
"""
|
||||
self.uistate.set_active(handle, nav_type, self.nav_group)
|
||||
|
||||
def active_changed(self, handle):
|
||||
"""
|
||||
Developers should put their code that occurs when the active
|
||||
|
@ -580,7 +580,7 @@ class EditPerson(EditPrimary):
|
||||
self.home_action.set_sensitive(True)
|
||||
|
||||
def _make_active(self, obj):
|
||||
self.dbstate.change_active_person(self.obj)
|
||||
self.uistate.set_active(self.obj.get_handle(), 'Person')
|
||||
|
||||
def _make_home_person(self, obj):
|
||||
handle = self.obj.get_handle()
|
||||
|
@ -71,8 +71,6 @@ import GrampsCfg
|
||||
import Errors
|
||||
from QuestionDialog import (ErrorDialog, WarningDialog, QuestionDialog2,
|
||||
InfoDialog)
|
||||
import gui.views.navigationview as NavigationView
|
||||
import Navigation
|
||||
from BasicUtils import name_displayer
|
||||
from gui import widgets
|
||||
import UndoHistory
|
||||
@ -341,10 +339,7 @@ class ViewManager(CLIManager):
|
||||
openbtn = self.__build_open_button()
|
||||
self.uistate.set_open_widget(openbtn)
|
||||
self.toolbar.insert(openbtn, 0)
|
||||
|
||||
self.person_nav = Navigation.PersonNavigation(self.dbstate, self.uistate)
|
||||
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()
|
||||
@ -531,18 +526,6 @@ class ViewManager(CLIManager):
|
||||
_('Undo History...'), "<control>H", None, self.undo_history),
|
||||
]
|
||||
|
||||
self._navigation_type = {
|
||||
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):
|
||||
"""
|
||||
Callback that is called on a keypress. It works by extracting the
|
||||
@ -576,8 +559,8 @@ class ViewManager(CLIManager):
|
||||
def __prev_view(self, action):
|
||||
"""
|
||||
Callback that is called when the previous view action is selected.
|
||||
It selects the previous view as the active view. If we reach the beginning
|
||||
of the list of views, we wrap around to the last view.
|
||||
It selects the previous view as the active view. If we reach the
|
||||
beginning of the list of views, we wrap around to the last view.
|
||||
"""
|
||||
current_page = self.notebook.get_current_page()
|
||||
if current_page == 0:
|
||||
@ -883,7 +866,6 @@ class ViewManager(CLIManager):
|
||||
Create the Views
|
||||
"""
|
||||
self.pages = []
|
||||
self.prev_nav = None
|
||||
self.ui_category = {}
|
||||
self.view_toggle_actions = {}
|
||||
self.cat_view_group = None
|
||||
@ -908,6 +890,7 @@ class ViewManager(CLIManager):
|
||||
page_category = page.get_category()
|
||||
page_translated_category = page.get_translated_category()
|
||||
page_stock = page.get_stock()
|
||||
|
||||
if nrpage == 0:
|
||||
#the first page of this category, used to obtain
|
||||
#category workspace notebook
|
||||
@ -1123,19 +1106,6 @@ class ViewManager(CLIManager):
|
||||
category_page])
|
||||
self.merge_ids.append(mergeid)
|
||||
|
||||
def __setup_navigation(self):
|
||||
"""
|
||||
Initialize the navigation scheme
|
||||
"""
|
||||
old_nav = self._navigation_type[self.prev_nav]
|
||||
if old_nav[0] is not None:
|
||||
old_nav[0].disable()
|
||||
|
||||
page_type = self.active_page.navigation_type()
|
||||
nav_type = self._navigation_type[page_type]
|
||||
if nav_type[0] is not None:
|
||||
nav_type[0].enable()
|
||||
|
||||
def change_category(self, obj, page, num=-1):
|
||||
"""
|
||||
Wrapper for the __do_change_category, to prevent entering into the
|
||||
@ -1184,7 +1154,6 @@ class ViewManager(CLIManager):
|
||||
self.views[category_page][view_page][0].id)
|
||||
config.save()
|
||||
|
||||
self.__setup_navigation()
|
||||
self.__connect_active_page(category_page, view_page)
|
||||
|
||||
self.uimanager.ensure_update()
|
||||
@ -1226,12 +1195,6 @@ class ViewManager(CLIManager):
|
||||
This method is for the common UI post_load, both new files
|
||||
and added data like imports.
|
||||
"""
|
||||
if self.dbstate.active :
|
||||
# clear history and fill history with first entry, active person
|
||||
self.uistate.clear_history(self.dbstate.active.handle)
|
||||
else :
|
||||
self.uistate.clear_history(None)
|
||||
|
||||
self.dbstate.db.undo_callback = self.__change_undo_label
|
||||
self.dbstate.db.redo_callback = self.__change_redo_label
|
||||
self.__change_undo_label(None)
|
||||
@ -1270,8 +1233,6 @@ class ViewManager(CLIManager):
|
||||
self.uistate.window.set_title(msg)
|
||||
self.actiongroup.set_sensitive(True)
|
||||
|
||||
self.setup_bookmarks()
|
||||
|
||||
self.change_category(None, None)
|
||||
self.actiongroup.set_visible(True)
|
||||
self.readonlygroup.set_visible(True)
|
||||
@ -1339,36 +1300,6 @@ class ViewManager(CLIManager):
|
||||
# Let it go: history window does not exist
|
||||
return
|
||||
|
||||
def setup_bookmarks(self):
|
||||
"""
|
||||
Initialize the bookmarks based of the database. This needs to
|
||||
be called anytime the database changes.
|
||||
"""
|
||||
import Bookmarks
|
||||
self.bookmarks = Bookmarks.Bookmarks(
|
||||
self.dbstate, self.uistate, self.dbstate.db.get_bookmarks())
|
||||
|
||||
def add_bookmark(self, obj):
|
||||
"""
|
||||
Add a bookmark to the bookmark list
|
||||
"""
|
||||
if self.dbstate.active:
|
||||
self.bookmarks.add(self.dbstate.active.get_handle())
|
||||
name = name_displayer.display(self.dbstate.active)
|
||||
self.uistate.push_message(self.dbstate,
|
||||
_("%s has been bookmarked") % name)
|
||||
else:
|
||||
WarningDialog(
|
||||
_("Could Not Set a Bookmark"),
|
||||
_("A bookmark could not be set because "
|
||||
"no one was selected."))
|
||||
|
||||
def edit_bookmarks(self, obj):
|
||||
"""
|
||||
Displays the Bookmark editor
|
||||
"""
|
||||
self.bookmarks.edit()
|
||||
|
||||
def reports_clicked(self, obj):
|
||||
"""
|
||||
Displays the Reports dialog
|
||||
@ -1615,7 +1546,7 @@ def run_plugin(pdata, dbstate, uistate):
|
||||
return
|
||||
|
||||
if pdata.ptype == REPORT:
|
||||
ReportBase.report(dbstate, uistate, dbstate.active,
|
||||
ReportBase.report(dbstate, uistate, uistate.get_active('Person'),
|
||||
getattr(mod, pdata.reportclass),
|
||||
getattr(mod, pdata.optionclass),
|
||||
pdata.name, pdata.id,
|
||||
|
@ -87,11 +87,11 @@ class ListView(NavigationView):
|
||||
QR_CATEGORY = -1
|
||||
|
||||
def __init__(self, title, dbstate, uistate, columns, handle_col,
|
||||
make_model, signal_map, get_bookmarks, bm_type,
|
||||
make_model, signal_map, get_bookmarks, bm_type, nav_group,
|
||||
multiple=False, filter_class=None, markup=False):
|
||||
|
||||
NavigationView.__init__(self, title, dbstate, uistate,
|
||||
get_bookmarks, bm_type)
|
||||
get_bookmarks, bm_type, nav_group)
|
||||
#default is listviews keep themself in sync with database
|
||||
self._dirty_on_change_inactive = False
|
||||
|
||||
@ -756,7 +756,7 @@ class ListView(NavigationView):
|
||||
self.uistate.uimanager.\
|
||||
get_widget('/Popup/QuickReport').remove_submenu()
|
||||
reportactions = []
|
||||
if menu and self.dbstate.active:
|
||||
if menu and self.get_active():
|
||||
(ui, reportactions) = create_quickreport_menu(
|
||||
self.QR_CATEGORY,
|
||||
self.dbstate,
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2001-2007 Donald N. Allingham
|
||||
# Copyright (C) 2009 Nick Hall
|
||||
# Copyright (C) 2009-2010 Nick Hall
|
||||
#
|
||||
# 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
|
||||
@ -47,19 +47,8 @@ import gtk
|
||||
#
|
||||
#----------------------------------------------------------------
|
||||
from gui.views.pageview import PageView
|
||||
|
||||
from TransUtils import sgettext as _
|
||||
|
||||
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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# NavigationView
|
||||
@ -72,7 +61,7 @@ class NavigationView(PageView):
|
||||
should derive from this class.
|
||||
"""
|
||||
|
||||
def __init__(self, title, state, uistate, bookmarks, bm_type):
|
||||
def __init__(self, title, state, uistate, bookmarks, bm_type, nav_group):
|
||||
PageView.__init__(self, title, state, uistate)
|
||||
self.bookmarks = bm_type(self.dbstate, self.uistate, bookmarks,
|
||||
self.goto_handle)
|
||||
@ -81,7 +70,10 @@ class NavigationView(PageView):
|
||||
self.back_action = None
|
||||
self.book_action = None
|
||||
self.other_action = None
|
||||
self.key_active_changed = None
|
||||
self.active_signal = None
|
||||
self.nav_group = nav_group
|
||||
|
||||
self.uistate.register(self.navigation_type(), self.nav_group)
|
||||
|
||||
def define_actions(self):
|
||||
"""
|
||||
@ -111,7 +103,7 @@ class NavigationView(PageView):
|
||||
|
||||
self.fwd_action.set_visible(True)
|
||||
self.back_action.set_visible(True)
|
||||
hobj = self.uistate.phistory
|
||||
hobj = self.get_history()
|
||||
self.fwd_action.set_sensitive(not hobj.at_end())
|
||||
self.back_action.set_sensitive(not hobj.at_front())
|
||||
|
||||
@ -119,19 +111,22 @@ class NavigationView(PageView):
|
||||
"""
|
||||
Called when the page changes.
|
||||
"""
|
||||
hobj = self.uistate.phistory
|
||||
hobj = self.get_history()
|
||||
self.fwd_action.set_sensitive(not hobj.at_end())
|
||||
self.back_action.set_sensitive(not hobj.at_front())
|
||||
self.other_action.set_sensitive(not self.dbstate.db.readonly)
|
||||
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
|
||||
def set_active(self):
|
||||
"""
|
||||
Called when the page becomes active (displayed).
|
||||
"""
|
||||
PageView.set_active(self)
|
||||
self.bookmarks.display()
|
||||
self.key_active_changed = self.dbstate.connect('active-changed',
|
||||
self.goto_active)
|
||||
|
||||
hobj = self.get_history()
|
||||
self.active_signal = hobj.connect('active-changed', self.goto_active)
|
||||
|
||||
self.goto_active(None)
|
||||
|
||||
def set_inactive(self):
|
||||
@ -141,26 +136,51 @@ class NavigationView(PageView):
|
||||
if self.active:
|
||||
PageView.set_inactive(self)
|
||||
self.bookmarks.undisplay()
|
||||
self.dbstate.disconnect(self.key_active_changed)
|
||||
hobj = self.get_history()
|
||||
hobj.disconnect(self.active_signal)
|
||||
|
||||
def navigation_group(self):
|
||||
"""
|
||||
Return the navigation group.
|
||||
"""
|
||||
return self.nav_group
|
||||
|
||||
def get_history(self):
|
||||
"""
|
||||
Return the history object.
|
||||
"""
|
||||
return self.uistate.get_history(self.navigation_type(),
|
||||
self.navigation_group())
|
||||
|
||||
def goto_active(self, active_handle):
|
||||
"""
|
||||
Callback (and usable function) that selects the active person
|
||||
in the display tree.
|
||||
"""
|
||||
if self.dbstate.active:
|
||||
self.handle_history(self.dbstate.active.handle)
|
||||
active_handle = self.uistate.get_active(self.navigation_type(),
|
||||
self.navigation_group())
|
||||
if active_handle:
|
||||
self.goto_handle(active_handle)
|
||||
|
||||
hobj = self.get_history()
|
||||
self.fwd_action.set_sensitive(not hobj.at_end())
|
||||
self.back_action.set_sensitive(not hobj.at_front())
|
||||
|
||||
# active object for each navigation type
|
||||
if self.navigation_type() == NAVIGATION_PERSON:
|
||||
if self.dbstate.active:
|
||||
self.goto_handle(self.dbstate.active.handle)
|
||||
|
||||
def get_active(self):
|
||||
"""
|
||||
Return the handle of the active object.
|
||||
"""
|
||||
hobj = self.uistate.get_history(self.navigation_type(),
|
||||
self.navigation_group())
|
||||
return hobj.present()
|
||||
|
||||
def change_active(self, handle):
|
||||
"""
|
||||
Changes the active object.
|
||||
"""
|
||||
self.dbstate.set_active(self.navigation_type(), handle)
|
||||
hobj = self.get_history()
|
||||
if handle and not hobj.lock and not (handle == hobj.present()):
|
||||
hobj.push(handle)
|
||||
|
||||
def goto_handle(self, handle):
|
||||
"""
|
||||
@ -177,10 +197,12 @@ class NavigationView(PageView):
|
||||
Add a bookmark to the list.
|
||||
"""
|
||||
from BasicUtils import name_displayer
|
||||
|
||||
if self.dbstate.active:
|
||||
self.bookmarks.add(self.dbstate.active.get_handle())
|
||||
name = name_displayer.display(self.dbstate.active)
|
||||
|
||||
active_handle = self.uistate.get_active('Person')
|
||||
active_person = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
if active_person:
|
||||
self.bookmarks.add(active_handle)
|
||||
name = name_displayer.display(active_person)
|
||||
self.uistate.push_message(self.dbstate,
|
||||
_("%s has been bookmarked") % name)
|
||||
else:
|
||||
@ -253,9 +275,9 @@ class NavigationView(PageView):
|
||||
"""
|
||||
Set the default person.
|
||||
"""
|
||||
active = self.dbstate.active
|
||||
active = self.uistate.get_active('Person')
|
||||
if active:
|
||||
self.dbstate.db.set_default_person_handle(active.get_handle())
|
||||
self.dbstate.db.set_default_person_handle(active)
|
||||
|
||||
def home(self, obj):
|
||||
"""
|
||||
@ -263,7 +285,7 @@ class NavigationView(PageView):
|
||||
"""
|
||||
defperson = self.dbstate.db.get_default_person()
|
||||
if defperson:
|
||||
self.dbstate.change_active_person(defperson)
|
||||
self.change_active(defperson.get_handle())
|
||||
|
||||
def jump(self):
|
||||
"""
|
||||
@ -293,9 +315,7 @@ class NavigationView(PageView):
|
||||
gid = text.get_text()
|
||||
handle = self.get_handle_from_gramps_id(gid)
|
||||
if handle is not None:
|
||||
if self.navigation_type() == NAVIGATION_PERSON:
|
||||
self.change_active(handle)
|
||||
|
||||
self.change_active(handle)
|
||||
self.goto_handle(handle)
|
||||
else:
|
||||
self.uistate.push_message(
|
||||
@ -314,12 +334,11 @@ class NavigationView(PageView):
|
||||
"""
|
||||
Move forward one object in the history.
|
||||
"""
|
||||
hobj = self.uistate.phistory
|
||||
hobj = self.get_history()
|
||||
hobj.lock = True
|
||||
if not hobj.at_end():
|
||||
try:
|
||||
handle = hobj.forward()
|
||||
self.dbstate.change_active_handle(handle)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
hobj.mhistory.append(hobj.history[hobj.index])
|
||||
self.fwd_action.set_sensitive(not hobj.at_end())
|
||||
@ -337,14 +356,12 @@ class NavigationView(PageView):
|
||||
"""
|
||||
Move backward one object in the history.
|
||||
"""
|
||||
hobj = self.uistate.phistory
|
||||
hobj = self.get_history()
|
||||
hobj.lock = True
|
||||
if not hobj.at_front():
|
||||
try:
|
||||
handle = hobj.back()
|
||||
self.active = self.dbstate.db.get_person_from_handle(handle)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
self.dbstate.change_active_handle(handle)
|
||||
hobj.mhistory.append(hobj.history[hobj.index])
|
||||
self.back_action.set_sensitive(not hobj.at_front())
|
||||
self.fwd_action.set_sensitive(True)
|
||||
@ -357,18 +374,6 @@ class NavigationView(PageView):
|
||||
self.fwd_action.set_sensitive(True)
|
||||
hobj.lock = False
|
||||
|
||||
def handle_history(self, handle):
|
||||
"""
|
||||
Updates the person history information
|
||||
It will push the person at the end of the history if that person is
|
||||
not present person
|
||||
"""
|
||||
hobj = self.uistate.phistory
|
||||
if handle and not hobj.lock and not (handle == hobj.present()):
|
||||
hobj.push(handle)
|
||||
self.fwd_action.set_sensitive(not hobj.at_end())
|
||||
self.back_action.set_sensitive(not hobj.at_front())
|
||||
|
||||
####################################################################
|
||||
# Template functions
|
||||
####################################################################
|
||||
|
@ -44,7 +44,6 @@ 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
|
||||
@ -93,7 +92,7 @@ class PlaceBaseView(ListView):
|
||||
FILTER_TYPE = "Place"
|
||||
QR_CATEGORY = CATEGORY_QR_PLACE
|
||||
|
||||
def __init__(self, dbstate, uistate, title, model):
|
||||
def __init__(self, dbstate, uistate, title, model, nav_group):
|
||||
|
||||
signal_map = {
|
||||
'place-add' : self.row_add,
|
||||
@ -115,7 +114,7 @@ class PlaceBaseView(ListView):
|
||||
len(PlaceBaseView.COLUMN_NAMES),
|
||||
model, signal_map,
|
||||
dbstate.db.get_place_bookmarks(),
|
||||
Bookmarks.PlaceBookmarks,
|
||||
Bookmarks.PlaceBookmarks, nav_group,
|
||||
multiple=True,
|
||||
filter_class=PlaceSidebarFilter)
|
||||
|
||||
@ -123,7 +122,7 @@ class PlaceBaseView(ListView):
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_PLACE
|
||||
return 'Place'
|
||||
|
||||
def column_ord_setfunc(self, clist):
|
||||
self.dbstate.db.set_place_column_order(clist)
|
||||
@ -298,6 +297,12 @@ class PlaceBaseView(ListView):
|
||||
<menuitem action="EditBook"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="EditMenu">
|
||||
<placeholder name="CommonEdit">
|
||||
<menuitem action="Add"/>
|
||||
@ -312,6 +317,10 @@ class PlaceBaseView(ListView):
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
</placeholder>
|
||||
<placeholder name="CommonEdit">
|
||||
<toolitem action="Add"/>
|
||||
<toolitem action="Edit"/>
|
||||
@ -321,6 +330,9 @@ class PlaceBaseView(ListView):
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="Add"/>
|
||||
<menuitem action="Edit"/>
|
||||
<menuitem action="Remove"/>
|
||||
|
@ -97,7 +97,7 @@ _UNSUPPORTED = _("Unsupported")
|
||||
# Private Functions
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def _initialize_options(options, dbstate):
|
||||
def _initialize_options(options, dbstate, uistate):
|
||||
"""
|
||||
Validates all options by making sure that their values are consistent with
|
||||
the database.
|
||||
@ -116,12 +116,14 @@ def _initialize_options(options, dbstate):
|
||||
|
||||
if isinstance(option, PersonOption):
|
||||
if not dbase.get_person_from_gramps_id(value):
|
||||
person = dbstate.get_active_person()
|
||||
person_handle = uistate.get_active('Person')
|
||||
person = dbase.get_person_from_handle(person_handle)
|
||||
option.set_value(person.get_gramps_id())
|
||||
|
||||
elif isinstance(option, FamilyOption):
|
||||
if not dbase.get_family_from_gramps_id(value):
|
||||
person = dbstate.get_active_person()
|
||||
person_handle = uistate.get_active('Person')
|
||||
person = dbase.get_person_from_handle(person_handle)
|
||||
family_list = person.get_family_handle_list()
|
||||
if family_list:
|
||||
family_handle = family_list[0]
|
||||
@ -825,7 +827,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
return
|
||||
data = self.avail_model.get_data(the_iter, range(self.avail_nr_cols))
|
||||
item = BookItem(self.db, data[2])
|
||||
_initialize_options(item.option_class, self.dbstate)
|
||||
_initialize_options(item.option_class, self.dbstate, self.uistate)
|
||||
data[2] = _get_subject(item.option_class, self.db)
|
||||
self.book_model.add(data)
|
||||
self.book.append_item(item)
|
||||
|
@ -41,7 +41,8 @@ class AttributesGramplet(Gramplet):
|
||||
|
||||
def main(self): # return false finishes
|
||||
self.set_text("")
|
||||
active_person = self.dbstate.get_active_person()
|
||||
active_handle = self.get_active('Person')
|
||||
active_person = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
if not active_person:
|
||||
return
|
||||
name = name_displayer.display(active_person)
|
||||
|
@ -57,11 +57,12 @@ class DescendantGramplet(Gramplet):
|
||||
self.update()
|
||||
|
||||
def main(self):
|
||||
if self.dbstate.get_active_person() is None:
|
||||
active_handle = self.get_active('Person')
|
||||
if not active_handle:
|
||||
self.set_text(_("No Active Person selected."))
|
||||
return
|
||||
self.set_text("")
|
||||
self.center_person = self.dbstate.get_active_person()
|
||||
self.center_person = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
name = name_displayer.display(self.center_person)
|
||||
title = _("Descendants of %s") % name
|
||||
self.append_text(title)
|
||||
|
@ -613,7 +613,8 @@ class FanChartGramplet(Gramplet):
|
||||
data.
|
||||
"""
|
||||
self.gui.fan.reset_generations()
|
||||
person = self.dbstate.get_active_person()
|
||||
active_handle = self.get_active('Person')
|
||||
person = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
if not person:
|
||||
name = None
|
||||
else:
|
||||
@ -657,10 +658,10 @@ class FanChartGramplet(Gramplet):
|
||||
parent += 1
|
||||
self.gui.fan.queue_draw()
|
||||
|
||||
def on_childmenu_changed(self, obj,person_handle):
|
||||
def on_childmenu_changed(self, obj, person_handle):
|
||||
"""Callback for the pulldown menu selection, changing to the person
|
||||
attached with menu item."""
|
||||
self.dbstate.change_active_handle(person_handle)
|
||||
self.set_active('Person', person_handle)
|
||||
return True
|
||||
|
||||
def edit_person_cb(self, obj,person_handle):
|
||||
|
@ -229,7 +229,8 @@ class PedigreeGramplet(Gramplet):
|
||||
self._boxes = [0] * (self.max_generations + 1)
|
||||
self._generations = {}
|
||||
self.gui.buffer.set_text("")
|
||||
active_person = self.dbstate.get_active_person()
|
||||
active_handle = self.get_active('Person')
|
||||
active_person = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
if not active_person:
|
||||
return False
|
||||
#no wrap in Gramplet
|
||||
|
@ -53,12 +53,12 @@ class QuickViewGramplet(Gramplet):
|
||||
qv_option = self.get_option(_("Quick Views"))
|
||||
quick_view = qv_option.get_value()
|
||||
if quick_type == CATEGORY_QR_PERSON:
|
||||
active = self.dbstate.get_active_person()
|
||||
if active:
|
||||
active_handle = self.get_active('Person')
|
||||
if active_handle:
|
||||
run_quick_report_by_name(self.gui.dbstate,
|
||||
self.gui.uistate,
|
||||
quick_view,
|
||||
active.handle,
|
||||
active_handle,
|
||||
container=self.gui.textview)
|
||||
else:
|
||||
active_list = []
|
||||
|
@ -63,7 +63,8 @@ class RelativesGramplet(Gramplet):
|
||||
"""
|
||||
self.set_text("")
|
||||
database = self.dbstate.db
|
||||
active_person = self.dbstate.get_active_person()
|
||||
active_handle = self.get_active('Person')
|
||||
active_person = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
if not active_person:
|
||||
return
|
||||
name = name_displayer.display(active_person)
|
||||
|
@ -56,12 +56,14 @@ class DesBrowse(Tool.ActivePersonTool, ManagedWindow.ManagedWindow):
|
||||
|
||||
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
||||
|
||||
Tool.ActivePersonTool.__init__(self, dbstate, options_class, name)
|
||||
Tool.ActivePersonTool.__init__(self, dbstate, uistate, options_class,
|
||||
name)
|
||||
if self.fail:
|
||||
return
|
||||
|
||||
self.dbstate = dbstate
|
||||
self.active = dbstate.get_active_person()
|
||||
active_handle = uistate.get_active('Person')
|
||||
self.active = dbstate.db.get_person_from_handle(active_handle)
|
||||
self.callback = callback
|
||||
self.active_name = _("Descendant Browser: %s") \
|
||||
% name_displayer.display(self.active)
|
||||
|
@ -63,12 +63,14 @@ WIKI_HELP_SEC = _('manual|Not_Related...')
|
||||
class NotRelated(Tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
|
||||
|
||||
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
||||
Tool.ActivePersonTool.__init__(self, dbstate, options_class, name)
|
||||
Tool.ActivePersonTool.__init__(self, dbstate, uistate, options_class,
|
||||
name)
|
||||
|
||||
if self.fail: # bug #2709 -- fail if we have no active person
|
||||
return
|
||||
|
||||
person = dbstate.get_active_person()
|
||||
person_handle = uistate.get_active('Person')
|
||||
person = dbstate.db.get_person_from_handle(person_handle)
|
||||
self.name = person.get_primary_name().get_regular_name()
|
||||
self.title = _('Not related to "%s"') % self.name
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__)
|
||||
|
@ -46,7 +46,6 @@ 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
|
||||
@ -83,7 +82,7 @@ class EventView(ListView):
|
||||
FILTER_TYPE = "Event"
|
||||
QR_CATEGORY = CATEGORY_QR_EVENT
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
"""
|
||||
Create the Event View
|
||||
"""
|
||||
@ -99,7 +98,7 @@ class EventView(ListView):
|
||||
EventView.COLUMN_NAMES, len(EventView.COLUMN_NAMES),
|
||||
EventModel,
|
||||
signal_map, dbstate.db.get_event_bookmarks(),
|
||||
Bookmarks.EventBookmarks,
|
||||
Bookmarks.EventBookmarks, nav_group,
|
||||
multiple=True,
|
||||
filter_class=EventSidebarFilter)
|
||||
|
||||
@ -112,7 +111,7 @@ class EventView(ListView):
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_EVENT
|
||||
return 'Event'
|
||||
|
||||
def column_ord_setfunc(self, clist):
|
||||
self.dbstate.db.set_event_column_order(clist)
|
||||
@ -153,6 +152,12 @@ class EventView(ListView):
|
||||
<menuitem action="EditBook"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="FileMenu">
|
||||
<placeholder name="LocalExport">
|
||||
<menuitem action="ExportTab"/>
|
||||
@ -169,6 +174,10 @@ class EventView(ListView):
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
</placeholder>
|
||||
<placeholder name="CommonEdit">
|
||||
<toolitem action="Add"/>
|
||||
<toolitem action="Edit"/>
|
||||
@ -176,6 +185,9 @@ class EventView(ListView):
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="Add"/>
|
||||
<menuitem action="Edit"/>
|
||||
<menuitem action="Remove"/>
|
||||
|
@ -44,7 +44,6 @@ 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
|
||||
@ -76,7 +75,7 @@ class FamilyView(ListView):
|
||||
FILTER_TYPE = "Family"
|
||||
QR_CATEGORY = CATEGORY_QR_FAMILY
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'family-add' : self.row_add,
|
||||
@ -90,7 +89,8 @@ class FamilyView(ListView):
|
||||
FamilyView.COLUMN_NAMES, len(FamilyView.COLUMN_NAMES),
|
||||
FamilyModel,
|
||||
signal_map, dbstate.db.get_family_bookmarks(),
|
||||
Bookmarks.FamilyBookmarks, filter_class=FamilySidebarFilter)
|
||||
Bookmarks.FamilyBookmarks, nav_group,
|
||||
filter_class=FamilySidebarFilter)
|
||||
|
||||
self.func_list = {
|
||||
'<CONTROL>J' : self.jump,
|
||||
@ -101,7 +101,7 @@ class FamilyView(ListView):
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_FAMILY
|
||||
return 'Family'
|
||||
|
||||
def column_ord_setfunc(self, clist):
|
||||
self.dbstate.db.set_family_list_column_order(clist)
|
||||
@ -130,6 +130,12 @@ class FamilyView(ListView):
|
||||
<menuitem action="ExportTab"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="EditMenu">
|
||||
<placeholder name="CommonEdit">
|
||||
<menuitem action="Add"/>
|
||||
@ -147,6 +153,10 @@ class FamilyView(ListView):
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
</placeholder>
|
||||
<placeholder name="CommonEdit">
|
||||
<toolitem action="Add"/>
|
||||
<toolitem action="Edit"/>
|
||||
@ -154,6 +164,9 @@ class FamilyView(ListView):
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="Add"/>
|
||||
<menuitem action="Edit"/>
|
||||
<menuitem action="Remove"/>
|
||||
|
@ -53,11 +53,11 @@ if gtk.pygtk_version < (2,3,93):
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gui.views.navigationview import NavigationView
|
||||
from BasicUtils import name_displayer
|
||||
from Utils import (find_children, find_parents, find_witnessed_people)
|
||||
from libformatting import FormattingHelper
|
||||
import gen.lib
|
||||
from gui.views.navigationview import NavigationView
|
||||
import Errors
|
||||
import Bookmarks
|
||||
from gui.editors import EditPerson, EditFamily
|
||||
@ -565,11 +565,12 @@ class FanChartView(NavigationView):
|
||||
"""
|
||||
The Gramplet code that realizes the FanChartWidget.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
NavigationView.__init__(self, _('Fan Chart'),
|
||||
dbstate, uistate,
|
||||
dbstate.db.get_bookmarks(),
|
||||
Bookmarks.Bookmarks)
|
||||
Bookmarks.PersonBookmarks,
|
||||
nav_group)
|
||||
|
||||
dbstate.connect('active-changed', self.active_changed)
|
||||
self.dbstate = dbstate
|
||||
@ -577,6 +578,9 @@ class FanChartView(NavigationView):
|
||||
self.generations = 9
|
||||
self.format_helper = FormattingHelper(self.dbstate)
|
||||
|
||||
def navigation_type(self):
|
||||
return 'Person'
|
||||
|
||||
def build_widget(self):
|
||||
self.fan = FanChartWidget(self.generations,
|
||||
context_popup_callback=self.on_popup)
|
||||
@ -617,6 +621,9 @@ class FanChartView(NavigationView):
|
||||
|
||||
def update(self):
|
||||
self.main()
|
||||
|
||||
def goto_handle(self, handle):
|
||||
self.main()
|
||||
|
||||
def have_parents(self, person):
|
||||
"""
|
||||
@ -663,7 +670,7 @@ class FanChartView(NavigationView):
|
||||
data.
|
||||
"""
|
||||
self.fan.reset_generations()
|
||||
person = self.dbstate.get_active_person()
|
||||
person = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
if not person:
|
||||
name = None
|
||||
else:
|
||||
@ -710,7 +717,7 @@ class FanChartView(NavigationView):
|
||||
def on_childmenu_changed(self, obj,person_handle):
|
||||
"""Callback for the pulldown menu selection, changing to the person
|
||||
attached with menu item."""
|
||||
self.dbstate.change_active_handle(person_handle)
|
||||
self.change_active(person_handle)
|
||||
return True
|
||||
|
||||
def edit_person_cb(self, obj,person_handle):
|
||||
|
@ -609,7 +609,7 @@ class GeoView(HtmlView):
|
||||
self.width = gws.width
|
||||
self.height = gws.height
|
||||
self.header_size = self.box1.get_allocation().height + 8
|
||||
if not self.dbstate.active:
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self.external_uri()
|
||||
|
||||
@ -927,7 +927,7 @@ class GeoView(HtmlView):
|
||||
"""
|
||||
Change the style of the map view
|
||||
"""
|
||||
if not self.dbstate.active:
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self._geo_places()
|
||||
|
||||
@ -935,7 +935,7 @@ class GeoView(HtmlView):
|
||||
"""
|
||||
Here when the GeoView page is loaded
|
||||
"""
|
||||
if not self.dbstate.active:
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self._geo_places()
|
||||
|
||||
@ -951,7 +951,7 @@ class GeoView(HtmlView):
|
||||
Specifies the person places.
|
||||
"""
|
||||
self.displaytype = "person"
|
||||
if not self.dbstate.active:
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self._geo_places()
|
||||
|
||||
@ -960,7 +960,7 @@ class GeoView(HtmlView):
|
||||
Specifies the family places to display with mapstraction.
|
||||
"""
|
||||
self.displaytype = "family"
|
||||
if not self.dbstate.active:
|
||||
if not self.uistate.get_active('Person'):
|
||||
return
|
||||
self._geo_places()
|
||||
|
||||
@ -1795,9 +1795,8 @@ class GeoView(HtmlView):
|
||||
self.minyear = 9999
|
||||
self.maxyear = 0
|
||||
self.center = True
|
||||
person = None
|
||||
if dbstate.active:
|
||||
person = dbstate.active
|
||||
person_handle = self.uistate.get_active('Person')
|
||||
person = dbstate.db.get_person_from_handle(person_handle)
|
||||
if person is not None:
|
||||
family_list = person.get_family_handle_list()
|
||||
if len(family_list) > 0:
|
||||
@ -1855,9 +1854,8 @@ class GeoView(HtmlView):
|
||||
self.maxyear = 0
|
||||
latitude = ""
|
||||
longitude = ""
|
||||
person = None
|
||||
if dbstate.active:
|
||||
person = dbstate.active
|
||||
person_handle = self.uistate.get_active('Person')
|
||||
person = dbstate.db.get_person_from_handle(person_handle)
|
||||
self.center = True
|
||||
if person is not None:
|
||||
# For each event, if we have a place, set a marker.
|
||||
|
@ -684,7 +684,7 @@ class GuiGramplet(object):
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
elif event.type == gtk.gdk.BUTTON_PRESS: # single click
|
||||
self.dbstate.change_active_person(person)
|
||||
self.uistate.set_active(handle, 'Person')
|
||||
return True # handled event
|
||||
elif event.button == 3: # right mouse
|
||||
#FIXME: add a popup menu with options
|
||||
|
@ -47,7 +47,6 @@ 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
|
||||
@ -94,7 +93,7 @@ class MediaView(ListView):
|
||||
|
||||
_DND_TYPE = DdTargets.URI_LIST
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'media-add' : self.row_add,
|
||||
@ -108,7 +107,8 @@ class MediaView(ListView):
|
||||
MediaView.COLUMN_NAMES, len(MediaView.COLUMN_NAMES),
|
||||
MediaModel,
|
||||
signal_map, dbstate.db.get_media_bookmarks(),
|
||||
Bookmarks.MediaBookmarks, filter_class=MediaSidebarFilter,
|
||||
Bookmarks.MediaBookmarks, nav_group,
|
||||
filter_class=MediaSidebarFilter,
|
||||
multiple=True)
|
||||
|
||||
self.func_list = {
|
||||
@ -120,7 +120,7 @@ class MediaView(ListView):
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_MEDIA
|
||||
return 'Media'
|
||||
|
||||
def column_ord_setfunc(self, clist):
|
||||
self.dbstate.db.set_media_column_order(clist)
|
||||
@ -363,8 +363,18 @@ class MediaView(ListView):
|
||||
<menuitem action="EditBook"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
</placeholder>
|
||||
<placeholder name="CommonEdit">
|
||||
<toolitem action="Add"/>
|
||||
<toolitem action="Edit"/>
|
||||
@ -374,6 +384,9 @@ class MediaView(ListView):
|
||||
<toolitem action="OpenMedia"/>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="OpenMedia"/>
|
||||
<menuitem action="OpenContainingFolder"/>
|
||||
<separator/>
|
||||
|
@ -44,7 +44,6 @@ 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
|
||||
@ -78,7 +77,7 @@ class NoteView(ListView):
|
||||
FILTER_TYPE = "Note"
|
||||
QR_CATEGORY = CATEGORY_QR_NOTE
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'note-add' : self.row_add,
|
||||
@ -96,7 +95,7 @@ class NoteView(ListView):
|
||||
self, _('Notes'), dbstate, uistate, NoteView.COLUMN_NAMES,
|
||||
len(NoteView.COLUMN_NAMES), NoteModel, signal_map,
|
||||
dbstate.db.get_note_bookmarks(),
|
||||
Bookmarks.NoteBookmarks,
|
||||
Bookmarks.NoteBookmarks, nav_group,
|
||||
filter_class=NoteSidebarFilter,
|
||||
multiple=True)
|
||||
|
||||
@ -104,7 +103,7 @@ class NoteView(ListView):
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_NOTE
|
||||
return 'Note'
|
||||
|
||||
def column_ord_setfunc(self, clist):
|
||||
self.dbstate.db.set_note_column_order(clist)
|
||||
@ -150,6 +149,12 @@ class NoteView(ListView):
|
||||
<menuitem action="EditBook"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="EditMenu">
|
||||
<placeholder name="CommonEdit">
|
||||
<menuitem action="Add"/>
|
||||
@ -161,6 +166,10 @@ class NoteView(ListView):
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
</placeholder>
|
||||
<placeholder name="CommonEdit">
|
||||
<toolitem action="Add"/>
|
||||
<toolitem action="Edit"/>
|
||||
@ -168,6 +177,9 @@ class NoteView(ListView):
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="Add"/>
|
||||
<menuitem action="Edit"/>
|
||||
<menuitem action="Remove"/>
|
||||
|
@ -51,7 +51,7 @@ except:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from gui.views.navigationview import NavigationView, NAVIGATION_PERSON
|
||||
from gui.views.navigationview import NavigationView
|
||||
from BasicUtils import name_displayer
|
||||
from Utils import (media_path_full, probably_alive, find_children,
|
||||
find_parents, find_witnessed_people)
|
||||
@ -368,10 +368,11 @@ class PersonBoxWidget( gtk.DrawingArea, _PersonWidget_base):
|
||||
#-------------------------------------------------------------------------
|
||||
class PedigreeView(NavigationView):
|
||||
|
||||
def __init__(self,dbstate,uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
NavigationView.__init__(self, _('Pedigree'), dbstate, uistate,
|
||||
dbstate.db.get_bookmarks(),
|
||||
Bookmarks.Bookmarks)
|
||||
Bookmarks.PersonBookmarks,
|
||||
nav_group)
|
||||
self.func_list = {
|
||||
'<CONTROL>J' : self.jump,
|
||||
}
|
||||
@ -521,11 +522,7 @@ class PedigreeView(NavigationView):
|
||||
information.
|
||||
"""
|
||||
try:
|
||||
active = self.dbstate.get_active_person()
|
||||
if active:
|
||||
self.rebuild_trees(active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
except AttributeError, msg:
|
||||
RunDatabaseRepair(str(msg))
|
||||
|
||||
@ -551,13 +548,16 @@ class PedigreeView(NavigationView):
|
||||
self.build_tree()
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_PERSON
|
||||
return 'Person'
|
||||
|
||||
def goto_handle(self, handle=None):
|
||||
self.dirty = True
|
||||
if handle:
|
||||
self.rebuild_trees(handle)
|
||||
self.handle_history(handle)
|
||||
person = self.dbstate.db.get_person_from_handle(handle)
|
||||
if person:
|
||||
self.rebuild_trees(handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
@ -571,10 +571,7 @@ class PedigreeView(NavigationView):
|
||||
def person_rebuild(self,dummy=None):
|
||||
self.format_helper.clear_cache()
|
||||
self.dirty = True
|
||||
if self.dbstate.active:
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def request_resize(self):
|
||||
self.size_request_cb(self.notebook.parent,None,None)
|
||||
@ -592,10 +589,11 @@ class PedigreeView(NavigationView):
|
||||
else:
|
||||
self.notebook.set_current_page(self.force_size-2)
|
||||
|
||||
def rebuild_trees(self,person_handle):
|
||||
def rebuild_trees(self, person_handle):
|
||||
|
||||
person = None
|
||||
if person_handle:
|
||||
person = self.dbstate.db.get_person_from_handle( person_handle)
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
|
||||
self.dirty = False
|
||||
|
||||
@ -1010,7 +1008,7 @@ class PedigreeView(NavigationView):
|
||||
def home(self, obj):
|
||||
defperson = self.dbstate.db.get_default_person()
|
||||
if defperson:
|
||||
self.dbstate.change_active_person(defperson)
|
||||
self.change_active(defperson.get_handle())
|
||||
|
||||
def edit_person_cb(self, obj,person_handle):
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
@ -1100,16 +1098,17 @@ class PedigreeView(NavigationView):
|
||||
def on_show_child_menu(self, obj):
|
||||
"""User clicked button to move to child of active person"""
|
||||
|
||||
if self.dbstate.active:
|
||||
person = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
if person:
|
||||
# Build and display the menu attached to the left pointing arrow
|
||||
# button. The menu consists of the children of the current root
|
||||
# person of the tree. Attach a child to each menu item.
|
||||
|
||||
childlist = find_children(self.dbstate.db,self.dbstate.active)
|
||||
childlist = find_children(self.dbstate.db, person)
|
||||
if len(childlist) == 1:
|
||||
child = self.dbstate.db.get_person_from_handle(childlist[0])
|
||||
if child:
|
||||
self.dbstate.change_active_person(child)
|
||||
self.change_active(childlist[0])
|
||||
elif len(childlist) > 1:
|
||||
myMenu = gtk.Menu()
|
||||
for child_handle in childlist:
|
||||
@ -1137,7 +1136,7 @@ class PedigreeView(NavigationView):
|
||||
def on_childmenu_changed(self, obj,person_handle):
|
||||
"""Callback for the pulldown menu selection, changing to the person
|
||||
attached with menu item."""
|
||||
self.dbstate.change_active_handle(person_handle)
|
||||
self.change_active(person_handle)
|
||||
return True
|
||||
|
||||
def change_force_size_cb(self,event,data):
|
||||
@ -1153,28 +1152,19 @@ class PedigreeView(NavigationView):
|
||||
if self.tree_style != data:
|
||||
self.dirty = True
|
||||
self.tree_style = data
|
||||
if self.dbstate.active:
|
||||
self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active()) # Rebuild using new style
|
||||
|
||||
def change_show_images_cb(self,event):
|
||||
self.show_images = not self.show_images
|
||||
config.set('interface.pedview-show-images',self.show_images)
|
||||
self.dirty = True
|
||||
if self.dbstate.active:
|
||||
self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active()) # Rebuild using new style
|
||||
|
||||
def change_show_marriage_cb(self,event):
|
||||
self.show_marriage_data = not self.show_marriage_data
|
||||
config.set('interface.pedview-show-marriage', self.show_marriage_data)
|
||||
self.dirty = True
|
||||
if self.dbstate.active:
|
||||
self.rebuild_trees(self.dbstate.active.handle) # Rebuild using new style
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active()) # Rebuild using new style
|
||||
|
||||
def find_tree(self,person,index,depth,lst,val=0):
|
||||
"""Recursively build a list of ancestors"""
|
||||
|
@ -52,8 +52,7 @@ except:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
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 Utils import (media_path_full, probably_alive, find_children,
|
||||
find_parents, find_witnessed_people)
|
||||
@ -482,10 +481,11 @@ class PedigreeViewExt(NavigationView):
|
||||
Displays the ancestors of a selected individual.
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
NavigationView.__init__(self, _('Pedigree'), dbstate, uistate,
|
||||
dbstate.db.get_bookmarks(),
|
||||
Bookmarks.Bookmarks)
|
||||
Bookmarks.PersonBookmarks,
|
||||
nav_group)
|
||||
|
||||
self.func_list = {
|
||||
'F2' : self.kb_goto_home,
|
||||
@ -647,9 +647,9 @@ class PedigreeViewExt(NavigationView):
|
||||
information.
|
||||
"""
|
||||
try:
|
||||
active = self.dbstate.get_active_person()
|
||||
active = self.get_active()
|
||||
if active:
|
||||
self.rebuild_trees(active.handle)
|
||||
self.rebuild_trees(active)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
except AttributeError, msg:
|
||||
@ -677,14 +677,16 @@ class PedigreeViewExt(NavigationView):
|
||||
self.build_tree()
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_PERSON
|
||||
return 'Person'
|
||||
|
||||
def goto_handle(self, handle=None):
|
||||
"""Callback function for change active person in other GRAMPS page."""
|
||||
self.dirty = True
|
||||
if handle:
|
||||
self.rebuild_trees(handle)
|
||||
self.handle_history(handle)
|
||||
person = self.dbstate.db.get_person_from_handle(handle)
|
||||
if person:
|
||||
self.rebuild_trees(handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
@ -699,23 +701,19 @@ class PedigreeViewExt(NavigationView):
|
||||
"""Callback function for signals of change database."""
|
||||
self.format_helper.clear_cache()
|
||||
self.dirty = True
|
||||
if self.dbstate.active:
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def rebuild_trees(self, person_handle):
|
||||
"""
|
||||
Rebild tree with root person_handle.
|
||||
Called from many fuctions, when need full redraw tree.
|
||||
"""
|
||||
|
||||
self.dirty = False
|
||||
|
||||
person = None
|
||||
if person_handle:
|
||||
person = self.dbstate.db.get_person_from_handle(person_handle)
|
||||
|
||||
self.dirty = False
|
||||
|
||||
if self.tree_style != 2 and \
|
||||
(self.force_size > 5 or self.force_size == 0):
|
||||
self.force_size = 5
|
||||
@ -1515,7 +1513,7 @@ class PedigreeViewExt(NavigationView):
|
||||
"""Change root person to default person for database."""
|
||||
defperson = self.dbstate.db.get_default_person()
|
||||
if defperson:
|
||||
self.dbstate.change_active_person(defperson)
|
||||
self.change_active(defperson.get_handle())
|
||||
|
||||
def edit_person_cb(self, obj, person_handle):
|
||||
"""
|
||||
@ -1696,16 +1694,17 @@ class PedigreeViewExt(NavigationView):
|
||||
|
||||
def on_show_child_menu(self, obj):
|
||||
"""User clicked button to move to child of active person"""
|
||||
if self.dbstate.active:
|
||||
person = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
if person:
|
||||
# Build and display the menu attached to the left pointing arrow
|
||||
# button. The menu consists of the children of the current root
|
||||
# person of the tree. Attach a child to each menu item.
|
||||
|
||||
childlist = find_children(self.dbstate.db, self.dbstate.active)
|
||||
childlist = find_children(self.dbstate.db, person)
|
||||
if len(childlist) == 1:
|
||||
child = self.dbstate.db.get_person_from_handle(childlist[0])
|
||||
if child:
|
||||
self.dbstate.change_active_person(child)
|
||||
self.change_active(childlist[0])
|
||||
elif len(childlist) > 1:
|
||||
myMenu = gtk.Menu()
|
||||
for child_handle in childlist:
|
||||
@ -1737,7 +1736,7 @@ class PedigreeViewExt(NavigationView):
|
||||
Callback for the pulldown menu selection, changing to the person
|
||||
attached with menu item.
|
||||
"""
|
||||
self.dbstate.change_active_handle(person_handle)
|
||||
self.change_active(person_handle)
|
||||
return True
|
||||
|
||||
def change_force_size_cb(self, menuitem, data):
|
||||
@ -1747,7 +1746,7 @@ class PedigreeViewExt(NavigationView):
|
||||
self.force_size = data
|
||||
self.dirty = True
|
||||
# switch to matching size
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def change_tree_style_cb(self, menuitem, data):
|
||||
"""Change tree_style option."""
|
||||
@ -1758,11 +1757,7 @@ class PedigreeViewExt(NavigationView):
|
||||
self.force_size = 5
|
||||
self.dirty = True
|
||||
self.tree_style = data
|
||||
if self.dbstate.active:
|
||||
# Rebuild using new style
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def change_tree_direction_cb(self, menuitem, data):
|
||||
"""Change tree_direction option."""
|
||||
@ -1771,22 +1766,14 @@ class PedigreeViewExt(NavigationView):
|
||||
if self.tree_direction != data:
|
||||
self.dirty = True
|
||||
self.tree_direction = data
|
||||
if self.dbstate.active:
|
||||
# Rebuild using new tree direction
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def change_show_images_cb(self, event):
|
||||
"""Change show_images option."""
|
||||
self.show_images = not self.show_images
|
||||
config.set('interface.pedviewext-show-images', self.show_images)
|
||||
self.dirty = True
|
||||
if self.dbstate.active:
|
||||
# Rebuild using new style
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def change_show_marriage_cb(self, event):
|
||||
"""Change show_marriage_data option."""
|
||||
@ -1794,11 +1781,7 @@ class PedigreeViewExt(NavigationView):
|
||||
config.set('interface.pedviewext-show-marriage',
|
||||
self.show_marriage_data)
|
||||
self.dirty = True
|
||||
if self.dbstate.active:
|
||||
# Rebuild using new style
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def change_show_unknown_peoples_cb(self, event):
|
||||
"""Change show_unknown_peoples option."""
|
||||
@ -1806,11 +1789,7 @@ class PedigreeViewExt(NavigationView):
|
||||
config.set('interface.pedviewext-show-unknown-peoples',
|
||||
self.show_unknown_peoples)
|
||||
self.dirty = True
|
||||
if self.dbstate.active:
|
||||
# Rebuild using new style
|
||||
self.rebuild_trees(self.dbstate.active.handle)
|
||||
else:
|
||||
self.rebuild_trees(None)
|
||||
self.rebuild_trees(self.get_active())
|
||||
|
||||
def change_scroll_direction_cb(self, menuitem, data):
|
||||
"""Change scroll_direction option."""
|
||||
@ -1898,7 +1877,8 @@ class PedigreeViewExt(NavigationView):
|
||||
to the context menu. Used by both build_nav_menu() and
|
||||
build_full_nav_menu() methods.
|
||||
"""
|
||||
hobj = self.uistate.phistory
|
||||
hobj = self.uistate.get_history(self.navigation_type(),
|
||||
self.get_group())
|
||||
home_sensitivity = True
|
||||
if not self.dbstate.db.get_default_person():
|
||||
home_sensitivity = False
|
||||
|
@ -46,7 +46,6 @@ _LOG = logging.getLogger(".gui.personview")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from gui.views.navigationview import NAVIGATION_PERSON
|
||||
from gui.views.listview import ListView, LISTTREE
|
||||
from gui.views.treemodels import PeopleModel
|
||||
import Utils
|
||||
@ -94,7 +93,7 @@ class PersonView(ListView):
|
||||
FILTER_TYPE = "Person"
|
||||
QR_CATEGORY = CATEGORY_QR_PERSON
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
"""
|
||||
Create the Person View
|
||||
"""
|
||||
@ -110,7 +109,7 @@ class PersonView(ListView):
|
||||
PersonView.COLUMN_NAMES, len(PersonView.COLUMN_NAMES),
|
||||
PeopleModel,
|
||||
signal_map, dbstate.db.get_bookmarks(),
|
||||
Bookmarks.Bookmarks,
|
||||
Bookmarks.PersonBookmarks, nav_group,
|
||||
multiple=True,
|
||||
filter_class=PersonSidebarFilter,
|
||||
markup=True)
|
||||
@ -132,7 +131,7 @@ class PersonView(ListView):
|
||||
self.dbstate.db.set_person_column_order(clist)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_PERSON
|
||||
return 'Person'
|
||||
|
||||
def get_bookmarks(self):
|
||||
"""
|
||||
@ -332,7 +331,9 @@ class PersonView(ListView):
|
||||
self.dbstate.db.transaction_commit(trans, active_name)
|
||||
|
||||
# select the previously active person, turn off the busy cursor
|
||||
self.uistate.phistory.back()
|
||||
history = self.uistate.get_history(self.navigation_type(),
|
||||
self.get_group())
|
||||
self.uistate.history.back()
|
||||
self.uistate.set_busy_cursor(False)
|
||||
|
||||
def remove_from_person_list(self, person):
|
||||
|
@ -54,7 +54,8 @@ class PlaceTreeView(PlaceBaseView):
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
||||
_('Tree'), PlaceTreeModel)
|
||||
_('Tree'), PlaceTreeModel,
|
||||
nav_group=0)
|
||||
|
||||
def type_list(self):
|
||||
"""
|
||||
|
@ -48,4 +48,6 @@ class PlaceView(PlaceBaseView):
|
||||
Flat place view. (Original code in PlaceBaseView).
|
||||
"""
|
||||
def __init__(self, dbstate, uistate):
|
||||
PlaceBaseView.__init__(self, dbstate, uistate, _('Places'), PlaceModel)
|
||||
PlaceBaseView.__init__(self, dbstate, uistate,
|
||||
_('Places'), PlaceModel,
|
||||
nav_group=0)
|
||||
|
@ -47,8 +47,8 @@ import pango
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
from gui.views.navigationview import NavigationView
|
||||
from gui.editors import EditPerson, EditFamily
|
||||
from gui.views.navigationview import NavigationView, NAVIGATION_PERSON
|
||||
from BasicUtils import name_displayer
|
||||
from Utils import media_path_full, probably_alive
|
||||
import DateHandler
|
||||
@ -115,11 +115,12 @@ class AttachList(object):
|
||||
|
||||
class RelationshipView(NavigationView):
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
NavigationView.__init__(self, _('Relationships'),
|
||||
dbstate, uistate,
|
||||
dbstate.db.get_bookmarks(),
|
||||
Bookmarks.Bookmarks)
|
||||
Bookmarks.PersonBookmarks,
|
||||
nav_group)
|
||||
|
||||
self.func_list = {
|
||||
'<CONTROL>J' : self.jump,
|
||||
@ -163,7 +164,7 @@ class RelationshipView(NavigationView):
|
||||
self.callman.add_db_signal('person-delete', self.redraw)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_PERSON
|
||||
return 'Person'
|
||||
|
||||
def goto_handle(self, handle):
|
||||
self.redraw()
|
||||
@ -181,8 +182,9 @@ class RelationshipView(NavigationView):
|
||||
self.redraw()
|
||||
|
||||
def person_update(self, handle_list):
|
||||
if self.dbstate.active:
|
||||
while not self.change_person(self.dbstate.active.handle):
|
||||
person = self.get_active()
|
||||
if person:
|
||||
while not self.change_person(person):
|
||||
pass
|
||||
else:
|
||||
self.change_person(None)
|
||||
@ -191,36 +193,41 @@ class RelationshipView(NavigationView):
|
||||
"""Large change to person database"""
|
||||
if self.active:
|
||||
self.bookmarks.redraw()
|
||||
if self.dbstate.active:
|
||||
while not self.change_person(self.dbstate.active.handle):
|
||||
person = self.get_active()
|
||||
if person:
|
||||
while not self.change_person(person):
|
||||
pass
|
||||
else:
|
||||
self.change_person(None)
|
||||
|
||||
def family_update(self, handle_list):
|
||||
if self.dbstate.active:
|
||||
while not self.change_person(self.dbstate.active.handle):
|
||||
person = self.get_active()
|
||||
if person:
|
||||
while not self.change_person(person):
|
||||
pass
|
||||
else:
|
||||
self.change_person(None)
|
||||
|
||||
def family_add(self, handle_list):
|
||||
if self.dbstate.active:
|
||||
while not self.change_person(self.dbstate.active.handle):
|
||||
person = self.get_active()
|
||||
if person:
|
||||
while not self.change_person(person):
|
||||
pass
|
||||
else:
|
||||
self.change_person(None)
|
||||
|
||||
def family_delete(self, handle_list):
|
||||
if self.dbstate.active:
|
||||
while not self.change_person(self.dbstate.active.handle):
|
||||
person = self.get_active()
|
||||
if person:
|
||||
while not self.change_person(person):
|
||||
pass
|
||||
else:
|
||||
self.change_person(None)
|
||||
|
||||
def family_rebuild(self):
|
||||
if self.dbstate.active:
|
||||
while not self.change_person(self.dbstate.active.handle):
|
||||
person = self.get_active()
|
||||
if person:
|
||||
while not self.change_person(person):
|
||||
pass
|
||||
else:
|
||||
self.change_person(None)
|
||||
@ -387,12 +394,12 @@ class RelationshipView(NavigationView):
|
||||
|
||||
def siblings_toggle(self, obj):
|
||||
self.show_siblings = obj.get_active()
|
||||
self.change_person(self.dbstate.active.handle)
|
||||
self.change_person(self.get_active())
|
||||
config.set('preferences.family-siblings', self.show_siblings)
|
||||
|
||||
def details_toggle(self, obj):
|
||||
self.show_details = obj.get_active()
|
||||
self.change_person(self.dbstate.active.handle)
|
||||
self.change_person(self.get_active())
|
||||
config.set('preferences.family-details', self.show_details)
|
||||
|
||||
def change_db(self, db):
|
||||
@ -422,9 +429,9 @@ class RelationshipView(NavigationView):
|
||||
return (_(u"Unknown"), "")
|
||||
|
||||
def redraw(self, *obj):
|
||||
if self.dbstate.active:
|
||||
self.handle_history(self.dbstate.active.handle)
|
||||
self.change_person(self.dbstate.active.handle)
|
||||
active_person = self.get_active()
|
||||
if active_person:
|
||||
self.change_person(active_person)
|
||||
else:
|
||||
self.change_person(None)
|
||||
|
||||
@ -812,7 +819,7 @@ class RelationshipView(NavigationView):
|
||||
# don't show rest
|
||||
self.write_label("%s:" % _('Parents'), family, True, person)
|
||||
self.row -= 1 # back up one row for summary names
|
||||
active = self.dbstate.active.handle
|
||||
active = self.ui.get_active()
|
||||
child_list = [ref.ref for ref in family.get_child_ref_list()
|
||||
if ref.ref != active]
|
||||
if child_list:
|
||||
@ -849,7 +856,7 @@ class RelationshipView(NavigationView):
|
||||
self.write_person(_('Mother'), family.get_mother_handle())
|
||||
|
||||
if self.show_siblings:
|
||||
active = self.dbstate.active.handle
|
||||
active = self.get_active()
|
||||
hbox = gtk.HBox()
|
||||
if self.check_collapsed(person.handle, "SIBLINGS"):
|
||||
arrow = widgets.ExpandCollapseArrow(True,
|
||||
@ -1181,7 +1188,7 @@ class RelationshipView(NavigationView):
|
||||
|
||||
def _button_press(self, obj, event, handle):
|
||||
if button_activated(event, _LEFT_BUTTON):
|
||||
self.dbstate.change_active_handle(handle)
|
||||
self.change_active(handle)
|
||||
elif button_activated(event, _RIGHT_BUTTON):
|
||||
myMenu = gtk.Menu()
|
||||
myMenu.append(self.build_menu_item(handle))
|
||||
@ -1280,7 +1287,7 @@ class RelationshipView(NavigationView):
|
||||
|
||||
father_handle = family.get_father_handle()
|
||||
mother_handle = family.get_mother_handle()
|
||||
if self.dbstate.active.handle == father_handle:
|
||||
if self.get_active() == father_handle:
|
||||
handle = mother_handle
|
||||
else:
|
||||
handle = father_handle
|
||||
@ -1410,7 +1417,7 @@ class RelationshipView(NavigationView):
|
||||
def add_family(self, obj, event, handle):
|
||||
if button_activated(event, _LEFT_BUTTON):
|
||||
family = gen.lib.Family()
|
||||
person = self.dbstate.active
|
||||
person = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
if not person:
|
||||
return
|
||||
|
||||
@ -1426,7 +1433,7 @@ class RelationshipView(NavigationView):
|
||||
|
||||
def add_spouse(self, obj):
|
||||
family = gen.lib.Family()
|
||||
person = self.dbstate.active
|
||||
person = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
|
||||
if not person:
|
||||
return
|
||||
@ -1442,7 +1449,7 @@ class RelationshipView(NavigationView):
|
||||
pass
|
||||
|
||||
def edit_active(self, obj):
|
||||
phandle = self.dbstate.get_active_person().handle
|
||||
phandle = self.get_active()
|
||||
self.edit_person(obj, phandle)
|
||||
|
||||
def add_child_to_fam(self, obj, event, handle):
|
||||
@ -1496,7 +1503,7 @@ class RelationshipView(NavigationView):
|
||||
if button_activated(event, _LEFT_BUTTON):
|
||||
SelectFamily = SelectorFactory('Family')
|
||||
|
||||
phandle = self.dbstate.get_active_person().handle
|
||||
phandle = self.get_active()
|
||||
person = self.dbstate.db.get_person_from_handle(phandle)
|
||||
skip = set(person.get_family_handle_list())
|
||||
|
||||
@ -1504,15 +1511,14 @@ class RelationshipView(NavigationView):
|
||||
family = dialog.run()
|
||||
|
||||
if family:
|
||||
active_handle = self.dbstate.active.handle
|
||||
child = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
child = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
|
||||
self.dbstate.db.add_child_to_family(family, child)
|
||||
|
||||
def select_parents(self, obj):
|
||||
SelectFamily = SelectorFactory('Family')
|
||||
|
||||
phandle = self.dbstate.get_active_person().handle
|
||||
phandle = self.get_active()
|
||||
person = self.dbstate.db.get_person_from_handle(phandle)
|
||||
skip = set(person.get_family_handle_list()+
|
||||
person.get_parent_family_handle_list())
|
||||
@ -1521,14 +1527,13 @@ class RelationshipView(NavigationView):
|
||||
family = dialog.run()
|
||||
|
||||
if family:
|
||||
active_handle = self.dbstate.active.handle
|
||||
child = self.dbstate.db.get_person_from_handle(active_handle)
|
||||
child = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
|
||||
self.dbstate.db.add_child_to_family(family, child)
|
||||
|
||||
def add_parents(self, obj):
|
||||
family = gen.lib.Family()
|
||||
person = self.dbstate.active
|
||||
person = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
|
||||
if not person:
|
||||
return
|
||||
@ -1545,7 +1550,7 @@ class RelationshipView(NavigationView):
|
||||
def add_parent_family(self, obj, event, handle):
|
||||
if button_activated(event, _LEFT_BUTTON):
|
||||
family = gen.lib.Family()
|
||||
person = self.dbstate.active
|
||||
person = self.dbstate.db.get_person_from_handle(self.get_active())
|
||||
|
||||
ref = gen.lib.ChildRef()
|
||||
ref.ref = person.handle
|
||||
@ -1558,27 +1563,25 @@ class RelationshipView(NavigationView):
|
||||
|
||||
def delete_family(self, obj, event, handle):
|
||||
if button_activated(event, _LEFT_BUTTON):
|
||||
self.dbstate.db.remove_parent_from_family(self.dbstate.active.handle,
|
||||
handle)
|
||||
self.dbstate.db.remove_parent_from_family(self.get_active(), handle)
|
||||
|
||||
def delete_parent_family(self, obj, event, handle):
|
||||
if button_activated(event, _LEFT_BUTTON):
|
||||
self.dbstate.db.remove_child_from_family(self.dbstate.active.handle,
|
||||
handle)
|
||||
self.dbstate.db.remove_child_from_family(self.get_active(), handle)
|
||||
|
||||
def change_to(self, obj, handle):
|
||||
self.dbstate.change_active_handle(handle)
|
||||
self.change_active(handle)
|
||||
|
||||
def reorder_button_press(self, obj, event, handle):
|
||||
if button_activated(event, _LEFT_BUTTON):
|
||||
self.reorder(obj)
|
||||
|
||||
def reorder(self, obj, dumm1=None, dummy2=None):
|
||||
if self.dbstate.active:
|
||||
if self.get_active():
|
||||
try:
|
||||
import Reorder
|
||||
Reorder.Reorder(self.dbstate, self.uistate, [],
|
||||
self.dbstate.active.handle)
|
||||
self.get_active())
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
|
||||
|
@ -37,7 +37,6 @@ 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
|
||||
@ -85,7 +84,7 @@ class RepositoryView(ListView):
|
||||
FILTER_TYPE = "Repository"
|
||||
QR_CATEGORY = CATEGORY_QR_REPOSITORY
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'repository-add' : self.row_add,
|
||||
@ -104,14 +103,15 @@ class RepositoryView(ListView):
|
||||
RepositoryView.COLUMN_NAMES, len(RepositoryView.COLUMN_NAMES),
|
||||
RepositoryModel, signal_map,
|
||||
dbstate.db.get_repo_bookmarks(),
|
||||
Bookmarks.RepoBookmarks, multiple=True,
|
||||
Bookmarks.RepoBookmarks, nav_group,
|
||||
multiple=True,
|
||||
filter_class=RepoSidebarFilter)
|
||||
|
||||
config.connect("interface.filter",
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_REPOSITORY
|
||||
return 'Repository'
|
||||
|
||||
def column_ord_setfunc(self, clist):
|
||||
self.dbstate.db.set_repository_column_order(clist)
|
||||
@ -163,6 +163,12 @@ class RepositoryView(ListView):
|
||||
<menuitem action="EditBook"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="EditMenu">
|
||||
<placeholder name="CommonEdit">
|
||||
<menuitem action="Add"/>
|
||||
@ -174,6 +180,10 @@ class RepositoryView(ListView):
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
</placeholder>
|
||||
<placeholder name="CommonEdit">
|
||||
<toolitem action="Add"/>
|
||||
<toolitem action="Edit"/>
|
||||
@ -181,6 +191,9 @@ class RepositoryView(ListView):
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="Add"/>
|
||||
<menuitem action="Edit"/>
|
||||
<menuitem action="Remove"/>
|
||||
|
@ -38,7 +38,6 @@ 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
|
||||
@ -80,7 +79,7 @@ class SourceView(ListView):
|
||||
FILTER_TYPE = "Source"
|
||||
QR_CATEGORY = CATEGORY_QR_SOURCE
|
||||
|
||||
def __init__(self, dbstate, uistate):
|
||||
def __init__(self, dbstate, uistate, nav_group=0):
|
||||
|
||||
signal_map = {
|
||||
'source-add' : self.row_add,
|
||||
@ -99,14 +98,15 @@ class SourceView(ListView):
|
||||
SourceView.COLUMN_NAMES, len(SourceView.COLUMN_NAMES),
|
||||
SourceModel, signal_map,
|
||||
dbstate.db.get_source_bookmarks(),
|
||||
Bookmarks.SourceBookmarks, multiple=True,
|
||||
Bookmarks.SourceBookmarks, nav_group,
|
||||
multiple=True,
|
||||
filter_class=SourceSidebarFilter)
|
||||
|
||||
config.connect("interface.filter",
|
||||
self.filter_toggle)
|
||||
|
||||
def navigation_type(self):
|
||||
return NAVIGATION_SOURCE
|
||||
return 'Source'
|
||||
|
||||
def column_ord_setfunc(self, clist):
|
||||
self.dbstate.db.set_source_column_order(clist)
|
||||
@ -158,6 +158,12 @@ class SourceView(ListView):
|
||||
<menuitem action="EditBook"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="GoMenu">
|
||||
<placeholder name="CommonGo">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
</placeholder>
|
||||
</menu>
|
||||
<menu action="EditMenu">
|
||||
<placeholder name="CommonEdit">
|
||||
<menuitem action="Add"/>
|
||||
@ -172,6 +178,10 @@ class SourceView(ListView):
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar name="ToolBar">
|
||||
<placeholder name="CommonNavigation">
|
||||
<toolitem action="Back"/>
|
||||
<toolitem action="Forward"/>
|
||||
</placeholder>
|
||||
<placeholder name="CommonEdit">
|
||||
<toolitem action="Add"/>
|
||||
<toolitem action="Edit"/>
|
||||
@ -179,6 +189,9 @@ class SourceView(ListView):
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
<menuitem action="Back"/>
|
||||
<menuitem action="Forward"/>
|
||||
<separator/>
|
||||
<menuitem action="Add"/>
|
||||
<menuitem action="Edit"/>
|
||||
<menuitem action="Remove"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user