2008-01-17 Benny Malengier <benny.malengier@gramps-project.org>

* src/Editors/_EditChildRef.py: set focus on OK button for quick work
	* src/Editors/_EditFamily.py: double click on child, adding child
               choosing existing child, brings up child ref editor, #1462



svn: r9872
This commit is contained in:
Benny Malengier 2008-01-17 21:52:13 +00:00
parent 2fe1963bc3
commit 65141d25ac
3 changed files with 32 additions and 17 deletions

View File

@ -1,3 +1,9 @@
2008-01-17 Benny Malengier <benny.malengier@gramps-project.org>
* src/Editors/_EditChildRef.py: set focus on OK button for quick work
* src/Editors/_EditFamily.py: double click on child, adding child
choosing existing child, brings up child ref editor, #1462
2008-01-17 Raphael Ackermann <raphael.ackermann@gmail.com> 2008-01-17 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/ScratchPad.py: remove tooltip for events as it crashes. * src/ScratchPad.py: remove tooltip for events as it crashes.
* src/Utils.py: cleanup * src/Utils.py: cleanup

View File

@ -77,6 +77,7 @@ class EditChildRef(EditSecondary):
self.top.get_widget("title"), self.top.get_widget("title"),
self.name, self.name,
_('Child Reference Editor')) _('Child Reference Editor'))
self.ok_button = self.top.get_widget('ok')
def _setup_fields(self): def _setup_fields(self):
@ -102,9 +103,9 @@ class EditChildRef(EditSecondary):
self.db.readonly) self.db.readonly)
def _connect_signals(self): def _connect_signals(self):
self.define_help_button(self.top.get_widget('help'),'adv-ad') self.define_help_button(self.top.get_widget('help'), 'adv-ad')
self.define_cancel_button(self.top.get_widget('cancel')) self.define_cancel_button(self.top.get_widget('cancel'))
self.define_ok_button(self.top.get_widget('ok'),self.save) self.define_ok_button(self.ok_button, self.save)
def _create_tabbed_pages(self): def _create_tabbed_pages(self):
""" """
@ -128,6 +129,9 @@ class EditChildRef(EditSecondary):
notebook.show_all() notebook.show_all()
self.top.get_widget('vbox').pack_start(notebook,True) self.top.get_widget('vbox').pack_start(notebook,True)
def _post_init(self):
self.ok_button.grab_focus()
def build_menu_names(self,obj): def build_menu_names(self,obj):
return (_('Child Reference'),_('Child Reference Editor')) return (_('Child Reference'),_('Child Reference Editor'))

View File

@ -111,8 +111,8 @@ class ChildEmbedList(EmbeddedList):
return [ return [
(True, True, gtk.STOCK_ADD, self.add_button_clicked), (True, True, gtk.STOCK_ADD, self.add_button_clicked),
(True, False, _('Add an existing child'), self.share_button_clicked), (True, False, _('Add an existing child'), self.share_button_clicked),
(False,True, _('Edit relationship'), self.edit_relation_button_clicked), (False,True, _('Edit relationship'), self.edit_button_clicked),
(False,True, _('Edit child'), self.edit_button_clicked), (False,True, _('Edit child'), self.edit_child_button_clicked),
(True, True, gtk.STOCK_REMOVE, self.del_button_clicked), (True, True, gtk.STOCK_REMOVE, self.del_button_clicked),
] ]
@ -214,6 +214,7 @@ class ChildEmbedList(EmbeddedList):
ref.ref = person.get_handle() ref.ref = person.get_handle()
self.family.add_child_ref(ref) self.family.add_child_ref(ref)
self.rebuild() self.rebuild()
self.call_edit_childref(ref.ref)
def child_ref_edited(self, person): def child_ref_edited(self, person):
self.rebuild() self.rebuild()
@ -234,6 +235,7 @@ class ChildEmbedList(EmbeddedList):
ref.ref = person.get_handle() ref.ref = person.get_handle()
self.family.add_child_ref(ref) self.family.add_child_ref(ref)
self.rebuild() self.rebuild()
self.call_edit_childref(ref.ref)
def run(self,skip): def run(self,skip):
skip_list = [ x for x in skip if x] skip_list = [ x for x in skip if x]
@ -248,23 +250,26 @@ class ChildEmbedList(EmbeddedList):
self.family.remove_child_ref(ref) self.family.remove_child_ref(ref)
self.rebuild() self.rebuild()
def edit_relation_button_clicked(self,obj): def edit_button_clicked(self,obj):
handle = self.get_selected() handle = self.get_selected()
if handle: if handle:
from Editors import EditChildRef self.call_edit_childref(handle)
for ref in self.family.get_child_ref_list(): def call_edit_childref(self, handle):
if ref.ref == handle: from Editors import EditChildRef
p = self.dbstate.db.get_person_from_handle(handle)
n = name_displayer.display(p)
try:
EditChildRef(n, self.dbstate, self.uistate, self.track,
ref, self.child_ref_edited)
except Errors.WindowActiveError:
pass
break
def edit_button_clicked(self, obj): for ref in self.family.get_child_ref_list():
if ref.ref == handle:
p = self.dbstate.db.get_person_from_handle(handle)
n = name_displayer.display(p)
try:
EditChildRef(n, self.dbstate, self.uistate, self.track,
ref, self.child_ref_edited)
except Errors.WindowActiveError:
pass
break
def edit_child_button_clicked(self, obj):
handle = self.get_selected() handle = self.get_selected()
if handle: if handle:
from Editors import EditPerson from Editors import EditPerson