class EditPush(QtWidgets.QWidget): clicked = QtCore.Signal(EditPushInfo) def __init__(self, icon_name: str, ini_value=0.1, text=''): super().__init__() self._edit_push_type = 'abs' self.setLayout(QtWidgets.QHBoxLayout()) self._edit = SpinBox(value=ini_value, dec=True, step=0.1, minStep=0.001) self._edit.setMinimumHeight(20) self._edit.setMaximumWidth(60) self._edit.setMinimumWidth(60) self.layout().addWidget(self._edit) self.set_pushs(icon_name, text) def set_pushs(self, icon_name, text): self._push = PushButtonIcon(icon_name, text) self._push.setMaximumWidth(40) self._push.clicked.connect(lambda: self.emit_clicked()) self.layout().addWidget(self._push) def emit_clicked(self, coeff=1): """will emit a signal containing a float value calculated from the product of the coeff and the internal spinbox value. See Also -------- EditPushRel """ self.clicked.emit( EditPushInfo(type=self._edit_push_type, value=coeff * self._edit.value()))
def gaussianSigmaChanged(sb : pg.SpinBox): global gaussianSigma gaussianSigma = sb.value() print("Gaussian Sigma changed to: %s" % str(sb.value())) sb.update()