5349: Filter and "Quick Filter" are not applied when you press [Enter]
svn: r18585
This commit is contained in:
parent
7d5eebfebc
commit
13f3afe9aa
@ -127,7 +127,7 @@ class SidebarFilter(DbGUIElement):
|
||||
widget.set_tooltip_text(tooltip)
|
||||
|
||||
def key_press(self, obj, event):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK,):
|
||||
if not (event.state & gtk.gdk.CONTROL_MASK):
|
||||
if event.keyval in (_RETURN, _KP_ENTER):
|
||||
self.clicked(obj)
|
||||
return False
|
||||
|
@ -138,7 +138,7 @@ class SearchBar(object):
|
||||
self.clear_button.set_sensitive(True)
|
||||
|
||||
def key_press(self, obj, event):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK,):
|
||||
if not (event.state & gtk.gdk.CONTROL_MASK):
|
||||
if event.keyval in (_RETURN, _KP_ENTER):
|
||||
self.filter_button.set_sensitive(False)
|
||||
self.clear_button.set_sensitive(True)
|
||||
|
@ -184,11 +184,10 @@ class DbManager(CLIDbManager):
|
||||
Grab ENTER so it does not start editing the cell, but behaves
|
||||
like double click instead
|
||||
"""
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK,):
|
||||
if event.keyval in (_RETURN, _KP_ENTER):
|
||||
if self.connect.get_property('sensitive'):
|
||||
self.top.response(gtk.RESPONSE_OK)
|
||||
return True
|
||||
if event.keyval in (_RETURN, _KP_ENTER):
|
||||
if self.connect.get_property('sensitive'):
|
||||
self.top.response(gtk.RESPONSE_OK)
|
||||
return True
|
||||
return False
|
||||
|
||||
def __selection_changed(self, selection):
|
||||
|
@ -220,16 +220,13 @@ class ButtonTab(GrampsTab):
|
||||
return
|
||||
self.add_button_clicked(obj)
|
||||
elif event.keyval in (_OPEN,) and self.share_btn and \
|
||||
event.state in (gtk.gdk.CONTROL_MASK,
|
||||
gtk.gdk.CONTROL_MASK | gtk.gdk.MOD2_MASK):
|
||||
(event.state & gtk.gdk.CONTROL_MASK):
|
||||
self.share_button_clicked(obj)
|
||||
elif event.keyval in (_LEFT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,
|
||||
gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK):
|
||||
(event.state & gtk.gdk.MOD1_MASK):
|
||||
self.prev_page()
|
||||
elif event.keyval in (_RIGHT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,
|
||||
gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK):
|
||||
(event.state & gtk.gdk.MOD1_MASK):
|
||||
self.next_page()
|
||||
else:
|
||||
return
|
||||
|
@ -155,12 +155,10 @@ class GrampsTab(gtk.VBox):
|
||||
"""
|
||||
if event.type == gtk.gdk.KEY_PRESS:
|
||||
if event.keyval in (_LEFT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,
|
||||
gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK):
|
||||
(event.state & gtk.gdk.MOD1_MASK):
|
||||
self.prev_page()
|
||||
elif event.keyval in (_RIGHT,) and \
|
||||
event.state in (gtk.gdk.MOD1_MASK,
|
||||
gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK):
|
||||
(event.state & gtk.gdk.MOD1_MASK):
|
||||
self.next_page()
|
||||
else:
|
||||
return
|
||||
|
@ -323,9 +323,11 @@ class SurnameTab(EmbeddedList):
|
||||
"""
|
||||
if not EmbeddedList.key_pressed(self, obj, event):
|
||||
if event.type == gtk.gdk.KEY_PRESS and event.keyval in (_TAB,):
|
||||
if event.state not in (gtk.gdk.SHIFT_MASK, gtk.gdk.CONTROL_MASK):
|
||||
if not (event.state & (gtk.gdk.SHIFT_MASK |
|
||||
gtk.gdk.CONTROL_MASK)):
|
||||
return self.next_cell()
|
||||
elif event.state in (gtk.gdk.SHIFT_MASK, gtk.gdk.CONTROL_MASK):
|
||||
elif (event.state & (gtk.gdk.SHIFT_MASK |
|
||||
gtk.gdk.CONTROL_MASK)):
|
||||
return self.prev_cell()
|
||||
else:
|
||||
return
|
||||
|
@ -643,9 +643,8 @@ class EditRule(ManagedWindow.ManagedWindow):
|
||||
return self.expand_collapse()
|
||||
|
||||
def _key_press(self, obj, event):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
return self.expand_collapse()
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
return self.expand_collapse()
|
||||
return False
|
||||
|
||||
def expand_collapse(self):
|
||||
|
@ -100,13 +100,12 @@ class SelectPerson(BaseSelector):
|
||||
self.window.response(gtk.RESPONSE_OK)
|
||||
|
||||
def _key_press(self, obj, event):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
store, paths = self.selection.get_selected_rows()
|
||||
if paths and len(paths[0]) == 1 :
|
||||
if self.tree.row_expanded(paths[0]):
|
||||
self.tree.collapse_row(paths[0])
|
||||
else:
|
||||
self.tree.expand_row(paths[0], 0)
|
||||
return True
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
store, paths = self.selection.get_selected_rows()
|
||||
if paths and len(paths[0]) == 1 :
|
||||
if self.tree.row_expanded(paths[0]):
|
||||
self.tree.collapse_row(paths[0])
|
||||
else:
|
||||
self.tree.expand_row(paths[0], 0)
|
||||
return True
|
||||
return False
|
||||
|
@ -809,10 +809,9 @@ class ListView(NavigationView):
|
||||
"""
|
||||
if not self.dbstate.open:
|
||||
return False
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
self.edit(obj)
|
||||
return True
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
self.edit(obj)
|
||||
return True
|
||||
return False
|
||||
|
||||
def _key_press_tree(self, obj, event):
|
||||
@ -823,7 +822,15 @@ class ListView(NavigationView):
|
||||
"""
|
||||
if not self.dbstate.open:
|
||||
return False
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
||||
elif event.state & gtk.gdk.SHIFT_MASK:
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
store, paths = self.selection.get_selected_rows()
|
||||
if paths:
|
||||
firstsel = paths[0]
|
||||
firstnode = self.model.on_get_iter(firstsel)
|
||||
if len(paths) == 1 and firstnode.handle is None:
|
||||
return self.expand_collapse_tree_branch()
|
||||
else:
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
store, paths = self.selection.get_selected_rows()
|
||||
if paths:
|
||||
@ -834,14 +841,6 @@ class ListView(NavigationView):
|
||||
else:
|
||||
self.edit(obj)
|
||||
return True
|
||||
elif event.state in (gtk.gdk.SHIFT_MASK, ):
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
store, paths = self.selection.get_selected_rows()
|
||||
if paths:
|
||||
firstsel = paths[0]
|
||||
firstnode = self.model.on_get_iter(firstsel)
|
||||
if len(paths) == 1 and firstnode.handle is None:
|
||||
return self.expand_collapse_tree_branch()
|
||||
|
||||
return False
|
||||
|
||||
|
@ -503,7 +503,7 @@ class NavigationView(PageView):
|
||||
if self.active:
|
||||
if event.type == gtk.gdk.KEY_PRESS:
|
||||
if (event.keyval == gtk.keysyms.c and
|
||||
event.state == gtk.gdk.CONTROL_MASK | gtk.gdk.MOD2_MASK):
|
||||
(event.state & gtk.gdk.CONTROL_MASK)):
|
||||
self.call_copy()
|
||||
return True
|
||||
return super(NavigationView, self).key_press_handler(widget, event)
|
||||
|
@ -216,7 +216,7 @@ class PageView(DbGUIElement):
|
||||
if self.active:
|
||||
if event.type == gtk.gdk.KEY_PRESS:
|
||||
if (event.keyval == gtk.keysyms.v and
|
||||
event.state == gtk.gdk.CONTROL_MASK | gtk.gdk.MOD2_MASK):
|
||||
(event.state & gtk.gdk.CONTROL_MASK)):
|
||||
self.call_paste()
|
||||
return True
|
||||
return False
|
||||
@ -513,11 +513,9 @@ class PageView(DbGUIElement):
|
||||
Define the action for a key press event
|
||||
"""
|
||||
# TODO: This is never used? (replaced in ListView)
|
||||
#act if no modifier, and allow Num Lock as MOD2_MASK
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
self.edit(obj)
|
||||
return True
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
self.edit(obj)
|
||||
return True
|
||||
return False
|
||||
|
||||
def on_delete(self):
|
||||
|
@ -791,15 +791,14 @@ class MonitoredTagList(object):
|
||||
"""
|
||||
Invoke the tag editor.
|
||||
"""
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK,):
|
||||
if (event.type == gtk.gdk.BUTTON_PRESS or
|
||||
(event.type == gtk.gdk.KEY_PRESS and
|
||||
event.keyval in (_RETURN, _KP_ENTER))):
|
||||
editor = TagEditor(self.tag_list, self.all_tags,
|
||||
self.uistate, self.track)
|
||||
if editor.return_list is not None:
|
||||
self.tag_list = editor.return_list
|
||||
self._display()
|
||||
self.set_list([item[0] for item in self.tag_list])
|
||||
return True
|
||||
if (event.type == gtk.gdk.BUTTON_PRESS or
|
||||
(event.type == gtk.gdk.KEY_PRESS and
|
||||
event.keyval in (_RETURN, _KP_ENTER))):
|
||||
editor = TagEditor(self.tag_list, self.all_tags,
|
||||
self.uistate, self.track)
|
||||
if editor.return_list is not None:
|
||||
self.tag_list = editor.return_list
|
||||
self._display()
|
||||
self.set_list([item[0] for item in self.tag_list])
|
||||
return True
|
||||
return False
|
||||
|
@ -241,15 +241,14 @@ class RelCalc(tool.Tool, ManagedWindow.ManagedWindow):
|
||||
self.textbuffer.set_text(textval)
|
||||
|
||||
def _key_press(self, obj, event):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
store, paths = self.selection.get_selected_rows()
|
||||
if paths and len(paths[0]) == 1 :
|
||||
if self.tree.row_expanded(paths[0]):
|
||||
self.tree.collapse_row(paths[0])
|
||||
else:
|
||||
self.tree.expand_row(paths[0], 0)
|
||||
return True
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
store, paths = self.selection.get_selected_rows()
|
||||
if paths and len(paths[0]) == 1 :
|
||||
if self.tree.row_expanded(paths[0]):
|
||||
self.tree.collapse_row(paths[0])
|
||||
else:
|
||||
self.tree.expand_row(paths[0], 0)
|
||||
return True
|
||||
return False
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user