本文整理汇总了Python中PySide.QtCore.QFile.fileName方法的典型用法代码示例。如果您正苦于以下问题:Python QFile.fileName方法的具体用法?Python QFile.fileName怎么用?Python QFile.fileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QFile
的用法示例。
在下文中一共展示了QFile.fileName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read
# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import fileName [as 别名]
def read(self, fileName):
self.state = PluginState.Invalid
self.hasError = False
self.dependencies = []
specFile = QFile(fileName)
if not specFile.exists():
msg = QCoreApplication.translate(None, "File does not exist: {name}")
return self.__reportError(msg.format(name=specFile.fileName()))
if not specFile.open(QIODevice.ReadOnly):
msg = QCoreApplication.translate(None, "Could not open file for read: {name}")
return self.__reportError(msg.format(name=specFile.fileName()))
fileInfo = QFileInfo(specFile)
self.location = fileInfo.absolutePath()
self.filePath = fileInfo.absoluteFilePath()
reader = QXmlStreamReader(specFile)
while not reader.atEnd():
reader.readNext()
tokenType = reader.tokenType()
if tokenType is QXmlStreamReader.StartElement:
self.__readPluginSpec(reader)
else:
pass
if reader.hasError():
msg = QCoreApplication.translate(None, "Error parsing file {0}: {1}, at line {2}, column {3}")
return self.__reportError(msg.format(specFile.fileName(), reader.errorString(),
reader.lineNumber(), reader.columnNumber()))
self.state = PluginState.Read
return True