本文整理汇总了Python中PySide.QtCore.QFile.isWritable方法的典型用法代码示例。如果您正苦于以下问题:Python QFile.isWritable方法的具体用法?Python QFile.isWritable怎么用?Python QFile.isWritable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QFile
的用法示例。
在下文中一共展示了QFile.isWritable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exportContact
# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import isWritable [as 别名]
def exportContact(self, jid, name):
cm = self.manager
phoneContacts = cm.getQtContacts()
contacts = []
for c in phoneContacts:
if name == c.displayLabel():
if os.path.isfile(WAConstants.CACHE_CONTACTS + "/" + name + ".vcf"):
os.remove(WAConstants.CACHE_CONTACTS + "/" + name + ".vcf")
print "founded contact: " + c.displayLabel()
contacts.append(c)
openfile = QFile(WAConstants.VCARD_PATH + "/" + name + ".vcf")
openfile.open(QIODevice.WriteOnly)
if openfile.isWritable():
exporter = QVersitContactExporter()
if exporter.exportContacts(contacts, QVersitDocument.VCard30Type):
documents = exporter.documents()
writer = QVersitWriter()
writer.setDevice(openfile)
writer.startWriting(documents)
writer.waitForFinished()
openfile.close()
self.contactExported.emit(jid, name)
break