weird bug for log-scaling fixed; fixes T248
This commit is contained in:
@ -25,6 +25,9 @@ class QShift(QtWidgets.QDialog, Ui_shift_dialog):
|
||||
self.data = {}
|
||||
self._colors = cycle(Tab10)
|
||||
|
||||
self.graphicsView.plotItem.ctrl.logXCheck.blockSignals(True)
|
||||
self.graphicsView.plotItem.ctrl.logYCheck.blockSignals(True)
|
||||
|
||||
delegate = SpinBoxDelegate()
|
||||
delegate.valueChanged.connect(self.shift)
|
||||
self.shift_table.setItemDelegate(delegate)
|
||||
@ -40,10 +43,10 @@ class QShift(QtWidgets.QDialog, Ui_shift_dialog):
|
||||
def add_item(self, idx, name, x, y):
|
||||
color = mkColor(next(self._colors).rgb())
|
||||
if np.iscomplexobj(y):
|
||||
pl = [PlotItem(x, y.real, name=name, pen=mkPen(color=color)),
|
||||
PlotItem(x, y.imag, name=name, pen=mkPen(color=color))]
|
||||
pl = [PlotItem(x=x, y=y.real, name=name, pen=mkPen(color=color)),
|
||||
PlotItem(x=x, y=y.imag, name=name, pen=mkPen(color=color))]
|
||||
else:
|
||||
pl = [PlotItem(x, y, name=name, pen=mkPen(color=color))]
|
||||
pl = [PlotItem(x=x, y=y, name=name, symbol='t', pen=mkPen(color=color))]
|
||||
|
||||
self.data[idx] = (pl, x, y)
|
||||
|
||||
@ -123,10 +126,18 @@ class QShift(QtWidgets.QDialog, Ui_shift_dialog):
|
||||
def set_log(self, state: int):
|
||||
if self.sender() == self.xlog_checkbox:
|
||||
log_state = self.graphicsView.plotItem.ctrl.logXCheck
|
||||
func = self.graphicsView.setXRange
|
||||
else:
|
||||
log_state = self.graphicsView.plotItem.ctrl.logYCheck
|
||||
func = self.graphicsView.setYRange
|
||||
|
||||
log_state.setCheckState(state)
|
||||
self.graphicsView.plotItem.updateLogMode()
|
||||
# For some combinations of Python, pyqt, and pyqtgraph, updateLogMode does not update
|
||||
# view range to log values and logTickValues generates LOTS of ticks, which freezes everything.
|
||||
# -> Call setRange to interrupt the loop.
|
||||
func(0, 1)
|
||||
self.graphicsView.enableAutoRange()
|
||||
|
||||
def on_overwrite_checkbox_stateChanged(self, state: int):
|
||||
self.data_newgraph.setVisible(state != QtCore.Qt.Checked)
|
||||
|
Reference in New Issue
Block a user