LocationBox.py 文件源码

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

项目:enigma2 作者: OpenLD 项目源码 文件源码
def select(self):
        currentFolder = self.getPreferredFolder()
        # Do nothing unless current Directory is valid
        if currentFolder is not None:
            # Check if we need to have a minimum of free Space available
            if self.minFree is not None:
                # Try to read fs stats
                try:
                    s = os.statvfs(currentFolder)
                    if (s.f_bavail * s.f_bsize) / 1000000 > self.minFree:
                        # Automatically confirm if we have enough free disk Space available
                        return self.selectConfirmed(True)
                except OSError:
                    pass

                # Ask User if he really wants to select this folder
                self.session.openWithCallback(
                    self.selectConfirmed,
                    MessageBox,
                    _("There might not be enough Space on the selected Partition.\nDo you really want to continue?"),
                    type = MessageBox.TYPE_YESNO
                )
            # No minimum free Space means we can safely close
            else:
                self.selectConfirmed(True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号