fixes Issue #4 : Redraw graph only once on updating parameter values,i.e. block signals in iupdateTable and emit signal only once.

This commit is contained in:
Markus Rosenstihl 2015-01-09 10:11:34 +01:00
parent ae30438737
commit 7b9f79ab13
3 changed files with 9 additions and 3 deletions

View File

@ -79,6 +79,11 @@ class Peak(BaseContainer):
self.param_number = 4 self.param_number = 4
def set_id(self, id_num): def set_id(self, id_num):
"""
Sets color of the peak
:param id_num: peak id
:type id_num: int
"""
self.widget.setId(id_num) self.widget.setId(id_num)
self.color = id_to_color(id_num) self.color = id_to_color(id_num)
self.widget.setColor(self.color) self.widget.setColor(self.color)

View File

@ -90,6 +90,7 @@ class BaseWidget(QGroupBox):
self.changedTable.emit() self.changedTable.emit()
def update_table( self, beta, sd_beta=None ): def update_table( self, beta, sd_beta=None ):
self.blockSignals(True)
for i, arg in enumerate(beta): for i, arg in enumerate(beta):
self.inputs[i].setValue(arg) self.inputs[i].setValue(arg)
sd_style="" sd_style=""
@ -112,6 +113,7 @@ class BaseWidget(QGroupBox):
sd = "( --- )" sd = "( --- )"
self.errors[i].setStyleSheet(sd_style) self.errors[i].setStyleSheet(sd_style)
self.errors[i].setText(sd) self.errors[i].setText(sd)
self.blockSignals(False)
#self.update() #self.update()
def replaceDoubleSpinBox(self, layout, widget): def replaceDoubleSpinBox(self, layout, widget):

5
qds.py
View File

@ -243,7 +243,6 @@ class AppWindow(QMainWindow):
msgBox.setText("Click in real part") msgBox.setText("Click in real part")
msgBox.exec_() msgBox.exec_()
def abortFit( self ): def abortFit( self ):
for container in self.function_registry.get_registered_functions(): for container in self.function_registry.get_registered_functions():
container.abort(True) container.abort(True)
@ -313,7 +312,7 @@ class AppWindow(QMainWindow):
pass pass
pars.insert(0, self.data.meta["T"]) pars.insert(0, self.data.meta["T"])
pars.insert(1, 1e3/self.data.meta["T"]) pars.insert(1, 1e3/self.data.meta["1000/T"])
pars.append(self.data.fit_limits[0]) pars.append(self.data.fit_limits[0])
pars.append(self.data.fit_limits[1]) pars.append(self.data.fit_limits[1])
pars = np.array([pars]) pars = np.array([pars])
@ -485,7 +484,7 @@ class AppWindow(QMainWindow):
def update_plot( self ): def update_plot( self ):
print "redrawing plot" print "redrawing plot", self.sender()
log10fmin, log10fmax = self.fit_boundary_imag.getRegion() log10fmin, log10fmax = self.fit_boundary_imag.getRegion()
self.data.set_fit_xlimits(10**log10fmin, 10**log10fmax) self.data.set_fit_xlimits(10**log10fmin, 10**log10fmax)