2007-01-25 Don Allingham <don@gramps-project.org>

* 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
This commit is contained in:
Don Allingham 2007-01-26 00:15:21 +00:00
parent c51d3d8119
commit e8f9d33e9e
12 changed files with 121 additions and 4 deletions

View File

@ -1,3 +1,16 @@
2007-01-25 Don Allingham <don@gramps-project.org>
* 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 <shura@gramps-project.org>
* src/GrampsDb/_GrampsDbBase.py (find_backlink_handles): Correctly
iterate only over requested tables; don't mix up the primary and

View File

@ -86,6 +86,10 @@ class EventView(PageView.ListView):
'event-rebuild' : self.build_tree,
}
self.func_list = {
'<CONTROL>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

View File

@ -76,6 +76,10 @@ class FamilyListView(PageView.ListView):
'family-rebuild' : self.build_tree,
}
self.func_list = {
'<CONTROL>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

View File

@ -102,6 +102,10 @@ class MediaView(PageView.ListView):
signal_map, dbstate.db.get_media_bookmarks(),
Bookmarks.MediaBookmarks, filter_class=MediaSidebarFilter)
self.func_list = {
'<CONTROL>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

View File

@ -455,6 +455,10 @@ class PedigreeView(PageView.PersonNavView):
def __init__(self,dbstate,uistate):
PageView.PersonNavView.__init__(self, _('Pedigree'), dbstate, uistate)
self.func_list = {
'<CONTROL>J' : self.jump,
}
self.dbstate = dbstate
self.dbstate.connect('database-changed',self.change_db)
#self.dbstate.connect('active-changed',self.goto_active_person)

View File

@ -103,6 +103,7 @@ class PersonView(PageView.PersonNavView):
self.func_list = {
'F2' : self.key_goto_home_person,
'F3' : self.key_edit_selected_person,
'<CONTROL>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"),"<control>j", None, self.jumpto),
])
self.edit_action.add_actions(
@ -348,7 +348,6 @@ class PersonView(PageView.PersonNavView):
associated with the interface.
"""
return '''<ui>
<accelerator action="Jump"/>
<menubar name="MenuBar">
<menu action="BookMenu">
<placeholder name="AddEditBook">

View File

@ -93,6 +93,10 @@ class PlaceView(PageView.ListView):
'place-rebuild' : self.build_tree,
}
self.func_list = {
'<CONTROL>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

View File

@ -117,6 +117,10 @@ class RelationshipView(PageView.PersonNavView):
PageView.PersonNavView.__init__(
self, _('Relationships'), dbstate, uistate)
self.func_list = {
'<CONTROL>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)

View File

@ -94,6 +94,10 @@ class RepositoryView(PageView.ListView):
'repository-rebuild' : self.build_tree,
}
self.func_list = {
'<CONTROL>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

View File

@ -87,6 +87,10 @@ class SourceView(PageView.ListView):
'source-rebuild' : self.build_tree,
}
self.func_list = {
'<CONTROL>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

View File

@ -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('<span weight="bold" size="larger">%s</span>' % _('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

View File

@ -178,6 +178,7 @@ uidefault = '''<ui>
<accelerator action="F9"/>
<accelerator action="F11"/>
<accelerator action="F12"/>
<accelerator action="<CONTROL>J"/>
<accelerator action="<Alt>N"/>
<accelerator action="<Alt>P"/>
</ui>
@ -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),
('<CONTROL>J', None, '<CONTROL>J', "<CONTROL>J", None, self.keypress),
('<Alt>N', None, '<Alt>N', "<Alt>N", None, self.next_view),
('<Alt>P', None, '<Alt>P', "<Alt>P", None, self.prev_view),
]