panelview.py 文件源码

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

项目:zim-icontags-plugin 作者: Pl-M 项目源码 文件源码
def insert_icon(self, pageview):
        '''Create widget to choose an icon and insert an icon shortcode.'''

        def _insert(item):
            '''Insert an icon shortcode to the cursor position.'''
            text = getIconMarkup(item)
            pageview.view.get_buffer().insert_at_cursor(text)

        menu = gtk.Menu()
        icons = sorted([(a, render_icon(b)) for (a,b) in ICONS.iteritems()
                        if a not in RESERVED_ICON_NAMES])
        for name, icon in icons:
            image = gtk.Image()
            image.set_from_pixbuf(icon)
            item = gtk.ImageMenuItem(name)
            item.set_image(image)
            item.set_use_underline(False)
            item.connect('button-release-event', lambda item, _:
                         _insert(item.get_label()))
            menu.append(item)
        menu.popup(None, None, None, 3, 0)
        menu.show_all()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号