diff options
author | Clayton Smith <argilo@gmail.com> | 2020-08-18 21:09:48 -0400 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2020-08-19 08:52:46 -0700 |
commit | 96b3fbffe940519354690b7d6489c7371940e07e (patch) | |
tree | 632e88beff0c3a46721c8470df717926d41ee2e8 /grc/gui/Notebook.py | |
parent | 839f8bd97d288ee966c23cc449438427b0068cb1 (diff) |
grc: prevent search keystrokes from modifying flowgraph
A confluence of bugs introduced while updating GRC to Python 3 results
in keystrokes being sent to the drawing area while typing in the block
search box.
First, the drawing area needs to be placed in a Viewport before being
added into a ScrolledWindow. Fixing this allows the drawing area to grab
focus as intended when it is clicked.
Second, the drawing area needs to unselect all blocks when it loses
focus so that the relevant keystroke actions can be disabled. This
functionality was commented out during the transition to Python 3, and
I've restored it here.
Diffstat (limited to 'grc/gui/Notebook.py')
-rw-r--r-- | grc/gui/Notebook.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/grc/gui/Notebook.py b/grc/gui/Notebook.py index ef8658a34c..02f27dc316 100644 --- a/grc/gui/Notebook.py +++ b/grc/gui/Notebook.py @@ -114,12 +114,15 @@ class Page(Gtk.HBox): self.drawing_area = DrawingArea(flow_graph) flow_graph.drawing_area = self.drawing_area + self.viewport = Gtk.Viewport() + self.viewport.add(self.drawing_area) + self.scrolled_window = Gtk.ScrolledWindow() self.scrolled_window.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT) self.scrolled_window.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS) self.scrolled_window.connect('key-press-event', self._handle_scroll_window_key_press) - self.scrolled_window.add(self.drawing_area) + self.scrolled_window.add(self.viewport) self.pack_start(self.scrolled_window, True, True, 0) self.show_all() |