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


Python QtGui.QPrinter类代码示例

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


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

示例1: printProfile

    def printProfile(self):
        printer = QPrinter(QPrinter.HighResolution)
        printer.setOutputFormat(QPrinter.PdfFormat)
        printer.setPaperSize(QPrinter.A4)
        printer.setOrientation(QPrinter.Landscape)

        printpreviewdlg = QPrintPreviewDialog()
        printpreviewdlg.paintRequested.connect(self.printRequested)

        printpreviewdlg.exec_()
开发者ID:QGEP,项目名称:qgepplugin,代码行数:10,代码来源:qgepplotsvgwidget.py

示例2: 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)
开发者ID:kissthink,项目名称:mikidown,代码行数:7,代码来源:mikiwindow.py

示例3: on_actionFitPage_triggered

 def on_actionFitPage_triggered(self):
     papersize = self._getPaperSize()
     printer = QPrinter()
     printer.setPaperSize(papersize)
     widthInPixels = printer.pageRect().width()
     maxColumns = self.songProperties.maxColumns(widthInPixels)
     self.widthSpinBox.setValue(maxColumns)
     self.scoreScene.reBuild()
开发者ID:jguardon,项目名称:DrumBurp,代码行数:8,代码来源:DBMainwindow.py

示例4: on_actionPreview_activated

 def on_actionPreview_activated( self ):
     printer = QPrinter()
     printer.setPageSize( QPrinter.Letter )
     web = "balancegeneral.php?date=%d+%d" % ( 
                                              self.dtPicker.date().month() ,
                                              self.dtPicker.date().year() )
     report = frmReportes( web , printer, self )
     report.exec_()
开发者ID:armonge,项目名称:EsquipulasPy,代码行数:8,代码来源:balancegeneral.py

示例5: 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())
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:10,代码来源:QwtPlotWindow.py

示例6: on_actionPrint_triggered

 def on_actionPrint_triggered(self):
     if self._printer is None:
         self._printer = QPrinter()
     self._printer = QPrinter(QPrinterInfo(self._printer),
                              QPrinter.HighResolution)
     self._printer.setPaperSize(self._getPaperSize())
     dialog = QPrintPreviewDialog(self._printer, parent = self)
     def updatePages(qprinter):
         self.scoreScene.printScore(qprinter, self.scoreView)
     dialog.paintRequested.connect(updatePages)
     dialog.exec_()
开发者ID:jguardon,项目名称:DrumBurp,代码行数:11,代码来源:DBMainwindow.py

示例7: printPage

def printPage(ok):
    printer = QPrinter()
    printer.setOutputFormat(QPrinter.PdfFormat)
    printer.setOrientation(QPrinter.Landscape)
    printer.setPageMargins(0.1,0.1,0.1,0.1, QPrinter.Millimeter)
    printer.setOutputFileName(sys.argv[2])
    view.print_(printer)    
    app.exit()
开发者ID:anjohnson,项目名称:pvDataWWW,代码行数:8,代码来源:qtweb.py

示例8: plotSVG

    def plotSVG(self, width, height, output_file, _plotting_object = None):

        """Plots the data specified in the current input file as a page in a
        PDF file with the given width and height, writing the output to the
        specified output file. Returns the SVG object produced."""

        printer = QPrinter()
        svg = QSvgGenerator()
        svg.setFileName(output_file)
        svg.setSize(QSize(width, height))
        svg.setViewBox(QRect(0, 0, width, height))
        svg.setResolution(printer.resolution())
        return self._plot(width, height, svg, _plotting_object)[0]
开发者ID:metno,项目名称:python-diana,代码行数:13,代码来源:bdiana.py

示例9: WebKitPDF

class WebKitPDF ( QObject ):

  def __init__ ( self, url, dest ):
    QObject.__init__ ( self )
    self.dest = dest
    self.page = QtWebKit.QWebPage ( self )
    self.mainFrame = self.page.mainFrame()
    self.mainFrame.load ( QUrl ( url ) )

    # Settings
    # Disable the scrollbars
    self.mainFrame.setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
    self.mainFrame.setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)

    self.connect ( self.page,
             SIGNAL ( "loadProgress(int)" ),
             self.loadProgress )

    self.connect ( self.page,
             SIGNAL ( "loadFinished(bool)" ),
             self.renderPDF )



  def loadProgress ( self, progress ):
    print "Progress: ", progress


  def renderPDF ( self, status ):
    print "Load finished with status: ", status
    print "Rendering PDF ..."

    contentsSize = self.mainFrame.contentsSize()
    contentsSize.setWidth(1280)
    self.page.setViewportSize ( contentsSize )

    self.printer = QPrinter ( QPrinter.PrinterResolution )
    #self.printer = QPrinter ( QPrinter.ScreenResolution )
    self.printer.setOutputFormat ( QPrinter.PdfFormat )
    #self.printer.setPaperSize ( QPrinter.A4 )
    self.printer.setFullPage( True )
    self.printer.setPaperSize ( QSizeF( contentsSize ), QPrinter.DevicePixel )
    self.printer.setOrientation ( QPrinter.Portrait )
    self.printer.setOutputFileName ( self.dest )

    self.painter = QPainter ( self.printer )
    self.painter.setRenderHint ( QPainter.Antialiasing )
    self.mainFrame.render ( self.painter )
    self.painter.end()
    app = QtGui.QApplication.instance()
    app.exit ( 0 )
开发者ID:kholidfu,项目名称:htmlkepdf,代码行数:51,代码来源:gistfile2.py

示例10: 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('Graphics', 'Print Document'))
     if dialog.exec_() != QDialog.Accepted:
         return
     # FIXME: on windows the resolutions seems to be very low, why?
     #printer.setResolution(600)
     painter = QPainter(printer)
     painter.setRenderHint(QPainter.Antialiasing)
     self.graphicsView.scene().render(painter)
开发者ID:BackupTheBerlios,项目名称:simuvis4-svn,代码行数:14,代码来源:GraphicsWindow.py

示例11: printBill

    def printBill(self):
        self.saveTab() #save before printing so that changes will be added to print
        
        html = self.creator.makePrintfile(self.item)
        document = QWebView()
        document.setHtml(html)

        printer = QPrinter()
        
        printer.setOutputFileName(getBillPath() + str(datetime.datetime.now())[0:-7] + '_' + str(self.item.id) + '.pdf')
        
        printpreview = QPrintDialog(printer, self)
        printpreview.exec()
        
        document.print(printer)
开发者ID:mape90,项目名称:VetApp,代码行数:15,代码来源:billTab.py

示例12: __saveAsPDF

    def __saveAsPDF( self, fileName ):
        " Saves the flowchart as an PDF file "
        printer = QPrinter()
        printer.setOutputFormat( QPrinter.PdfFormat )
        printer.setPaperSize( QSizeF( self.scene.width(),
                                      self.scene.height() ), QPrinter.Point )
        printer.setFullPage( True )
        printer.setOutputFileName( fileName )

        painter = QPainter( printer )
        self.scene.render( painter )
        painter.end()
        return
开发者ID:fukanchik,项目名称:codimension,代码行数:13,代码来源:flowuiwidget.py

示例13: __init__

    def __init__(self, parent):
        QFrame.__init__(self,parent)

        self.filename = QString()
        self.copiedItem = QByteArray()
        self.pasteOffset = 5
        self.prevPoint = QPoint()
        self.addOffset = 5
        
        self.screenSize = (320, 240)
        self.bgColor = QColor(244,244,244)
        '''0.Portrait 1.Landscape'''
        self.orientation = 0
        self.currentItem = None
        

        self.printer = QPrinter(QPrinter.HighResolution)
        self.printer.setPageSize(QPrinter.Letter)


        '''Header'''
        self.headingBar = HeadingBar(self)
        '''WidgetsBar'''
        self.widgetsBar = WidgetsBar(self)
        '''Property'''
        self.propertyBar = PropertyBar(self)
        
        '''view'''
        viewLayoutWidget = QFrame()
        viewLayoutWidget.setFrameShape(QFrame.StyledPanel)
        viewLayout = QHBoxLayout(viewLayoutWidget)
        #viewLayout.setMargin(10)
        self.view = ScreenView(viewLayoutWidget)
        '''scene'''
        self.scene = QGraphicsScene(self)
        
        #self.scene.selectionChanged.connect(self.setConnect)
        #self.view.setStyleSheet("border: 1px solid red;")
        
        self.setBackgroundColor(self.bgColor)
        self.setScreenSize(self.screenSize)
        
        self.view.setScene(self.scene)
        self.view.setAlignment(Qt.AlignCenter)
        self.connect(self.view, SIGNAL("dropped"),self.addPixmapFile)
        self.scroll_off = 1
        self.setScrollBar()
        
        viewLayout.setMargin(0)
        viewLayout.addWidget(self.view)

        self.wrapped = [] # Needed to keep wrappers alive
        layout = QVBoxLayout(self)
        layout.addWidget(self.headingBar)
        layout.addWidget(viewLayoutWidget)
        layout.addWidget(self.widgetsBar)
        layout.addWidget(self.propertyBar)
        layout.setMargin(0)
        self.setLayout(layout)
开发者ID:pyros2097,项目名称:SabelIDE,代码行数:59,代码来源:designer.py

示例14: imprimir

    def imprimir(self):
        print('Prepandando impresion')

        self.printer = QPrinter(QPrinter.HighResolution);
        self.printer.setPageSize(QPrinter.A4);
        self.printer.setOrientation(QPrinter.Portrait);
        self.printer.setPageMargins(10, 10, 10, 10, QPrinter.Millimeter)
        self.navegador.print_(self.printer)
开发者ID:arkadoel,项目名称:openbascula,代码行数:8,代码来源:Dialogo_impresion.py

示例15: printer

 def printer(self):
     if self._printer is None:
         self._printer = QPrinter(QPrinter.HighResolution)
         self._printer.setOrientation(QtGui.QPrinter.Landscape)
         self._printer.setFullPage(True)
         #self.translate(-15, -15)
     self._printer.setDocName(self.ganttWidget.ganttModel.name)
     return self._printer
开发者ID:sebastianelsner,项目名称:pmp,代码行数:8,代码来源:printhandler.py


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