def accept(self): """Reimplement Qt method""" for index in range(self.stack.count()): self.stack.widget(index).accept_changes() QDialog.accept(self)
def accept(self): """Reimplement Qt method""" if not self.runconfigoptions.is_valid(): return configurations = _get_run_configurations() configurations.insert(0, (self.filename, self.runconfigoptions.get())) _set_run_configurations(configurations) QDialog.accept(self)
def accept(self): """Reimplement Qt method""" for index in range(self.pages_widget.count()): configpage = self.get_page(index) if not configpage.is_valid(): return configpage.apply_changes() QDialog.accept(self)
def accept(self): ''' Applies the changes to the master/slaves. ''' self.__signal_model.free_all() for master_name, slaves in self.__model.rows.items(): self.__signal_model.enslave(master_name, slaves) QDialog.accept(self)
def accept(self): """Reimplement Qt method.""" try: for index in range(self.stack.count()): self.stack.widget(index).accept_changes() QDialog.accept(self) except RuntimeError: # Sometimes under CI testing the object the following error appears # RuntimeError: wrapped C/C++ object has been deleted pass
def accept(self): ''' Executes the ffmpeg command. ''' if self.__extracted is False: self.__extract() if not self.__is_remux: self.signalName.setEnabled(True) self.signalNameLabel.setEnabled(True) else: if self.__create_signals(): QDialog.accept(self)
def accept(self): """Reimplement Qt method""" configurations = [] for index in range(self.stack.count()): filename = to_text_string(self.combo.itemText(index)) runconfigoptions = self.stack.widget(index) if index == self.stack.currentIndex() and not runconfigoptions.is_valid(): return options = runconfigoptions.get() configurations.append((filename, options)) _set_run_configurations(configurations) QDialog.accept(self)
def accept(self): """Reimplement Qt method""" configurations = [] for index in range(self.stack.count()): filename = to_text_string(self.combo.itemText(index)) runconfigoptions = self.stack.widget(index) if index == self.stack.currentIndex() and\ not runconfigoptions.is_valid(): return options = runconfigoptions.get() configurations.append( (filename, options) ) _set_run_configurations(configurations) QDialog.accept(self)
def accept(self): """ Update `show_errors` and hide dialog box. Overrides method of `QDialogBox`. """ AutosaveErrorDialog.show_errors = not self.dismiss_box.isChecked() return QDialog.accept(self)
def accept(self): formats = "Portable Network Graphic (*.png)" file_name = self.__dialog.getSaveFileName(self, 'Export Chart', f"{self.name}.png", formats) if file_name: output_file = str(file_name[0]).strip() if len(output_file) == 0: return else: self.exporter.parameters()['width'] = self.widthPixels.value() self.__force_to_int('height') self.__force_to_int('width') self.exporter.export(output_file) if self.statusbar is not None: self.statusbar.showMessage( f"Saved {self.name} to {output_file}", 5000) QDialog.accept(self)
def accept(self): formats = "Portable Network Graphic (*.png)" fileName = self.__dialog.getSaveFileName(self, 'Export Chart', f"{self.chart.name}.png", formats) if fileName: outputFile = str(fileName[0]).strip() if len(outputFile) == 0: return else: scaleFactor = self.widthPixels.value() / self.__x self.chart._chart.canvas.figure.savefig(outputFile, format='png', dpi=self.__dpi * scaleFactor) self.statusbar.showMessage( f"Saved {self.chart.name} to {outputFile}", 5000) QDialog.accept(self)
def accept(self): signal_name = self.signal.currentText() if signal_name is not None and signal_name.startswith('(BM) '): to_export = next((s for s in self.__signal_model.bass_managed_signals if s.name == signal_name[5:]), None) else: to_export = next( (s for s in self.__signal_model if s.name == signal_name), None) if to_export: if self.__mode == Mode.FRD: self.export_frd(to_export) elif self.__mode == Mode.SIGNAL: self.export_signal(to_export) QDialog.accept(self)
def accept(self): ''' Saves the locations if they exist. ''' self.__preferences.set(SYSTEM_CHECK_FOR_UPDATES, self.checkForUpdates.isChecked()) self.__preferences.set(SYSTEM_CHECK_FOR_BETA_UPDATES, self.checkForBetaUpdates.isChecked()) self.__preferences.set(SUM_X_SCALE, self.xScale.value()) self.__preferences.set(SUM_Y_SCALE, self.yScale.value()) self.__preferences.set(SUM_Z_SCALE, self.zScale.value()) self.__preferences.set(WAV_DOWNLOAD_DIR, self.wavSaveDir.text()) self.__preferences.set(CHART_MAG_MIN, self.magMin.value()) self.__preferences.set(CHART_MAG_MAX, self.magMax.value()) self.__preferences.set(CHART_FREQ_MIN, self.freqMin.value()) self.__preferences.set(CHART_FREQ_MAX, self.freqMax.value()) self.__preferences.set(CHART_SPECTRO_SCALE_ALGO, self.spectroScaleAlgo.currentText()) self.__preferences.set(CHART_SPECTRO_SCALE_FACTOR, self.spectroScaleFactor.currentText()) self.__preferences.set(ANALYSIS_DETREND, self.detrend.currentText().lower()) self.__preferences.set(ANALYSIS_HPF_RTA, self.highpassRTA.isChecked()) # TODO would be nicer to be able to listen to specific values self.__spectro.update_scale() if self.recorders.count() > 0: ips = [ self.recorders.itemText(i) for i in range(self.recorders.count()) ] self.__preferences.set(RECORDER_SAVED_IPS, '|'.join(ips)) self.__recorder_store.load(ips) else: self.__preferences.clear(RECORDER_SAVED_IPS) self.__recorder_store.clear() if self.__should_clear_target is True: self.__preferences.clear(RTA_TARGET) if self.__new_target is not None: self.__preferences.set(RTA_TARGET, self.__new_target) QDialog.accept(self)
def accept(self): name = self.fileName.text() if len(name) > 0: if name[-4:] == '.wav': name = name[:-4] m = next((m for m in self.measurement_store if m.key == self.measurement.currentText()), None) if m is not None: data = m.data output_fs = self.fs if self.outputFs.currentText() != 'Native': output_fs = int( float(self.outputFs.currentText().split(' ')[0]) * 1000) for t in self.axes.selectedItems(): with wait_cursor(): d = data[:, self.__idx(t.text())] / self.sens if self.dcOffset.isChecked(): mean = np.mean(d) d = d - mean logger.debug( f"Removed dc offset: {mean} from {self.measurement.currentText()}:{t.text()}" ) if output_fs != self.fs: start = time.time() d = resample(d, self.fs, output_fs) end = time.time() logger.debug( f"Resampled {self.measurement.currentText()}:{t.text()} in {to_millis(start, end)}ms" ) output_file = os.path.join( self.location.text(), f"{name}_{t.text()}_{output_fs}.wav") wavfile.write(output_file, output_fs, d) if self.statusbar is not None: self.statusbar.showMessage( f"Saved {self.measurement.currentText()}", 5000) QDialog.accept(self)
def accept(self): ''' Exports the measurement as an frd. :param measurement: the measurement. ''' m = self.__data[self.measurementSelector.currentText()] dir_name = QFileDialog(self).getExistingDirectory( self, 'Export FRD', os.path.expanduser('~'), QFileDialog.ShowDirsOnly) if len(dir_name) > 0: for axis in ['x', 'y', 'z', 'sum']: sig = getattr(m, axis) if sig.has_data(sig.view_mode): d = sig.get_analysis() header = self.__make_header(sig) name = os.path.join( dir_name, f"{sig.measurement_name}_{sig.axis}_{sig.view_mode}.frd" ) np.savetxt(name, np.transpose([d.x, d.y]), fmt='%8.3f', header=header) QDialog.accept(self)
def export_frd(self, signal): ''' Exports the signal as a set o FRDs. ''' dir_name = QFileDialog(self).getExistingDirectory( self, 'Export FRD', self.__preferences.get(EXTRACTION_OUTPUT_DIR), QFileDialog.ShowDirsOnly) if len(dir_name) > 0: def __file_name(suffix): return os.path.join(dir_name, f"{signal.name}_{suffix}.frd") header = self.__make_header(signal) # TODO add phase if we have it xy = signal.current_unfiltered[0] np.savetxt(__file_name('avg'), np.transpose([xy.x, xy.y]), fmt='%8.3f', header=header) xy = signal.current_unfiltered[1] np.savetxt(__file_name('peak'), np.transpose([xy.x, xy.y]), fmt='%8.3f', header=header) if len(signal.current_filtered) > 0: xy = signal.current_filtered[0] np.savetxt(__file_name('filter_avg'), np.transpose([xy.x, xy.y]), fmt='%8.3f', header=header) xy = signal.current_filtered[1] np.savetxt(__file_name('filter_peak'), np.transpose([xy.x, xy.y]), fmt='%8.3f', header=header) QDialog.accept(self)
def load(self, measurementModel, dataPathField): ''' Loads the measurements by looking in the selected directory. :param measurementModel: the model to load. :param dataPathField: the display field. :return: ''' selected = self.__dialog.selectedFiles() loadType = self.fileType.currentText() if len(selected) > 0: dataPathField.setText(selected[0]) if loadType == 'txt': measurementModel.load( TxtLoader(self.onFile, selected[0], int(self.fs.currentText())).load()) elif loadType == 'dbl': measurementModel.load( DblLoader(self.onFile, selected[0], int(self.fs.currentText())).load()) elif loadType == 'wav': measurementModel.load( WavLoader(self.onFile, selected[0]).load()) elif loadType == 'HolmImpulse': measurementModel.load( HolmLoader(self.onFile, selected[0]).load()) elif loadType == 'REW': measurementModel.load( REWLoader(self.onFile, selected[0]).load()) elif loadType == 'ARTA': measurementModel.load( ARTALoader(self.onFile, selected[0]).load()) else: measurementModel.clear() dataPathField.setText('') if self.__errors == 0: QDialog.accept(self)
def accept(self): self.data = self.formwidget.get() QDialog.accept(self)
def accept(self): ''' Saves the locations if they exist. ''' self.__save_loc(self.ffmpegDirectory, os.path.isdir, BINARIES_FFMPEG) self.__save_loc(self.ffprobeDirectory, os.path.isdir, BINARIES_FFPROBE) self.__save_loc(self.minidspRsPath, os.path.isdir, BINARIES_MINIDSP_RS) self.__save_loc(self.defaultOutputDirectory, os.path.isdir, EXTRACTION_OUTPUT_DIR) self.__save_loc(self.extractCompleteAudioFile, os.path.isfile, EXTRACTION_NOTIFICATION_SOUND, clear_if_unset=True) text = self.minidspRsOptions.text() if len(text) > 0: self.__preferences.set(MINIDSP_RS_OPTIONS, text) else: self.__preferences.set(MINIDSP_RS_OPTIONS, None) text = self.targetFs.currentText() if text == 'Full Range': self.__preferences.set(ANALYSIS_TARGET_FS, 0) else: self.__preferences.set(ANALYSIS_TARGET_FS, int(text.split(' ')[0])) self.__preferences.set(ANALYSIS_RESOLUTION, float(self.resolutionSelect.currentText().split(' ')[0])) self.__preferences.set(ANALYSIS_AVG_WINDOW, self.avgAnalysisWindow.currentText()) self.__preferences.set(ANALYSIS_PEAK_WINDOW, self.peakAnalysisWindow.currentText()) current_theme = self.__preferences.get(STYLE_MATPLOTLIB_THEME) if current_theme is not None and current_theme != self.themePicker.currentText(): self.alert_on_change('Theme Change') self.__preferences.set(STYLE_MATPLOTLIB_THEME, self.themePicker.currentText()) new_x_scale = 'log' if self.freqIsLogScale.isChecked() else 'linear' update_limits = False if self.__preferences.get(GRAPH_X_AXIS_SCALE) != new_x_scale: update_limits = True self.__preferences.set(GRAPH_X_AXIS_SCALE, new_x_scale) if self.xmin.value() < self.xmax.value(): if self.__preferences.get(GRAPH_X_MIN) != self.xmin.value(): update_limits = True self.__preferences.set(GRAPH_X_MIN, self.xmin.value()) if self.__preferences.get(GRAPH_X_MAX) != self.xmax.value(): update_limits = True self.__preferences.set(GRAPH_X_MAX, self.xmax.value()) else: self.alert_on_change('X Axis Invalid', text='Invalid values: x_min must be less than x_max', icon=QMessageBox.Critical) if self.__preferences.get(GRAPH_EXPAND_Y) != self.expandYLimits.isChecked(): update_limits = True self.__preferences.set(GRAPH_EXPAND_Y, self.expandYLimits.isChecked()) self.__main_chart_limits.set_expand_y(self.expandYLimits.isChecked()) if update_limits: self.__main_chart_limits.update(x_min=self.xmin.value(), x_max=self.xmax.value(), x_scale=new_x_scale, draw=True) self.__preferences.set(SYSTEM_CHECK_FOR_UPDATES, self.checkForUpdates.isChecked()) self.__preferences.set(SYSTEM_CHECK_FOR_BETA_UPDATES, self.checkForBetaUpdates.isChecked()) self.__preferences.set(DISPLAY_LINE_STYLE, self.speclabLineStyle.isChecked()) self.__preferences.set(DISPLAY_SMOOTH_GRAPHS, self.smoothGraphs.isChecked()) self.__preferences.set(EXTRACTION_MIX_MONO, self.monoMix.isChecked()) self.__preferences.set(EXTRACTION_DECIMATE, self.decimate.isChecked()) self.__preferences.set(EXTRACTION_INCLUDE_ORIGINAL, self.includeOriginal.isChecked()) self.__preferences.set(EXTRACTION_INCLUDE_SUBTITLES, self.includeSubtitles.isChecked()) self.__preferences.set(EXTRACTION_COMPRESS, self.compress.isChecked()) self.__preferences.set(FILTERS_DEFAULT_FREQ, self.lsFreq.value()) self.__preferences.set(FILTERS_DEFAULT_Q, self.lsQ.value()) self.__preferences.set(FILTERS_DEFAULT_HS_FREQ, self.hsFreq.value()) self.__preferences.set(FILTERS_DEFAULT_HS_Q, self.hsQ.value()) self.__preferences.set(FILTERS_DEFAULT_PEAK_FREQ, self.peakFreq.value()) self.__preferences.set(FILTERS_DEFAULT_PEAK_Q, self.peakQ.value()) self.__preferences.set(BEQ_DOWNLOAD_DIR, self.beqFiltersDir.text()) self.__preferences.set(BASS_MANAGEMENT_LPF_FS, self.bmlpfFreq.value()) self.__preferences.set(DISPLAY_SMOOTH_PRECALC, self.precalcSmoothing.isChecked()) self.__preferences.set(BEQ_REPOS, '|'.join(self.__get_beq_repos())) QDialog.accept(self)
def accept(self): self.is_visible = False QDialog.accept(self) self.list.clear()
def accept(self): """Validate inputs""" if self.check(): for edl in self.edit_layout: edl.accept_changes() QDialog.accept(self)
def accept(self): """Reimplement Qt method""" self.set_environ(listdict2envdict(self.get_value())) QDialog.accept(self)
def accept(self): ''' Resets the thread pool size back to the default. ''' self.change_pool_size(QThread.idealThreadCount()) QDialog.accept(self)
def accept(self): """Reimplement Qt method""" set_user_env(listdict2envdict(self.get_value()), parent=self) QDialog.accept(self)
def accept(self): QDialog.accept(self) self.list.clear()
def accept(self): """Reimplement Qt method""" set_user_env( listdict2envdict(self.get_value()), parent=self ) QDialog.accept(self)