Extend history functionality (back/forward) and active-changed signals to all primary objects
svn: r14023
This commit is contained in:
@@ -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)
|
||||
|
||||
+46
-43
@@ -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"/>
|
||||
|
||||
Reference in New Issue
Block a user