[accerciser] Fix textview.get_iter_at_location result handling



commit af8d49e51df0d47976334d683820383e70811b03
Author: Jan-Marek Glogowski <glogow fbihome de>
Date:   Mon May 27 20:26:23 2019 +0200

    Fix textview.get_iter_at_location result handling
    
    At least currently this returns a tuple of (bool, Gtk.TextIter).

 plugins/event_monitor.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/plugins/event_monitor.py b/plugins/event_monitor.py
index e3e29e1..f6844ea 100644
--- a/plugins/event_monitor.py
+++ b/plugins/event_monitor.py
@@ -423,12 +423,13 @@ class EventMonitor(ViewportPlugin):
     '''
     x, y = textview.window_to_buffer_coords(gtk.TextWindowType.WIDGET,
                                              int(event.x), int(event.y))
-    iter = textview.get_iter_at_location(x, y)
+    (isText, iter) = textview.get_iter_at_location(x, y)
     cursor = gdk.Cursor(gdk.CursorType.XTERM)
-    for tag in iter.get_tags():
-      if getattr(tag, 'islink'):
-        cursor = gdk.Cursor(gdk.CursorType.HAND2)
-        break
+    if isText:
+      for tag in iter.get_tags():
+        if getattr(tag, 'islink'):
+          cursor = gdk.Cursor(gdk.CursorType.HAND2)
+          break
     window = textview.get_window(gtk.TextWindowType.TEXT)
     window.set_cursor(cursor)
     window.get_pointer()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]