improve tab movement on surname table

svn: r16002
This commit is contained in:
Benny Malengier 2010-10-16 08:06:14 +00:00
parent 90379b7b42
commit 4e595d0cf3
2 changed files with 30 additions and 8 deletions

View File

@ -195,6 +195,8 @@
<object class="UndoableEntry" id="given_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="tooltip_text" translatable="yes">The person's given names</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="focus_out_event" handler="on_given_focus_out"/>
@ -802,7 +804,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Accept changes and close window</property>
<property name="use_stock">True</property>

View File

@ -77,6 +77,7 @@ class SurnameTab(EmbeddedList):
self.obj = name
self.curr_col = -1
self.curr_cellr = None
self.curr_celle = None
EmbeddedList.__init__(self, dbstate, uistate, track, _('Family Surnames'),
SurnameModel, move_buttons=True)
@ -147,9 +148,10 @@ class SurnameTab(EmbeddedList):
self.model.remove(node)
self.update()
def edit_start(self, cellr, obj, path, colnr):
def edit_start(self, cellr, celle, path, colnr):
self.curr_col = colnr
self.curr_cellr = cellr
self.curr_celle = celle
def edit_inline(self, cell, path, new_text, colnr):
node = self.model.get_iter(path)
@ -178,8 +180,6 @@ class SurnameTab(EmbeddedList):
self.prev_cell()
else:
return
elif event.type == gtk.gdk.KEY_PRESS and event.keyval in (_ENTER,):
self.next_cell()
else:
return
return True
@ -188,7 +188,6 @@ class SurnameTab(EmbeddedList):
"""
Move to the next cell to edit it
"""
print 'captured tab'
(model, node) = self.selection.get_selected()
if node:
path = self.model.get_path(node)
@ -208,7 +207,29 @@ class SurnameTab(EmbeddedList):
start_editing=True)
else:
#stop editing
self.curr_cellr.stop_editing(True)
self.curr_celle.editing_done()
def prev_cell(self):
print 'captured tab prev'
"""
Move to the next cell to edit it
"""
(model, node) = self.selection.get_selected()
if node:
path = self.model.get_path(node)
if self.curr_col > 0:
self.tree.set_cursor_on_cell(path,
focus_column=self.columns[self.curr_col-1],
focus_cell=None,
start_editing=True)
elif self.curr_col == 0:
#go to prev line if there is one
if path[0] > 0:
newpath = (path[0]-1,)
self.selection.select_path(newpath)
self.tree.set_cursor_on_cell(newpath,
focus_column=self.columns[-1],
focus_cell=None,
start_editing=True)
else:
#stop editing
self.curr_celle.editing_done()