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:
Benny Malengier 2008-01-17 23:15:08 +00:00
parent 65141d25ac
commit 01460af4ef
5 changed files with 184 additions and 49 deletions

View File

@ -1,3 +1,8 @@
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
2008-01-17 Benny Malengier <benny.malengier@gramps-project.org> 2008-01-17 Benny Malengier <benny.malengier@gramps-project.org>
* src/Editors/_EditChildRef.py: set focus on OK button for quick work * src/Editors/_EditChildRef.py: set focus on OK button for quick work

View File

@ -37,7 +37,7 @@ from gettext import gettext as _
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk.glade import gtk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -47,9 +47,20 @@ import gtk.glade
import const import const
from _EditSecondary import EditSecondary from _EditSecondary import EditSecondary
from gen.lib import NoteType from gen.lib import NoteType
import Errors
from DisplayTabs import SourceEmbedList, NoteTab 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, self.name,
_('Child Reference Editor')) _('Child Reference Editor'))
self.ok_button = self.top.get_widget('ok') 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): def _setup_fields(self):
@ -106,6 +120,9 @@ class EditChildRef(EditSecondary):
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.ok_button, self.save) 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): def _create_tabbed_pages(self):
""" """
@ -135,6 +152,27 @@ class EditChildRef(EditSecondary):
def build_menu_names(self,obj): def build_menu_names(self,obj):
return (_('Child Reference'),_('Child Reference Editor')) 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): def save(self,*obj):
""" """
Called when the OK button is pressed. Gets data from the Called when the OK button is pressed. Gets data from the

View File

@ -80,7 +80,7 @@ class ChildEmbedList(EmbeddedList):
_MSG = { _MSG = {
'add' : _('Create a new person and add the child to the family'), 'add' : _('Create a new person and add the child to the family'),
'del' : _('Remove the child from 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'), 'share' : _('Add an existing person as a child of the family'),
'up' : _('Move the child up in the childrens list'), 'up' : _('Move the child up in the childrens list'),
'down' : _('Move the child down 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(): for ref in self.family.get_child_ref_list():
if ref.ref == handle: if ref.ref == handle:
p = self.dbstate.db.get_person_from_handle(handle) p = self.dbstate.db.get_person_from_handle(handle)
try:
EditPerson(self.dbstate, self.uistate, self.track, EditPerson(self.dbstate, self.uistate, self.track,
p, self.child_ref_edited) p, self.child_ref_edited)
except Errors.WindowActiveError:
pass
break break
def up_button_clicked(self, obj): def up_button_clicked(self, obj):

View File

@ -353,6 +353,9 @@ class EditNote(EditPrimary):
""" """
return (_('Edit Note'), self.get_menu_title()) return (_('Edit Note'), self.get_menu_title())
def _post_init(self):
self.text.grab_focus()
def on_textview_key_press_event(self, textview, event): def on_textview_key_press_event(self, textview, event):
"""Handle shortcuts in the TextView.""" """Handle shortcuts in the TextView."""
return textview.get_buffer().on_key_press_event(textview, event) return textview.get_buffer().on_key_press_event(textview, event)

View File

@ -14078,41 +14078,12 @@ Very High</property>
<widget class="GtkTable" id="table74"> <widget class="GtkTable" id="table74">
<property name="border_width">12</property> <property name="border_width">12</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="n_rows">2</property> <property name="n_rows">3</property>
<property name="n_columns">7</property> <property name="n_columns">7</property>
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label652">
<property name="visible">True</property>
<property name="label" translatable="yes">Relationship to _Father:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">frel</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label653"> <widget class="GtkLabel" id="label653">
<property name="visible">True</property> <property name="visible">True</property>
@ -14132,6 +14103,52 @@ Very High</property>
<property name="single_line_mode">False</property> <property name="single_line_mode">False</property>
<property name="angle">0</property> <property name="angle">0</property>
</widget> </widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="mrel">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="has_frame">True</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">6</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label652">
<property name="visible">True</property>
<property name="label" translatable="yes">Relationship to _Father:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">frel</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="right_attach">1</property> <property name="right_attach">1</property>
@ -14142,6 +14159,22 @@ Very High</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkComboBoxEntry" id="frel">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="has_frame">True</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">6</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">fill</property>
</packing>
</child>
<child> <child>
<widget class="GtkToggleButton" id="private"> <widget class="GtkToggleButton" id="private">
<property name="visible">True</property> <property name="visible">True</property>
@ -14166,43 +14199,96 @@ Very High</property>
<packing> <packing>
<property name="left_attach">6</property> <property name="left_attach">6</property>
<property name="right_attach">7</property> <property name="right_attach">7</property>
<property name="top_attach">1</property> <property name="top_attach">2</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">3</property>
<property name="x_options"></property> <property name="x_options"></property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkComboBoxEntry" id="frel"> <widget class="GtkLabel" id="label716">
<property name="visible">True</property> <property name="visible">True</property>
<property name="add_tearoffs">False</property> <property name="label" translatable="yes">Name Child:</property>
<property name="has_frame">True</property> <property name="use_underline">False</property>
<property name="focus_on_click">True</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="name">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">6</property> <property name="right_attach">6</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="bottom_attach">1</property> <property name="bottom_attach">1</property>
<property name="y_options">fill</property> <property name="x_options">fill</property>
<property name="y_options"></property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkComboBoxEntry" id="mrel"> <widget class="GtkButton" id="edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="add_tearoffs">False</property> <property name="tooltip" translatable="yes">Open person editor of this child</property>
<property name="has_frame">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property> <property name="focus_on_click">True</property>
<child>
<widget class="GtkImage" id="image2722">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">6</property>
<property name="right_attach">6</property> <property name="right_attach">7</property>
<property name="top_attach">1</property> <property name="top_attach">0</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">1</property>
<property name="x_options">fill</property> <property name="x_options">fill</property>
<property name="y_options">fill</property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
</widget> </widget>