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


Python QPrintDialog.setWindowTitle方法代码示例

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


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

示例1: _print_report

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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: printContents

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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

示例3: printWindow

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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

示例4: print_on_paper

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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

示例5: printWindow

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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

示例6: print_webpage

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [as 别名]
 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
开发者ID:totalretribution,项目名称:wcgbrowser,代码行数:13,代码来源:browser.py

示例7: print_

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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

示例8: printWindow

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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('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,代码行数:16,代码来源:GraphicsWindow.py

示例9: printdoc

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [as 别名]
    def printdoc(self):
        """
        Prints the document in the view
        """
        printer = QPrinter()

        setup = QPageSetupDialog(printer)
        setup.setWindowTitle("Print - Page Settings")

        if setup.exec_() == QDialog.Accepted:
            dialog = QPrintDialog(printer, self)
            dialog.setWindowTitle("Print Document")

            if dialog.exec_() == QDialog.Accepted:
                self.ui.webviewResult.print_(printer)
开发者ID:cidles,项目名称:poio-analyzer,代码行数:17,代码来源:poioanalyzer.py

示例10: printSource

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [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

示例11: print_

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [as 别名]
def print_(doc, filename=None, widget=None):
    """Prints the popplerqt4.Poppler.Document.
    
    The filename is used in the dialog and print job name.
    If the filename is not given, it defaults to a translation of "PDF Document".
    The widget is a widget to use as parent for the print dialog etc.
    
    """
    # Decide how we will print.
    # on Windows and Mac OS X a print command must be specified, otherwise
    # we'll use raster printing
    s = QSettings()
    s.beginGroup("helper_applications")
    cmd = s.value("printcommand", "", type(""))
    use_dialog = s.value("printcommand/dialog", False, bool)
    resolution = s.value("printcommand/dpi", 300, int)
    linux_lpr = False
    
    if os.name != 'nt' and not sys.platform.startswith('darwin'):
        # we're probably on Linux
        if not cmd:
            cmd = fileprinter.lprCommand()
            if cmd:
                linux_lpr = True
        elif cmd.split('/')[-1] in fileprinter.lpr_commands:
            linux_lpr = True

    print_file = filename
    title = os.path.basename(filename) if filename else _("PDF Document")
    printer = QPrinter()
    printer.setDocName(title)
    printer.setPrintRange(QPrinter.AllPages)
    
    if linux_lpr or use_dialog or not cmd:
        dlg = QPrintDialog(printer, widget)
        dlg.setMinMax(1, doc.numPages())
        dlg.setOption(QPrintDialog.PrintToFile, False)
        dlg.setWindowTitle(app.caption(_("Print {filename}").format(filename=title)))
        
        result = dlg.exec_()
        if widget:
            dlg.deleteLater() # because it has a parent
        if not result:
            return # cancelled
    
    if linux_lpr or '$ps' in cmd:
        # make a PostScript file with the desired paper size
        ps = QTemporaryFile()
        if ps.open() and qpopplerview.printer.psfile(doc, printer, ps):
            ps.close()
            print_file = ps.fileName()
    elif cmd:
        if printer.printRange() != QPrinter.AllPages:
            cmd = None # we can't cut out pages from a PDF file
        elif '$pdf' not in cmd:
            cmd += ' $pdf'
    
    command = []
    if linux_lpr:
        # let all converted pages print
        printer.setPrintRange(QPrinter.AllPages)
        command = fileprinter.printCommand(cmd, printer, ps.fileName())
    elif cmd and print_file:
        for arg in helpers.shell_split(cmd):
            if arg in ('$ps', '$pdf'):
                command.append(print_file)
            else:
                arg = arg.replace('$printer', printer.printerName())
                command.append(arg)
    if command:
        if subprocess.call(command):
            QMessageBox.warning(widget, _("Printing Error"),
                _("Could not send the document to the printer."))
        return
    else:
        # Fall back printing of rendered raster images.
        # It is unsure if the Poppler ArthurBackend ever will be ready for
        # good rendering directly to a painter, so we'll fall back to using
        # raster images.
        
        p = Printer()
        p.setDocument(doc)
        p.setPrinter(printer)
        p.setResolution(resolution)
        
        d = QProgressDialog()
        d.setModal(True)
        d.setMinimumDuration(0)
        d.setRange(0, len(p.pageList()) + 1)
        d.canceled.connect(p.abort)
        
        def progress(num, total, page):
            d.setValue(num)
            d.setLabelText(_("Printing page {page} ({num} of {total})...").format(
                page=page, num=num, total=total))
                
        def finished():
            p.deleteLater()
            d.deleteLater()
            d.hide()
#.........这里部分代码省略.........
开发者ID:uliska,项目名称:frescobaldi,代码行数:103,代码来源:popplerprint.py

示例12: print_

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [as 别名]
def print_(doc, filename=None, widget=None):
    """Prints the popplerqt4.Poppler.Document.
    
    The filename is used in the dialog and print job name.
    If the filename is not given, it defaults to a translation of "PDF Document".
    The widget is a widget to use as parent for the print dialog etc.
    
    """
    cmd = fileprinter.lprCommand()
    if not cmd and QMessageBox.information(widget, _("Warning"), _(
        "No print command to print a PostScript file could be found.\n\n"
        "Therefore the document will be printed using raster images at {resolution} DPI. "
        "It is recommended to print using a dedicated PDF viewer.\n\n"
        "Do you want to continue?").format(resolution=300),
        QMessageBox.Yes | QMessageBox.No) != QMessageBox.Yes:
        return # cancelled
        
    filename = os.path.basename(filename) if filename else _("PDF Document")
    
    printer = QPrinter()
    printer.setDocName(filename)
    
    dlg = QPrintDialog(printer, widget)
    dlg.setMinMax(1, doc.numPages())
    dlg.setOption(QPrintDialog.PrintToFile, False)
    dlg.setWindowTitle(app.caption(_("Print {filename}").format(filename=filename)))
    
    result = dlg.exec_()
    if widget:
        dlg.deleteLater() # because it has a parent
    if not result:
        return # cancelled
    
    if cmd:
        # make a PostScript file with the desired paper size
        ps = QTemporaryFile()
        if ps.open() and qpopplerview.printer.psfile(doc, printer, ps):
            ps.close()
            # let all converted pages print
            printer.setPrintRange(QPrinter.AllPages)
            command = fileprinter.printCommand(cmd, printer, ps.fileName())
            if not subprocess.call(command):
                return # success!
        QMessageBox.warning(widget, _("Printing Error"),
            _("Could not send the document to the printer."))
    else:
        # Fall back printing of rendered raster images.
        # It is unsure if the Poppler ArthurBackend ever will be ready for
        # good rendering directly to a painter, so we'll fall back to using
        # 300DPI raster images.
        
        p = Printer()
        p.setDocument(doc)
        p.setPrinter(printer)
        p.setResolution(300)
        
        d = QProgressDialog()
        d.setModal(True)
        d.setMinimumDuration(0)
        d.setRange(0, len(p.pageList()) + 1)
        d.canceled.connect(p.abort)
        
        def progress(num, total, page):
            d.setValue(num)
            d.setLabelText(_("Printing page {page} ({num} of {total})...").format(
                page=page, num=num, total=total))
                
        def finished():
            p.deleteLater()
            d.deleteLater()
            d.hide()
            if not p.success and not p.aborted():
                QMessageBox.warning(widget, _("Printing Error"),
                    _("Could not send the document to the printer."))
            
        p.finished.connect(finished)
        p.printing.connect(progress)
        p.start()
开发者ID:WedgeLeft,项目名称:frescobaldi,代码行数:80,代码来源:popplerprint.py

示例13: slotPrint

# 需要导入模块: from PyQt4.QtGui import QPrintDialog [as 别名]
# 或者: from PyQt4.QtGui.QPrintDialog import setWindowTitle [as 别名]
 def slotPrint(self):
     printer = QPrinter()
     dlg = QPrintDialog(printer, self)
     dlg.setWindowTitle(app.caption(_("Print")))
     if dlg.exec_():
         self.webview.print_(printer)
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:8,代码来源:browser.py


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