From 1b0ad55d1326a777143927060787521b2187c88c Mon Sep 17 00:00:00 2001 From: prculley Date: Wed, 20 Dec 2017 10:05:08 -0600 Subject: [PATCH] Fix Styled Text Editor for exception on non-editable text click Fixes #10309 Also prevent editing of links on non-editable text. --- gramps/gui/widgets/styledtexteditor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gramps/gui/widgets/styledtexteditor.py b/gramps/gui/widgets/styledtexteditor.py index 582e51ca9..8879cb7ae 100644 --- a/gramps/gui/widgets/styledtexteditor.py +++ b/gramps/gui/widgets/styledtexteditor.py @@ -344,8 +344,8 @@ class StyledTextEditor(Gtk.TextView): self.selclick=False if ((event.type == Gdk.EventType.BUTTON_PRESS) and (event.button == 1) and (self.url_match) and - (event.get_state() & get_primary_mask()) or - not self.get_editable()): + ((event.get_state() & get_primary_mask()) or + not self.get_editable())): flavor = self.url_match[MATCH_FLAVOR] url = self.url_match[MATCH_STRING] @@ -392,7 +392,7 @@ class StyledTextEditor(Gtk.TextView): copy_menu = Gtk.MenuItem(label=_('Copy _Link Address')) copy_menu.set_use_underline(True) - if flavor == LINK: + if flavor == LINK and self.get_editable(): edit_menu = Gtk.MenuItem(label=_('_Edit Link')) edit_menu.set_use_underline(True) edit_menu.connect('activate', self._edit_url_cb,