stickies.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:sticky-notes 作者: rubyAce71697 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号