コード例 #1
0
 def exportTo(self, plot, documentname, sizeMM=None, resolution=85):
     if plot is None:
         return
     if sizeMM is None:
         sizeMM = QSizeF(300, 200)
     filename = documentname
     imageFormats = QImageWriter.supportedImageFormats()
     filter_ = ["PDF documents (*.pdf)",
                "SVG documents (*.svg)",
                "Postscript documents (*.ps)"]
     if imageFormats:
         imageFilter = "Images"
         imageFilter += " ("
         for idx, fmt in enumerate(imageFormats):
             if idx > 0:
                 imageFilter += " "
             imageFilter += "*."+str(fmt)
         imageFilter += ")"
         filter_ += [imageFilter]
     filename, _s = getsavefilename(plot, "Export File Name", filename,
                                ";;".join(filter_),
                                options=QFileDialog.DontConfirmOverwrite)
     if not filename:
         return False
     self.renderDocument(plot, filename, sizeMM, resolution)
     return True
コード例 #2
0
 def exportTo(self, plot, documentname, sizeMM=None, resolution=85):
     if plot is None:
         return
     if sizeMM is None:
         sizeMM = QSizeF(300, 200)
     filename = documentname
     imageFormats = QImageWriter.supportedImageFormats()
     filter_ = [
         "PDF documents (*.pdf)", "SVG documents (*.svg)",
         "Postscript documents (*.ps)"
     ]
     if imageFormats:
         imageFilter = "Images"
         imageFilter += " ("
         for idx, fmt in enumerate(imageFormats):
             if idx > 0:
                 imageFilter += " "
             imageFilter += "*." + str(fmt)
         imageFilter += ")"
         filter_ += [imageFilter]
     filename, _s = getsavefilename(
         plot,
         "Export File Name",
         filename,
         ";;".join(filter_),
         options=QFileDialog.DontConfirmOverwrite)
     if not filename:
         return False
     self.renderDocument(plot, filename, sizeMM, resolution)
     return True
コード例 #3
0
ファイル: plot_renderer.py プロジェクト: gyenney/Tools
    def exportTo(self, plot, documentname, sizeMM=None, resolution=85):
        """
        Execute a file dialog and render the plot to the selected file

        :param qwt.plot.QwtPlot plot: Plot widget
        :param str documentName: Default document name
        :param QSizeF sizeMM: Size for the document in millimeters
        :param int resolution: Resolution in dots per Inch (dpi)
        :return: True, when exporting was successful
        
        .. seealso::
        
            :py:meth:`renderDocument()`
        """
        if plot is None:
            return
        if sizeMM is None:
            sizeMM = QSizeF(300, 200)
        filename = documentname
        imageFormats = QImageWriter.supportedImageFormats()
        filter_ = [
            "PDF documents (*.pdf)", "SVG documents (*.svg)",
            "Postscript documents (*.ps)"
        ]
        if imageFormats:
            imageFilter = "Images"
            imageFilter += " ("
            for idx, fmt in enumerate(imageFormats):
                if idx > 0:
                    imageFilter += " "
                imageFilter += "*." + str(fmt)
            imageFilter += ")"
            filter_ += [imageFilter]
        filename, _s = getsavefilename(
            plot,
            "Export File Name",
            filename,
            ";;".join(filter_),
            options=QFileDialog.DontConfirmOverwrite)
        if not filename:
            return False
        self.renderDocument(plot, filename, sizeMM, resolution)
        return True
コード例 #4
0
ファイル: plot_renderer.py プロジェクト: robinkqin/PythonQwt
    def exportTo(self, plot, documentname, sizeMM=None, resolution=85):
        """
        Execute a file dialog and render the plot to the selected file

        :param qwt.plot.QwtPlot plot: Plot widget
        :param str documentName: Default document name
        :param QSizeF sizeMM: Size for the document in millimeters
        :param int resolution: Resolution in dots per Inch (dpi)
        :return: True, when exporting was successful
        
        .. seealso::
        
            :py:meth:`renderDocument()`
        """
        if plot is None:
            return
        if sizeMM is None:
            sizeMM = QSizeF(300, 200)
        filename = documentname
        imageFormats = QImageWriter.supportedImageFormats()
        filter_ = ["PDF documents (*.pdf)",
                   "SVG documents (*.svg)",
                   "Postscript documents (*.ps)"]
        if imageFormats:
            imageFilter = "Images"
            imageFilter += " ("
            for idx, fmt in enumerate(imageFormats):
                if idx > 0:
                    imageFilter += " "
                imageFilter += "*."+str(fmt)
            imageFilter += ")"
            filter_ += [imageFilter]
        filename, _s = getsavefilename(plot, "Export File Name", filename,
                                   ";;".join(filter_),
                                   options=QFileDialog.DontConfirmOverwrite)
        if not filename:
            return False
        self.renderDocument(plot, filename, sizeMM, resolution)
        return True