本文整理汇总了Python中PyQt5.QtCore.QFileInfo.isReadable方法的典型用法代码示例。如果您正苦于以下问题:Python QFileInfo.isReadable方法的具体用法?Python QFileInfo.isReadable怎么用?Python QFileInfo.isReadable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QFileInfo
的用法示例。
在下文中一共展示了QFileInfo.isReadable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createRequest
# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import isReadable [as 别名]
def createRequest(self, op, request, outgoingData=None):
"""
Public method to create a request.
@param op the operation to be performed
(QNetworkAccessManager.Operation)
@param request reference to the request object (QNetworkRequest)
@param outgoingData reference to an IODevice containing data to be sent
(QIODevice)
@return reference to the created reply object (QNetworkReply)
"""
if op == QNetworkAccessManager.GetOperation:
fileInfo = QFileInfo(request.url().toLocalFile())
if not fileInfo.isDir() or \
not fileInfo.isReadable() or \
not fileInfo.exists():
return None
from .FileReply import FileReply
return FileReply(request.url(), self.parent())
else:
return None
示例2: detect_python_path
# 需要导入模块: from PyQt5.QtCore import QFileInfo [as 别名]
# 或者: from PyQt5.QtCore.QFileInfo import isReadable [as 别名]
def detect_python_path():
if (IS_WINDOWS and PYTHON_PATH_CONFIGURED_BY_USER) or not IS_WINDOWS:
return []
suggested = []
try:
drives = [QDir.toNativeSeparators(d.absolutePath())
for d in QDir.drives()]
dirs = []
for drive in drives:
info = QFileInfo(drive)
if info.isReadable():
dirs += [os.path.join(drive, folder)
for folder in os.listdir(drive)]
for folder in dirs:
file_path = os.path.join(folder, "python.exe")
if ("Python" in folder) and os.path.exists(file_path):
suggested.append(file_path)
except:
print("Detection couldnt be executed")
return suggested