ui.py 文件源码

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

项目:py-cloud-compute-cannon 作者: Autodesk 项目源码 文件源码
def __init__(self, filename, fileobj, **kwargs):
        super(FileView, self).__init__(disabled=True)
        self.filename = filename
        self._string = None
        self._current_pos = 0
        self.load_more_button = None
        self.textarea = None
        self._fileobj = fileobj
        # For files that need to be fetched, make a download button
        if hasattr(fileobj, '_fetched') and not fileobj._fetched:
            self.download_button = ipy.Button(description='Download')
            self.children = [self.download_button]
            self.download_button.on_click(self.handle_download_click)
        # if it's file-like, get the _contents
        elif hasattr(fileobj, 'read'):
            try:
                self._string = fileobj.read()
            except UnicodeDecodeError:
                self._string = '[NOT SHOWN - UNABLE TO DECODE FILE]'
            self.render_string()
        # Just display a string
        else:
            self._string = fileobj
            self.render_string()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号