本文整理汇总了Python中PyQt4.QtGui.QPrintDialog类的典型用法代码示例。如果您正苦于以下问题:Python QPrintDialog类的具体用法?Python QPrintDialog怎么用?Python QPrintDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPrintDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showDialog
def showDialog(self, parent):
dialog = QPrintDialog(self.printer, parent)
if dialog.exec_() != QPrintDialog.Accepted:
return False
self._init_painter()
return True
示例2: _print_report
def _print_report(self):
printer = QPrinter()
print_dialog = QPrintDialog(printer, self)
print_dialog.setWindowTitle("Print report")
if print_dialog.exec_() != QDialog.Accepted:
return
self.report_view.print_(printer)
示例3: printNote
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)
示例4: printFile
def printFile(self): # Needs some work...
printDialog = QPrintDialog(self.printer, py_de)
if printDialog.exec_() == QDialog.Accepted:
margin = 10
pageNum = 1
yPos = 0
printJob = QPainter()
printJob.begin(self.printer)
printJob.setFont(self.font)
fm = printJob.fontMetrics()
for i in range(self.textEdit.lines()):
if margin + yPos > self.printer.height() - margin:
pageNum += 1
self.printer.newPage()
yPos = 0
printJob.drawText(margin, # X
margin + yPos, # Y
self.printer.width(), # Width
self.printer.height(),# Height
QtCore.Qt.AlignTop, # Alignment
self.textEdit.text(i - 1)# The text to print
)
yPos += fm.lineSpacing()
printJob.end
示例5: printDocument
def printDocument(self):
dialog = QPrintDialog()
if not dialog.exec_():
return
self.printer = dialog.printer()
self.imprimir(self.printer)
self.document.load(self.editmodel)
示例6: printContents
def printContents(self, printer=None):
if not printer:
printer = QPrinter()
dialog = QPrintDialog(printer, self)
dialog.setWindowTitle(QCoreApplication.translate("QPyShell", "Print Document"))
if dialog.exec_() != QDialog.Accepted:
return
self.outputBrowser.document().print_(printer)
示例7: printWindow
def printWindow(self, printer=None):
if not printer:
printer = QPrinter()
dialog = QPrintDialog(printer, self)
dialog.setWindowTitle(QCoreApplication.translate('LogWindow', 'Print Document'))
if dialog.exec_() != QDialog.Accepted:
return
self.logView.TextArea.document().print_(printer)
示例8: _onShortcutPrint
def _onShortcutPrint(self):
"""Ctrl+P handler.
Show dialog, print file
"""
dialog = QPrintDialog(self)
if dialog.exec_() == QDialog.Accepted:
printer = dialog.printer()
self.print_(printer)
示例9: print_
def print_(self):
dialog = QPrintDialog(self.printer)
if dialog.exec_():
painter = QPainter(self.printer)
painter.setRenderHint(QPainter.Antialiasing)
painter.setRenderHint(QPainter.TextAntialiasing)
self.scene.clearSelection()
#self.removeBorders()
self.scene.render(painter)
示例10: _print
def _print(self):
dialog = QPrintDialog(self)
if dialog.exec_() != QPrintDialog.Accepted:
return
printer = dialog.printer()
currentView = self.mainView.currentWidget()
viewPrinter = ViewPrinter(printer, currentView)
currentView.fitViewsForPrint(viewPrinter)
viewPrinter.render()
示例11: canvas_print
def canvas_print(self_):
self_.scene.clearSelection()
self_.m_export_printer = QPrinter()
dialog = QPrintDialog(self_.m_export_printer, self_)
if dialog.exec_():
painter = QPainter(self_.m_export_printer)
painter.setRenderHint(QPainter.Antialiasing)
painter.setRenderHint(QPainter.TextAntialiasing)
self_.scene.render(painter)
示例12: slot_canvasPrint
def slot_canvasPrint(self):
self.scene.clearSelection()
self.fExportPrinter = QPrinter()
dialog = QPrintDialog(self.fExportPrinter, self)
if dialog.exec_():
painter = QPainter(self.fExportPrinter)
painter.setRenderHint(QPainter.Antialiasing)
painter.setRenderHint(QPainter.TextAntialiasing)
self.scene.render(painter)
示例13: printWindow
def printWindow(self, printer=None):
if not printer:
printer = QPrinter()
printer.setFullPage(True)
printer.setPageSize(QPrinter.A4)
dialog = QPrintDialog(printer, self)
dialog.setWindowTitle(QCoreApplication.translate('QwtPlot', 'Print Document'))
if dialog.exec_() != QDialog.Accepted:
return
self.plot.print_(printer, QwtPlotPrintFilter())
示例14: printc
def printc(tedit,titulo="Reporte",orientacion=0,margen=[5,10,5,10,0]):
printer=QtGui.QPrinter(QPrinter.HighResolution)
printer.setOrientation(orientacion)
printer.setPaperSize(QtGui.QPrinter.Letter)
printer.setPageMargins(*margen)
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOutputFileName(titulo)
prev=QPrintDialog(printer)
if prev.exec_()==QDialog.Accepted:
tedit.print_(printer)
示例15: print_webpage
def print_webpage(self):
"""
Callback for the print action. Should show a print dialog and print the webpage to the printer.
"""
printer = QPrinter()
print_dialog = QPrintDialog(printer, self)
print_dialog.setWindowTitle("Print Page")
if print_dialog.exec_() == QDialog.Accepted:
self.print_(printer)
else:
return False