当前位置: 首页>>代码示例>>Python>>正文


Python QPrintDialog.setOptions方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QPrintDialog.setOptions方法的典型用法代码示例。如果您正苦于以下问题:Python QPrintDialog.setOptions方法的具体用法?Python QPrintDialog.setOptions怎么用?Python QPrintDialog.setOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QPrintDialog的用法示例。


在下文中一共展示了QPrintDialog.setOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print_

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setOptions [as 别名]
 def print_(self):
     printer = QPrinter()
     dlg = QPrintDialog(printer, self)
     dlg.setWindowTitle(app.caption(_("Print")))
     options = (QAbstractPrintDialog.PrintToFile
                | QAbstractPrintDialog.PrintShowPageSize
                | QAbstractPrintDialog.PrintPageRange)
     if self.browser.textCursor().hasSelection():
         options |= QAbstractPrintDialog.PrintSelection
     dlg.setOptions(options)
     if dlg.exec_():
         self.browser.print_(printer)
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:14,代码来源:browser.py

示例2: printSource

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setOptions [as 别名]
 def printSource(self):
     cursor = self.textCursor()
     try:
         printer = self._sourcePrinter
     except AttributeError:
         printer = self._sourcePrinter = QPrinter()
     else:
         printer.setCopyCount(1)
     dlg = QPrintDialog(printer, self)
     dlg.setWindowTitle(app.caption(_("dialog title", "Print Source")))
     options = QAbstractPrintDialog.PrintToFile | QAbstractPrintDialog.PrintShowPageSize
     if cursor.hasSelection():
         options |= QAbstractPrintDialog.PrintSelection
     dlg.setOptions(options)
     if dlg.exec_():
         if dlg.printRange() != QAbstractPrintDialog.Selection:
             cursor.clearSelection()
         number_lines = QSettings().value("source_export/number_lines", False, bool)
         doc = highlighter.html_copy(cursor, 'printer', number_lines)
         doc.setMetaInformation(QTextDocument.DocumentTitle, self.currentDocument().url().toString())
         font = doc.defaultFont()
         font.setPointSizeF(font.pointSizeF() * 0.8)
         doc.setDefaultFont(font)
         doc.print_(printer)
开发者ID:elmamyra,项目名称:frescobaldi,代码行数:26,代码来源:mainwindow.py

示例3: onPlotButton

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setOptions [as 别名]

#.........这里部分代码省略.........
                        self.composition.beginPrintAsPDF( multiFilePrinter, outputFileName )
                        # set the correct resolution
                        self.composition.beginPrint( multiFilePrinter )
                        printReady = painter.begin( multiFilePrinter )
                        if not printReady:
                            QMessageBox.warning( self, tr( "Atlas processing error" ),
                                tr( "Error creating %s." % outputFileName ) )
                            progress.cancel()
                            QApplication.restoreOverrideCursor()
                            return
                        self.composition.doPrint( multiFilePrinter, painter )
                        painter.end()
                    else:
                        # start print on a new page if we're not on the first feature
                        if featureI > 0:
                            printer.newPage()
                        self.composition.doPrint( printer, painter )
                    
                atlas.endRender()
                if self.ui.SingleFileCheckbox.checkState():
                    painter.end()
                QApplication.restoreOverrideCursor()

            elif self.ui.OutputTab.currentIndex() == 1:  # to Printer
                # if To Printer is selected set the printer
                # setting up printer
                if self.printer is None:
                    self.printer = QPrinter()
                    self.printer.setFullPage(True)
                    self.printer.setColorMode(QPrinter.Color)
                # open printer setting dialog
                pdlg = QPrintDialog(self.printer,self)
                pdlg.setModal(True)
                pdlg.setOptions(QAbstractPrintDialog.None)
                if not pdlg.exec_() == QDialog.Accepted:
                    return
                
                QApplication.setOverrideCursor(Qt.BusyCursor)
                #prepare for first feature, so that we know paper size to begin with
                self.composition.setAtlasMode( QgsComposition.ExportAtlas )
                atlas.prepareForFeature(0)

                # set orientation                
                if self.composition.paperWidth() > self.composition.paperHeight():
                    self.printer.setOrientation(QPrinter.Landscape)
                    self.printer.setPaperSize(
                        QSizeF(self.composition.paperHeight(), self.composition.paperWidth()),
                        QPrinter.Millimeter)
                else:
                    self.printer.setOrientation(QPrinter.Portrait)
                    self.printer.setPaperSize(
                        QSizeF(self.composition.paperWidth(), self.composition.paperHeight()),
                        QPrinter.Millimeter)
                self.printer.setResolution(self.composition.printResolution())

                self.composition.beginPrint( self.printer )
                painter = QPainter(self.printer)
                if not len(atlas.featureFilterErrorString()) == 0:
                    QMessageBox.warning( self, tr( "Atlas processing error" ),
                        tr( "Feature filter parser error: %s" % atlas.featureFilterErrorString() ) )
                    QApplication.restoreOverrideCursor()
                    return

                atlas.beginRender()
                progress = QProgressDialog( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlas.numFeatures(), self )
                for featureI in range(0, atlas.numFeatures()):
开发者ID:GEO-IASS,项目名称:ls,代码行数:70,代码来源:batch_plotting_dialog.py


注:本文中的PyQt4.QtGui.QPrintDialog.setOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。