當前位置: 首頁>>代碼示例>>Python>>正文


Python QPrintDialog.exec_方法代碼示例

本文整理匯總了Python中PyQt4.QtGui.QPrintDialog.exec_方法的典型用法代碼示例。如果您正苦於以下問題:Python QPrintDialog.exec_方法的具體用法?Python QPrintDialog.exec_怎麽用?Python QPrintDialog.exec_使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtGui.QPrintDialog的用法示例。


在下文中一共展示了QPrintDialog.exec_方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _print_report

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 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)
開發者ID:karoema,項目名稱:orange3,代碼行數:9,代碼來源:owreport.py

示例2: printFile

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
    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
開發者ID:burnchar,項目名稱:py-de,代碼行數:27,代碼來源:py-de.py

示例3: printDocument

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 def printDocument(self):
     dialog = QPrintDialog()
     if not dialog.exec_():
         return
     self.printer = dialog.printer()    
     self.imprimir(self.printer)
     self.document.load(self.editmodel)
開發者ID:joseanm,項目名稱:pyqt_billing,代碼行數:9,代碼來源:factura.py

示例4: showDialog

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
    def showDialog(self, parent):
        dialog = QPrintDialog(self.printer, parent)
        if dialog.exec_() != QPrintDialog.Accepted:
            return False

        self._init_painter()
        return True
開發者ID:maximerobin,項目名稱:Ufwi,代碼行數:9,代碼來源:printer.py

示例5: printWindow

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 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)
開發者ID:BackupTheBerlios,項目名稱:simuvis4-svn,代碼行數:10,代碼來源:LogWin.py

示例6: _onShortcutPrint

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 def _onShortcutPrint(self):
     """Ctrl+P handler.
     Show dialog, print file
     """
     dialog = QPrintDialog(self)
     if dialog.exec_() == QDialog.Accepted:
         printer = dialog.printer()
         self.print_(printer)
開發者ID:kcrossen,項目名稱:qutepart,代碼行數:10,代碼來源:__init__.py

示例7: printContents

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 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)
開發者ID:BackupTheBerlios,項目名稱:simuvis4-svn,代碼行數:10,代碼來源:QPyShell.py

示例8: print_

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 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)
開發者ID:pyros2097,項目名稱:SabelIDE,代碼行數:11,代碼來源:level.py

示例9: _print

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 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()
開發者ID:Mouchnino,項目名稱:moneyguru,代碼行數:11,代碼來源:main_window.py

示例10: print_on_paper

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 def print_on_paper(self):
     """Print the document with a printer."""
     
     printer = Qsci.QsciPrinter()
     print_dialog = QPrintDialog(printer)
     print_dialog.setWindowTitle(self.tr("Print Document"))
     print_dialog.addEnabledOption(QPrintDialog.PrintSelection)
     if print_dialog.exec_() == QPrintDialog.Accepted:
         printer.printRange(self)
開發者ID:m4nu3lf,項目名稱:PyCSGScriptLive,代碼行數:11,代碼來源:qpython_edit.py

示例11: printWindow

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
 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())
開發者ID:BackupTheBerlios,項目名稱:simuvis4-svn,代碼行數:12,代碼來源:QwtPlotWindow.py

示例12: printc

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
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)
開發者ID:dravix,項目名稱:pyventa,代碼行數:12,代碼來源:libutil.py

示例13: slot_canvasPrint

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
    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)
開發者ID:rhetr,項目名稱:Cadence,代碼行數:12,代碼來源:shared_canvasjack.py

示例14: canvas_print

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
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)
開發者ID:kayosiii,項目名稱:Cadence,代碼行數:12,代碼來源:shared_canvas.py

示例15: print_photo

# 需要導入模塊: from PyQt4.QtGui import QPrintDialog [as 別名]
# 或者: from PyQt4.QtGui.QPrintDialog import exec_ [as 別名]
    def print_photo(self):
        print_dialog = QPrintDialog(self._printer,self)

        if print_dialog.exec_() == QDialog.Accepted:
            painter = QPainter(self._printer)
            rect = painter.viewport()
            size = self._lbl_photo.pixmap().size()
            size.scale(rect.size(), Qt.KeepAspectRatio)
            painter.setViewport(rect.x(), rect.y(), size.width(), size.height())
            painter.setWindow(self._lbl_photo.pixmap().rect())
            painter.drawPixmap(0, 0, self._lbl_photo.pixmap())
開發者ID:gltn,項目名稱:stdm,代碼行數:13,代碼來源:document_viewer.py


注:本文中的PyQt4.QtGui.QPrintDialog.exec_方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。