class PeriodConfig(QDialog): done = Signal() def __init__(self, parent=None): QDialog.__init__(self, parent) self.ui = Ui_Period() self.ui.setupUi(self) self.setModal(True) self.avoidRecursion = 1 self.value = self.ui.msBox.value() self.connect(self.ui.msBox, SIGNAL('valueChanged(int)'), self.msChanged) self.connect(self.ui.hzBox, SIGNAL('valueChanged(double)'), self.hzChanged) self.connect(self.ui.buttonBox, SIGNAL('accepted()'), self.slotAccepted) self.connect(self.ui.buttonBox, SIGNAL('rejected()'), self.slotRejected) def slotAccepted(self): self.done.emit() self.hide() def slotRejected(self): self.hide() def msChanged(self, value): if self.avoidRecursion == 1: self.avoidRecursion -= 1 self.ui.hzBox.setValue(1000./value) self.avoidRecursion += 1 self.value = value def hzChanged(self, value): if self.avoidRecursion == 1: self.avoidRecursion -= 1 self.ui.msBox.setValue(int(1000./value)) self.avoidRecursion += 1 self.value = int(1000./value)
class PeriodConfig(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) self.ui = Ui_Period() self.ui.setupUi(self) self.setModal(True) self.avoidRecursion = 1 self.value = self.ui.msBox.value() self.connect(self.ui.msBox, SIGNAL('valueChanged(int)'), self.msChanged) self.connect(self.ui.hzBox, SIGNAL('valueChanged(double)'), self.hzChanged) self.connect(self.ui.buttonBox, SIGNAL('accepted()'), self.slotAccepted) self.connect(self.ui.buttonBox, SIGNAL('rejected()'), self.slotRejected) def slotAccepted(self): self.emit(SIGNAL("done()")) self.hide() def slotRejected(self): self.hide() def msChanged(self, value): if self.avoidRecursion == 1: self.avoidRecursion -= 1 self.ui.hzBox.setValue(1000./value) self.avoidRecursion += 1 self.value = value def hzChanged(self, value): if self.avoidRecursion == 1: self.avoidRecursion -= 1 self.ui.msBox.setValue(int(1000./value)) self.avoidRecursion += 1 self.value = int(1000./value)
def __init__(self, parent=None): QDialog.__init__(self, parent) self.ui = Ui_Period() self.ui.setupUi(self) self.setModal(True) self.avoidRecursion = 1 self.value = self.ui.msBox.value() self.connect(self.ui.msBox, SIGNAL('valueChanged(int)'), self.msChanged) self.connect(self.ui.hzBox, SIGNAL('valueChanged(double)'), self.hzChanged) self.connect(self.ui.buttonBox, SIGNAL('accepted()'), self.slotAccepted) self.connect(self.ui.buttonBox, SIGNAL('rejected()'), self.slotRejected)