本文整理汇总了Python中PyQt4.QtGui.QPrinter.setCreator方法的典型用法代码示例。如果您正苦于以下问题:Python QPrinter.setCreator方法的具体用法?Python QPrinter.setCreator怎么用?Python QPrinter.setCreator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QPrinter
的用法示例。
在下文中一共展示了QPrinter.setCreator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: printNote
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setCreator [as 别名]
def printNote(self):
printer = QPrinter(QPrinter.HighResolution)
printer.setCreator(__appname__ + ' ' + __version__)
printer.setDocName(self.notesTree.currentItem().text(0))
printdialog = QPrintDialog(printer, self)
if printdialog.exec() == QDialog.Accepted:
self.notesView.print_(printer)
示例2: __outPDF
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setCreator [as 别名]
def __outPDF(self):
"""
To save the profile as pdf file
"""
fileName = QFileDialog.getSaveFileName(
self.__iface.mainWindow(), QCoreApplication.translate("VDLTools", "Save As"),
QCoreApplication.translate("VDLTools", "Profile.pdf"),"Portable Document Format (*.pdf)")
if fileName is not None:
if self.__lib == 'Qwt5':
printer = QPrinter()
printer.setCreator(QCoreApplication.translate("VDLTools", "QGIS Profile Plugin"))
printer.setOutputFileName(fileName)
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOrientation(QPrinter.Landscape)
self.__plotWdg.print_(printer)
elif self.__lib == 'Matplotlib':
self.__plotWdg.figure.savefig(str(fileName))
示例3: saveWindow
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import setCreator [as 别名]
def saveWindow(self):
fileTypes = {'PDF':('pdf',), 'Postscript':('ps',),'SVG':('svg',)}
filters = ';;'.join(['%s (%s)' % (k, ' '.join(['*.'+e for e in v])) for k, v in fileTypes.items()])
dlg = QFileDialog(self,
QCoreApplication.translate('QwtPlot', 'Select type and name of file to save'),
SimuVis4.Globals.defaultFolder or '', filters)
dlg.setFileMode(QFileDialog.AnyFile)
dlg.setAcceptMode(QFileDialog.AcceptSave)
if dlg.exec_() != QDialog.Accepted:
return
tmp = str(dlg.selectedFilter())
fileType = tmp[:tmp.find('(')-1]
dlg.setDefaultSuffix(fileTypes[fileType][0])
files = dlg.selectedFiles()
if not files:
return
fileName = unicode(files[0])
SimuVis4.Globals.defaultFolder, tmp = os.path.split(fileName)
if fileType == 'PDF':
printer = QPrinter()
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOrientation(QPrinter.Landscape)
printer.setOutputFileName(fileName)
printer.setCreator('SimuVis4')
self.plot.print_(printer)
elif fileType == 'Postscript':
printer = QPrinter()
printer.setOutputFormat(QPrinter.PostScriptFormat)
printer.setOrientation(QPrinter.Landscape)
printer.setOutputFileName(fileName)
printer.setCreator('SimuVis4')
self.plot.print_(printer)
elif fileType == 'SVG':
generator = QSvgGenerator()
generator.setFileName(fileName)
generator.setSize(QSize(800, 600))
self.plot.print_(generator)