本文整理汇总了Python中PyQt4.Qt.QUrl.addQueryItem方法的典型用法代码示例。如果您正苦于以下问题:Python QUrl.addQueryItem方法的具体用法?Python QUrl.addQueryItem怎么用?Python QUrl.addQueryItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QUrl
的用法示例。
在下文中一共展示了QUrl.addQueryItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: share
# 需要导入模块: from PyQt4.Qt import QUrl [as 别名]
# 或者: from PyQt4.Qt.QUrl import addQueryItem [as 别名]
def share(self):
index = self.available_profiles.currentIndex()
title, src = self._model.title(index), self._model.script(index)
if not title or not src:
error_dialog(self, _('No recipe selected'), _('No recipe selected')).exec_()
return
pt = PersistentTemporaryFile(suffix='.recipe')
pt.write(src.encode('utf-8'))
pt.close()
body = _('The attached file: %(fname)s is a '
'recipe to download %(title)s.')%dict(
fname=os.path.basename(pt.name), title=title)
subject = _('Recipe for ')+title
url = QUrl('mailto:')
url.addQueryItem('subject', subject)
url.addQueryItem('body', body)
url.addQueryItem('attachment', pt.name)
open_url(url)
示例2: share
# 需要导入模块: from PyQt4.Qt import QUrl [as 别名]
# 或者: from PyQt4.Qt.QUrl import addQueryItem [as 别名]
def share(self):
index = self.available_profiles.currentIndex()
title, src = self._model.title(index), self._model.script(index)
if not title or not src:
error_dialog(self, _("No recipe selected"), _("No recipe selected")).exec_()
return
pt = PersistentTemporaryFile(suffix=".recipe")
pt.write(src.encode("utf-8"))
pt.close()
body = _("The attached file: %(fname)s is a " "recipe to download %(title)s.") % dict(
fname=os.path.basename(pt.name), title=title
)
subject = _("Recipe for ") + title
url = QUrl("mailto:")
url.addQueryItem("subject", subject)
url.addQueryItem("body", body)
url.addQueryItem("attachment", pt.name)
open_url(url)