2008-01-18 Benny Malengier <benny.malengier@gramps-project.org>
* src/Editors/_EditNote.py: focus on text field on start * src/Editors/_EditChildRef.py: add usability: name of child, edit btn * src/Editors/_EditFamily.py: grab Errors.WindowActiveError * src/glade/gramps.glade: add usability to childref, see #1462 svn: r9873
This commit is contained in:
@@ -37,7 +37,7 @@ from gettext import gettext as _
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk.glade
|
||||
import gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -47,9 +47,20 @@ import gtk.glade
|
||||
import const
|
||||
from _EditSecondary import EditSecondary
|
||||
from gen.lib import NoteType
|
||||
import Errors
|
||||
|
||||
from DisplayTabs import SourceEmbedList, NoteTab
|
||||
from GrampsWidgets import *
|
||||
from GrampsWidgets import MonitoredDataType, PrivacyButton
|
||||
from BasicUtils import name_displayer
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
_RETURN = gtk.gdk.keyval_from_name("Return")
|
||||
_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -78,6 +89,9 @@ class EditChildRef(EditSecondary):
|
||||
self.name,
|
||||
_('Child Reference Editor'))
|
||||
self.ok_button = self.top.get_widget('ok')
|
||||
self.edit_button = self.top.get_widget('edit')
|
||||
self.name_label = self.top.get_widget('name')
|
||||
self.name_label.set_text(self.name)
|
||||
|
||||
def _setup_fields(self):
|
||||
|
||||
@@ -106,6 +120,9 @@ class EditChildRef(EditSecondary):
|
||||
self.define_help_button(self.top.get_widget('help'), 'adv-ad')
|
||||
self.define_cancel_button(self.top.get_widget('cancel'))
|
||||
self.define_ok_button(self.ok_button, self.save)
|
||||
self.edit_button.connect('button-press-event', self.edit_child)
|
||||
self.edit_button.connect('key-press-event', self.edit_child)
|
||||
self._add_db_signal('person-update', self.person_change)
|
||||
|
||||
def _create_tabbed_pages(self):
|
||||
"""
|
||||
@@ -135,6 +152,27 @@ class EditChildRef(EditSecondary):
|
||||
def build_menu_names(self,obj):
|
||||
return (_('Child Reference'),_('Child Reference Editor'))
|
||||
|
||||
def edit_child(self,obj,event):
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1 \
|
||||
or event.keyval in (_RETURN, _KP_ENTER):
|
||||
from _EditPerson import EditPerson
|
||||
handle = self.obj.ref
|
||||
try:
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
EditPerson(self.dbstate, self.uistate,
|
||||
self.track, person)
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
|
||||
def person_change(self, handles):
|
||||
# check to see if the handle matches the current object
|
||||
print handles
|
||||
if self.obj.ref in handles:
|
||||
p = self.dbstate.db.get_person_from_handle(self.obj.ref)
|
||||
self.name = name_displayer.display(p)
|
||||
print 'changed label'
|
||||
self.name_label.set_text(self.name)
|
||||
|
||||
def save(self,*obj):
|
||||
"""
|
||||
Called when the OK button is pressed. Gets data from the
|
||||
|
@@ -80,7 +80,7 @@ class ChildEmbedList(EmbeddedList):
|
||||
_MSG = {
|
||||
'add' : _('Create a new person and add the child to the family'),
|
||||
'del' : _('Remove the child from the family'),
|
||||
'edit' : _('Edit the child'),
|
||||
'edit' : _('Edit the child reference'),
|
||||
'share' : _('Add an existing person as a child of the family'),
|
||||
'up' : _('Move the child up in the childrens list'),
|
||||
'down' : _('Move the child down in the childrens list'),
|
||||
@@ -277,8 +277,11 @@ class ChildEmbedList(EmbeddedList):
|
||||
for ref in self.family.get_child_ref_list():
|
||||
if ref.ref == handle:
|
||||
p = self.dbstate.db.get_person_from_handle(handle)
|
||||
EditPerson(self.dbstate, self.uistate, self.track,
|
||||
try:
|
||||
EditPerson(self.dbstate, self.uistate, self.track,
|
||||
p, self.child_ref_edited)
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
break
|
||||
|
||||
def up_button_clicked(self, obj):
|
||||
|
@@ -353,6 +353,9 @@ class EditNote(EditPrimary):
|
||||
"""
|
||||
return (_('Edit Note'), self.get_menu_title())
|
||||
|
||||
def _post_init(self):
|
||||
self.text.grab_focus()
|
||||
|
||||
def on_textview_key_press_event(self, textview, event):
|
||||
"""Handle shortcuts in the TextView."""
|
||||
return textview.get_buffer().on_key_press_event(textview, event)
|
||||
|
Reference in New Issue
Block a user