def printPreviewDialog(self):
        printer = QPrinter(QPrinter.HighResolution)
        previewDialog = QPrintPreviewDialog(printer, self)

        previewDialog.paintRequested.connect(
            self.printPreview)  # Rempli le dialog
        previewDialog.exec_()  # Lance le dialog
Esempio n. 2
0
    def printpreviewDialog(self):
        printer = QPrinter(QPrinter.HighResolution)
        previewDialog = QPrintPreviewDialog(printer,
                                            parent=None,
                                            flags=Qt.WindowFlags())

        previewDialog.paintRequested.connect(self.printImage)
        previewDialog.exec_()
Esempio n. 3
0
    def print_preview(self) -> None:
        printer = QPrinter()
        printer.setOutputFormat(QPrinter.NativeFormat)

        dialog = QPrintPreviewDialog(printer, self)
        dialog.setWindowFlags(Qt.Window)
        dialog.paintRequested.connect(self.print)
        dialog.showMaximized()
        dialog.exec_()
Esempio n. 4
0
    def print_preview(self, text_edit: Union[QTextEdit, MyPlainTextEdit]):
        """
        Print preview a given text editor's `document()` at High Resolution.

        :param text_edit: A text editor containing a `document()` QTextDocument.
        :return: None. Side effect: modal print preview.
        """
        if text_edit == self.md_text_edit:
            self.update_markdown_viewer()
        printer = QPrinter(QPrinter.HighResolution)
        ppd = QPrintPreviewDialog(printer)
        ppd.paintRequested.connect(lambda: self.print_(printer, text_edit))
        ppd.exec_()
Esempio n. 5
0
    def print(self, test: bool) -> None:
        """setup and preview pViewTable for paper printing

        Returns:
            None"""

        with open(self.file_path) as f:
            self.data = json.dumps(dict(json.load(f)),
                                   sort_keys=True,
                                   indent=6,
                                   separators=(".", "="))
        self.document = QtWidgets.QTextEdit()
        self.document.setText(self.data)

        if not test:
            printer = QPrinter()
            previewDialog = QPrintPreviewDialog(printer, self)
            previewDialog.paintRequested.connect(
                lambda: self.document.print_(printer))
            previewDialog.exec_()
    def print_preview_dialog(self):
        printer = QPrinter(QPrinter.HighResolution)
        previewDialog = QPrintPreviewDialog(printer, self)

        previewDialog.paintRequested.connect(self.print_preview)
        previewDialog.exec_()
Esempio n. 7
0
 def handlePreview(self):
     dialog = QPrintPreviewDialog()
     dialog.paintRequested.connect(self.handlePaintRequest)
     dialog.exec_()
Esempio n. 8
0
 def printpreviewDialog(self):
     previewDialog = QPrintPreviewDialog()
     previewDialog.paintRequested.connect(self.printPreview)  
     previewDialog.exec_()