def OnPrint(self): """""" document = self.document() printer = QPrinter() dlg = QPrintDialog(printer, self) if dlg.exec_() != QDialog.Accepted: return document.print_(printer)
def print_(self): canvas = self.mw.get_current_canvas() if not canvas: return printer = QPrinter() dlg = QPrintDialog(printer, self.mw) if dlg.exec_() == QDialog.Accepted: painter = QPainter(printer) painter.drawImage(0, 0, canvas.image) painter.end()
def print_(self): """ TOWRITE """ dialog = QPrintDialog(self.printer, self) if dialog.exec_() == QDialog.Accepted: painter = QPainter(self.printer) if self.mainWin.getSettingsPrintingDisableBG(): # Save current bg. brush = self.gview.backgroundBrush() # QBrush # Save ink by not printing the bg at all. self.gview.setBackgroundBrush(Qt.NoBrush) # Print, fitting the viewport contents into a full page. self.gview.render(painter) # Restore the bg. self.gview.setBackgroundBrush(brush) else: # Print, fitting the viewport contents into a full page self.gview.render(painter)