def __init__(self, parent=None):
super().__init__(parent)
self.ui = Ui_DialogFilterBandwidth()
self.ui.setupUi(self)
bw_type = constants.SETTINGS.value("bandpass_filter_bw_type", "Medium", str)
custom_bw = constants.SETTINGS.value("bandpass_filter_custom_bw", 0.1, float)
for item in dir(self.ui):
item = getattr(self.ui, item)
if isinstance(item, QLabel):
name = item.objectName().replace("label", "")
key = next((key for key in Filter.BANDWIDTHS.keys() if name.startswith(key.replace(" ", ""))), None)
if key is not None and name.endswith("Bandwidth"):
item.setText("{0:n}".format(Filter.BANDWIDTHS[key]))
elif key is not None and name.endswith("KernelLength"):
item.setText(str(Filter.get_filter_length_from_bandwidth(Filter.BANDWIDTHS[key])))
elif isinstance(item, QRadioButton):
item.setChecked(bw_type.replace(" ", "_") == item.objectName().replace("radioButton", ""))
self.ui.doubleSpinBoxCustomBandwidth.setValue(custom_bw)
self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(custom_bw))
self.create_connects()
评论列表
文章目录