From bc1724533171fe69a6a775101d8d4318ba05b396 Mon Sep 17 00:00:00 2001 From: Josip Date: Sun, 28 May 2017 23:32:20 +0200 Subject: [PATCH] Quick search with Czech characters -> Crash Crash happen when checking for "event.string" in "treeview_keypress" function in "gramps/gui/widgets/interactivesearchbox.py" Note that https://lazka.github.io/pgi-docs/Gdk-3.0/classes/EventKey.html#Gdk.EventKey says it is deprecated and should never be used. Gdk.keyval_to_unicode return the corresponding unicode character, or 0 if there is no corresponding character. Fixes #9130. --- gramps/gui/views/listview.py | 4 ++-- gramps/gui/widgets/interactivesearchbox.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index b122cd1cc..b4d83b85d 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -907,7 +907,7 @@ class ListView(NavigationView): self.edit(obj) return True # Custom interactive search - if event.string: + if Gdk.keyval_to_unicode(event.keyval): return self.searchbox.treeview_keypress(obj, event) return False @@ -935,7 +935,7 @@ class ListView(NavigationView): else: self.edit(obj) return True - elif event.string: + elif Gdk.keyval_to_unicode(event.keyval): # Custom interactive search return self.searchbox.treeview_keypress(obj, event) return False diff --git a/gramps/gui/widgets/interactivesearchbox.py b/gramps/gui/widgets/interactivesearchbox.py index 992b7bff7..5e2c6eba0 100644 --- a/gramps/gui/widgets/interactivesearchbox.py +++ b/gramps/gui/widgets/interactivesearchbox.py @@ -70,7 +70,7 @@ class InteractiveSearchBox: function handling keypresses from the treeview for the typeahead find capabilities """ - if not event.string: + if not Gdk.keyval_to_unicode(event.keyval): return False if self._key_cancels_search(event.keyval): return False