Esempio n. 1
0
 def savepdf(self):
     self.combbox()
     fig = plot.figure()
     # plot.subplot(2,1,1)
     # plot.plot(self.audio2[0:],color='black',linewidth=0.005,scalex=True)
     # plot.title("before")
     plot.subplot(2, 1, 2)
     max = self.max_freq_slider.value()
     min = self.min_freq_slider.value()
     self.powerSpectrum, self.freqenciesFound, self.time, self.imageAxis = plot.specgram(
         self.signal.real,
         Fs=self.samplingrate,
         cmap=self.cmap,
         vmin=min,
         vmax=max)
     plot.colorbar()
     plot.xlabel('Time')
     plot.ylabel('Frequency')
     plot.subplot(2, 1, 1)
     plot.plot(self.signal[0:].real,
               color='blue',
               linewidth=0.003,
               scalex=True)
     plot.title("after")
     fn, _ = QtWidgets.QFileDialog.getSaveFileName(
         self, "Export PDF", None, "PDF files (.pdf);;All Files()")
     if fn:
         if QtCore.QFileInfo(fn).suffix() == "": fn += ".pdf"
         fig.savefig(fn)
     plot.close()
Esempio n. 2
0
def restore(settings):
    finfo = QtCore.QFileInfo(settings.fileName())
    if finfo.exists() and finfo.isFile():
        for w in QtWidgets.qApp.allWidgets():
            mo = w.metaObject()
            if w.objectName() and not w.objectName().startswith("qt_"):
                settings.beginGroup(w.objectName())
                for i in range(mo.propertyCount(),
                               mo.propertyOffset() - 1, -1):
                    prop = mo.property(i)
                    if prop.isWritable():
                        name = prop.name()
                        val = settings.value(name, w.property(name))
                        if str(val).isdigit():
                            val = int(val)
                        w.setProperty(name, val)
                settings.endGroup()