Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 def printMail(self):
     printer = QPrinter(mode=QPrinter.HighResolution)
     printer.setCreator("Daaq Mail")
     title = 'Daaq Mail'
     #title = validateFileName(title)
     printer.setDocName(title)
     printer.setOutputFileName(DOC_DIR + title + ".pdf")
     print_dialog = QPrintPreviewDialog(printer, self)
     print_dialog.paintRequested.connect(self.textViewer.print_)
     print_dialog.exec_()
Esempio n. 4
0
 def __outPDF(self):
     """
     To save the profile as pdf file
     """
     fileName = QFileDialog.getSaveFileName(
         self.__iface.mainWindow(), QCoreApplication.translate("VDLTools", "Save As"),
         QCoreApplication.translate("VDLTools", "Profile.pdf"),"Portable Document Format (*.pdf)")
     if fileName is not None:
         if self.__lib == 'Qwt5':
             printer = QPrinter()
             printer.setCreator(QCoreApplication.translate("VDLTools", "QGIS Profile Plugin"))
             printer.setOutputFileName(fileName)
             printer.setOutputFormat(QPrinter.PdfFormat)
             printer.setOrientation(QPrinter.Landscape)
             self.__plotWdg.print_(printer)
         elif self.__lib == 'Matplotlib':
             self.__plotWdg.figure.savefig(str(fileName))
Esempio n. 5
0
 def __outPDF(self):
     """
     To save the profile as pdf file
     """
     fileName = QFileDialog.getSaveFileName(
         self.__iface.mainWindow(), QCoreApplication.translate("VDLTools", "Save As"),
         QCoreApplication.translate("VDLTools", "Profile.pdf"),"Portable Document Format (*.pdf)")
     if fileName is not None:
         if self.__lib == 'Qwt5':
             printer = QPrinter()
             printer.setCreator(QCoreApplication.translate("VDLTools", "QGIS Profile Plugin"))
             printer.setOutputFileName(fileName)
             printer.setOutputFormat(QPrinter.PdfFormat)
             printer.setOrientation(QPrinter.Landscape)
             self.__plotWdg.print_(printer)
         elif self.__lib == 'Matplotlib':
             self.__plotWdg.figure.savefig(str(fileName))
 def outPDF(self, iface, wdg, mdl, library):
     for i in range(0, mdl.rowCount()):
         if mdl.item(i, 0).data(Qt.CheckStateRole):
             name = str(mdl.item(i, 2).data(Qt.EditRole))
             break
     fileName = QFileDialog.getSaveFileName(
         iface.mainWindow(), "Save As", "Profile of " + name + ".pdf",
         "Portable Document Format (*.pdf)")
     if fileName:
         if library == "Qwt5" and has_qwt:
             printer = QPrinter()
             printer.setCreator('QGIS Profile Plugin')
             printer.setOutputFileName(fileName)
             printer.setOutputFormat(QPrinter.PdfFormat)
             printer.setOrientation(QPrinter.Landscape)
             wdg.plotWdg.print_(printer)
         elif library == "Matplotlib" and has_mpl:
             wdg.plotWdg.figure.savefig(str(fileName))
 def outPrint(
         self, iface, wdg, mdl,
         library):  # Postscript file rendering doesn't work properly yet.
     for i in range(0, mdl.rowCount()):
         if mdl.item(i, 0).data(Qt.CheckStateRole):
             name = str(mdl.item(i, 2).data(Qt.EditRole))
             #return
     fileName = QFileDialog.getSaveFileName(iface.mainWindow(), "Save As",
                                            "Profile of " + name + ".ps",
                                            "PostScript Format (*.ps)")
     if fileName:
         if library == "Qwt5" and has_qwt:
             printer = QPrinter()
             printer.setCreator("QGIS Profile Plugin")
             printer.setDocName("QGIS Profile")
             printer.setOutputFileName(fileName)
             printer.setColorMode(QPrinter.Color)
             printer.setOrientation(QPrinter.Portrait)
             dialog = QPrintDialog(printer)
             if dialog.exec_():
                 wdg.plotWdg.print_(printer)
         elif library == "Matplotlib" and has_mpl:
             wdg.plotWdg.figure.savefig(str(fileName))
 def saveWindow(self):
     fileTypes = {'PDF':('pdf',), 'Postscript':('ps',),'SVG':('svg',)}
     filters = ';;'.join(['%s (%s)' % (k, ' '.join(['*.'+e for e in v])) for k, v in fileTypes.items()])
     dlg = QFileDialog(self,
         QCoreApplication.translate('QwtPlot', 'Select type and name of file to save'),
         SimuVis4.Globals.defaultFolder or '', filters)
     dlg.setFileMode(QFileDialog.AnyFile)
     dlg.setAcceptMode(QFileDialog.AcceptSave)
     if dlg.exec_() != QDialog.Accepted:
         return
     tmp = str(dlg.selectedFilter())
     fileType = tmp[:tmp.find('(')-1]
     dlg.setDefaultSuffix(fileTypes[fileType][0])
     files = dlg.selectedFiles()
     if not files:
         return
     fileName = unicode(files[0])
     SimuVis4.Globals.defaultFolder, tmp = os.path.split(fileName)
     if fileType == 'PDF':
         printer = QPrinter()
         printer.setOutputFormat(QPrinter.PdfFormat)
         printer.setOrientation(QPrinter.Landscape)
         printer.setOutputFileName(fileName)
         printer.setCreator('SimuVis4')
         self.plot.print_(printer)
     elif fileType == 'Postscript':
         printer = QPrinter()
         printer.setOutputFormat(QPrinter.PostScriptFormat)
         printer.setOrientation(QPrinter.Landscape)
         printer.setOutputFileName(fileName)
         printer.setCreator('SimuVis4')
         self.plot.print_(printer)
     elif fileType == 'SVG':
         generator = QSvgGenerator()
         generator.setFileName(fileName)
         generator.setSize(QSize(800, 600))
         self.plot.print_(generator)