def PrintDocument(self, document, tofile=0): bbox = document.BoundingRect(visible=0, printable=1) if bbox is None: msgDialog( self.mw.root, title=_("Printing"), message=_( "The document doesn't have \n any printable layers!\n")) return ############ ---> if tofile: directory = config.preferences.dir_for_vector_export filename = document.meta.filename[:-4] + '.pdf' filename, pdffile = dialogman.getGenericSaveFilename( _("Print into PDF file"), pdf_types, initialdir=directory, initialfile=filename) if filename == '': return dlg = ProgressDialog(self.mw.root, 'PDF generation') dlg.RunDialog(self.print_tofile_callback, document, pdffile) else: dlg = ProgressDialog(self.mw.root, 'PDF generation') command, pdffile = dlg.RunDialog(self.print_callback, document) os.system(command)
def ExportPNG(self, document): directory = config.preferences.dir_for_bitmap_export filename = document.meta.filename[:-4] + ".png" filename, pngfile = dialogman.getGenericSaveFilename( _("PNG export"), png_types, initialdir=directory, initialfile=filename ) if filename == "": return fileformat = filters.guess_export_plugin(".png") saver = filters.find_export_plugin(fileformat) saver(document, pngfile)
def ExportPNG(self, document): directory = config.preferences.dir_for_bitmap_export filename = document.meta.filename[:-4] + '.png' filename, pngfile = dialogman.getGenericSaveFilename( _("PNG export"), png_types, initialdir=directory, initialfile=filename) if filename == '': return fileformat = filters.guess_export_plugin('.png') saver = filters.find_export_plugin(fileformat) saver(document, pngfile)
def PrintDocument(self, document, tofile=0): bbox = document.BoundingRect(visible=0, printable=1) if bbox is None: msgDialog( self.mw.root, title=_("Printing"), message=_("The document doesn't have \n any printable layers!\n") ) return ############ ---> if tofile: directory = config.preferences.dir_for_vector_export filename = document.meta.filename[:-4] + ".pdf" filename, pdffile = dialogman.getGenericSaveFilename( _("Print into PDF file"), pdf_types, initialdir=directory, initialfile=filename ) if filename == "": return dlg = ProgressDialog(self.mw.root, "PDF generation") dlg.RunDialog(self.print_tofile_callback, document, pdffile) else: dlg = ProgressDialog(self.mw.root, "PDF generation") command, pdffile = dlg.RunDialog(self.print_callback, document) os.system(command)