From cbe3804391bb464b91f3b441eff6a9cc4c2921c1 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 26 Jan 2007 00:15:21 +0000 Subject: [PATCH] 2007-01-25 Don Allingham * src/DataViews/_MediaView.py: fix goto-gramps-id key press * src/DataViews/_RepositoryView.py: fix goto-gramps-id key press * src/DataViews/_SourceView.py: fix goto-gramps-id key press * src/DataViews/_EventView.py: fix goto-gramps-id key press * src/DataViews/_FamilyList.py: fix goto-gramps-id key press * src/DataViews/_PedigreeView.py: fix goto-gramps-id key press * src/DataViews/_PlaceView.py: fix goto-gramps-id key press * src/DataViews/_PersonView.py: fix goto-gramps-id key press * src/DataViews/_RelationView.py: fix goto-gramps-id key press * src/ViewManager.py: fix goto-gramps-id key press * src/PageView.py: fix goto-gramps-id key press svn: r7984 --- ChangeLog | 13 ++++++++++++ src/DataViews/_EventView.py | 11 +++++++++++ src/DataViews/_FamilyList.py | 11 +++++++++++ src/DataViews/_MediaView.py | 11 +++++++++++ src/DataViews/_PedigreeView.py | 4 ++++ src/DataViews/_PersonView.py | 3 +-- src/DataViews/_PlaceView.py | 11 +++++++++++ src/DataViews/_RelationView.py | 4 ++++ src/DataViews/_RepositoryView.py | 11 +++++++++++ src/DataViews/_SourceView.py | 10 ++++++++++ src/PageView.py | 34 ++++++++++++++++++++++++++++++-- src/ViewManager.py | 2 ++ 12 files changed, 121 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91dba7081..b392b256d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-01-25 Don Allingham + * src/DataViews/_MediaView.py: fix goto-gramps-id key press + * src/DataViews/_RepositoryView.py: fix goto-gramps-id key press + * src/DataViews/_SourceView.py: fix goto-gramps-id key press + * src/DataViews/_EventView.py: fix goto-gramps-id key press + * src/DataViews/_FamilyList.py: fix goto-gramps-id key press + * src/DataViews/_PedigreeView.py: fix goto-gramps-id key press + * src/DataViews/_PlaceView.py: fix goto-gramps-id key press + * src/DataViews/_PersonView.py: fix goto-gramps-id key press + * src/DataViews/_RelationView.py: fix goto-gramps-id key press + * src/ViewManager.py: fix goto-gramps-id key press + * src/PageView.py: fix goto-gramps-id key press + 2007-01-25 Alex Roitman * src/GrampsDb/_GrampsDbBase.py (find_backlink_handles): Correctly iterate only over requested tables; don't mix up the primary and diff --git a/src/DataViews/_EventView.py b/src/DataViews/_EventView.py index f16a392a6..2db148da8 100644 --- a/src/DataViews/_EventView.py +++ b/src/DataViews/_EventView.py @@ -86,6 +86,10 @@ class EventView(PageView.ListView): 'event-rebuild' : self.build_tree, } + self.func_list = { + 'J' : self.jump, + } + PageView.ListView.__init__( self, _('Events'), dbstate, uistate, column_names, len(column_names), DisplayModels.EventModel, @@ -160,6 +164,13 @@ class EventView(PageView.ListView): self.add_action('FilterEdit', None, _('Event Filter Editor'), callback=self.filter_editor,) + def get_handle_from_gramps_id(self, gid): + obj = self.dbstate.db.get_event_from_gramps_id(gid) + if obj: + return obj.get_handle() + else: + return None + def column_editor(self, obj): import ColumnOrder diff --git a/src/DataViews/_FamilyList.py b/src/DataViews/_FamilyList.py index 1b775dd27..8d64b2e08 100644 --- a/src/DataViews/_FamilyList.py +++ b/src/DataViews/_FamilyList.py @@ -76,6 +76,10 @@ class FamilyListView(PageView.ListView): 'family-rebuild' : self.build_tree, } + self.func_list = { + 'J' : self.jump, + } + PageView.ListView.__init__( self, _('Family List'), dbstate, uistate, column_names, len(column_names), DisplayModels.FamilyModel, @@ -199,3 +203,10 @@ class FamilyListView(PageView.ListView): EditFamily(self.dbstate, self.uistate, [], family) except Errors.WindowActiveError: pass + + def get_handle_from_gramps_id(self, gid): + obj = self.dbstate.db.get_family_from_gramps_id(gid) + if obj: + return obj.get_handle() + else: + return None diff --git a/src/DataViews/_MediaView.py b/src/DataViews/_MediaView.py index 68ea4951e..1649fc582 100644 --- a/src/DataViews/_MediaView.py +++ b/src/DataViews/_MediaView.py @@ -102,6 +102,10 @@ class MediaView(PageView.ListView): signal_map, dbstate.db.get_media_bookmarks(), Bookmarks.MediaBookmarks, filter_class=MediaSidebarFilter) + self.func_list = { + 'J' : self.jump, + } + Config.client.notify_add("/apps/gramps/interface/filter", self.filter_toggle) @@ -343,3 +347,10 @@ class MediaView(PageView.ListView): EditMedia(self.dbstate, self.uistate, [], obj) except Errors.WindowActiveError: pass + + def get_handle_from_gramps_id(self, gid): + obj = self.dbstate.db.get_object_from_gramps_id(gid) + if obj: + return obj.get_handle() + else: + return None diff --git a/src/DataViews/_PedigreeView.py b/src/DataViews/_PedigreeView.py index ab09eb85e..bbfb4a38e 100644 --- a/src/DataViews/_PedigreeView.py +++ b/src/DataViews/_PedigreeView.py @@ -455,6 +455,10 @@ class PedigreeView(PageView.PersonNavView): def __init__(self,dbstate,uistate): PageView.PersonNavView.__init__(self, _('Pedigree'), dbstate, uistate) + self.func_list = { + 'J' : self.jump, + } + self.dbstate = dbstate self.dbstate.connect('database-changed',self.change_db) #self.dbstate.connect('active-changed',self.goto_active_person) diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 37e78e935..00e17df07 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -103,6 +103,7 @@ class PersonView(PageView.PersonNavView): self.func_list = { 'F2' : self.key_goto_home_person, 'F3' : self.key_edit_selected_person, + 'J' : self.jump, } self.dirty = True @@ -151,7 +152,6 @@ class PersonView(PageView.PersonNavView): _("Edit the selected person"), self.edit), ('CloseAllNodes', None, _("Collapse all nodes"), None, None, self.close_all_nodes), - ('Jump', None, _("_Jump"),"j", None, self.jumpto), ]) self.edit_action.add_actions( @@ -348,7 +348,6 @@ class PersonView(PageView.PersonNavView): associated with the interface. """ return ''' - diff --git a/src/DataViews/_PlaceView.py b/src/DataViews/_PlaceView.py index 84bf2d3ee..48d397c89 100644 --- a/src/DataViews/_PlaceView.py +++ b/src/DataViews/_PlaceView.py @@ -93,6 +93,10 @@ class PlaceView(PageView.ListView): 'place-rebuild' : self.build_tree, } + self.func_list = { + 'J' : self.jump, + } + PageView.ListView.__init__( self, _('Places'), dbstate, uistate, column_names, len(column_names), DisplayModels.PlaceModel, signal_map, @@ -280,3 +284,10 @@ class PlaceView(PageView.ListView): else: import Merge Merge.MergePlaces(self.dbstate, self.uistate, mlist[0], mlist[1]) + + def get_handle_from_gramps_id(self, gid): + obj = self.dbstate.db.get_place_from_gramps_id(gid) + if obj: + return obj.get_handle() + else: + return None diff --git a/src/DataViews/_RelationView.py b/src/DataViews/_RelationView.py index e7cf6656a..eddc41f96 100644 --- a/src/DataViews/_RelationView.py +++ b/src/DataViews/_RelationView.py @@ -117,6 +117,10 @@ class RelationshipView(PageView.PersonNavView): PageView.PersonNavView.__init__( self, _('Relationships'), dbstate, uistate) + self.func_list = { + 'J' : self.jump, + } + dbstate.connect('database-changed', self.change_db) self.show_siblings = Config.get(Config.FAMILY_SIBLINGS) self.show_details = Config.get(Config.FAMILY_DETAILS) diff --git a/src/DataViews/_RepositoryView.py b/src/DataViews/_RepositoryView.py index 20aad55c1..00ac340ed 100644 --- a/src/DataViews/_RepositoryView.py +++ b/src/DataViews/_RepositoryView.py @@ -94,6 +94,10 @@ class RepositoryView(PageView.ListView): 'repository-rebuild' : self.build_tree, } + self.func_list = { + 'J' : self.jump, + } + PageView.ListView.__init__( self, _('Repositories'), dbstate, uistate, column_names, len(column_names), @@ -220,3 +224,10 @@ class RepositoryView(PageView.ListView): EditRepository(self.dbstate, self.uistate, [], repos) except Errors.WindowActiveError: pass + + def get_handle_from_gramps_id(self, gid): + obj = self.dbstate.db.get_repository_from_gramps_id(gid) + if obj: + return obj.get_handle() + else: + return None diff --git a/src/DataViews/_SourceView.py b/src/DataViews/_SourceView.py index 509ddb08c..3b8360f27 100644 --- a/src/DataViews/_SourceView.py +++ b/src/DataViews/_SourceView.py @@ -87,6 +87,10 @@ class SourceView(PageView.ListView): 'source-rebuild' : self.build_tree, } + self.func_list = { + 'J' : self.jump, + } + PageView.ListView.__init__( self, _('Sources'), dbstate, uistate, column_names, len(column_names), DisplayModels.SourceModel, signal_map, @@ -230,3 +234,9 @@ class SourceView(PageView.ListView): import Merge Merge.MergeSources(self.dbstate, self.uistate, mlist[0], mlist[1]) + def get_handle_from_gramps_id(self, gid): + obj = self.dbstate.db.get_source_from_gramps_id(gid) + if obj: + return obj.get_handle() + else: + return None diff --git a/src/PageView.py b/src/PageView.py index b7657fb42..9b336a693 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -79,7 +79,6 @@ class PageView: self.active = False self.handle_col = 0 self.selection = None - self.func_list = {} def call_function(self, key): self.func_list.get(key)() @@ -341,7 +340,7 @@ class PersonNavView(BookMarkView): if defperson: self.dbstate.change_active_person(defperson) - def jumpto(self,obj): + def jump(self): dialog = gtk.Dialog(_('Jump to by GRAMPS ID'),None, gtk.DIALOG_NO_SEPARATOR) dialog.set_border_width(12) @@ -515,6 +514,37 @@ class ListView(BookMarkView): _("A bookmark could not be set because " "nothing was selected.")) + def jump(self): + dialog = gtk.Dialog(_('Jump to by GRAMPS ID'),None, + gtk.DIALOG_NO_SEPARATOR) + dialog.set_border_width(12) + label = gtk.Label('%s' % _('Jump to by GRAMPS ID')) + label.set_use_markup(True) + dialog.vbox.add(label) + dialog.vbox.set_spacing(10) + dialog.vbox.set_border_width(12) + hbox = gtk.HBox() + hbox.pack_start(gtk.Label("%s: " % _('ID')),False) + text = gtk.Entry() + text.set_activates_default(True) + hbox.pack_start(text,False) + dialog.vbox.pack_start(hbox,False) + dialog.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, + gtk.STOCK_JUMP_TO, gtk.RESPONSE_OK) + dialog.set_default_response(gtk.RESPONSE_OK) + dialog.vbox.show_all() + + if dialog.run() == gtk.RESPONSE_OK: + gid = text.get_text() + handle = self.get_handle_from_gramps_id(gid) + if handle: + self.goto_handle(handle) + else: + self.uistate.push_message( + self.dbstate, + _("Error: %s is not a valid GRAMPS ID") % gid) + dialog.destroy() + def drag_info(self): return None diff --git a/src/ViewManager.py b/src/ViewManager.py index 248e37097..090f96a71 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -178,6 +178,7 @@ uidefault = ''' + @@ -368,6 +369,7 @@ class ViewManager: ('F9', None, 'F9', "F9", None, self.keypress), ('F11', None, 'F11', "F11", None, self.keypress), ('F12', None, 'F12', "F12", None, self.keypress), + ('J', None, 'J', "J", None, self.keypress), ('N', None, 'N', "N", None, self.next_view), ('P', None, 'P', "P", None, self.prev_view), ]