def on_textview2_motion_notify_event( self, widget, event):
logger.info("Mouse moving in text view")
""" used to change cursors pointer when mouse over a link.
Changed from http://download.gna.org/nfoview/doc/api/nfoview.view_source.html
as returns False now so we can still select content """
window = Gtk.TextWindowType.WIDGET
x, y = widget.window_to_buffer_coords(window, int(event.x), int(event.y))
logger.debug("cordinates: " + str(x) + " " + str(y))
window = widget.get_window(Gtk.TextWindowType.TEXT)
for tag in widget.get_iter_at_location(x, y).get_tags():
logger.debug(" in loop tag = " + tag.url)
#print event.get_state()
if hasattr(tag, "url") and event.get_state() == Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD2_MASK:
logger.debug(" Cordinates have tag url")
window.set_cursor(Gdk.Cursor(cursor_type=Gdk.CursorType.HAND2))
return False # to not call the default handler.
window.set_cursor(Gdk.Cursor(cursor_type=Gdk.CursorType.XTERM))
return False
评论列表
文章目录