window.py 文件源码

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

项目:nvim-pygtk3 作者: rliang 项目源码 文件源码
def update_clipboard(self, method: str, data: list):
        """Handles a clipboard request.

        This is called on neovim's event loop, so modifications to GTK widgets
        should be done through `GLib.idle_add()`.

        :method: `get` to obtain the clipboard's contents or `set` to update
        them.
        :data: when the method is `set`, contains the lines to add to the
        clipboard, else None.
        :returns: the clipboard's contents when the method is `get`, else None.

        """
        cb = Gtk.Clipboard.get_default(Gdk.Display.get_default())
        if method == 'set':
            text = '\n'.join(data[0])
            return cb.set_text(text, len(text))
        if method == 'get':
            text = cb.wait_for_text()
            return text.split('\n') if text else []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号