kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
Merge pull request #510 from zarath/bugfix/dont_chrash_on_zoom
fix zoom crash when wheel on square chartspull/515/head
commit
16f028e5ed
|
@ -103,6 +103,11 @@ class Chart(QtWidgets.QWidget):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.sweepTitle = ''
|
self.sweepTitle = ''
|
||||||
|
|
||||||
|
self.leftMargin = 30
|
||||||
|
self.rightMargin = 20
|
||||||
|
self.bottomMargin = 20
|
||||||
|
self.topMargin = 30
|
||||||
|
|
||||||
self.dim = ChartDimensions()
|
self.dim = ChartDimensions()
|
||||||
self.dragbox = ChartDragBox()
|
self.dragbox = ChartDragBox()
|
||||||
self.flag = ChartFlags()
|
self.flag = ChartFlags()
|
||||||
|
|
|
@ -52,6 +52,3 @@ class PolarChart(SquareChart):
|
||||||
center_x - width_45, center_y + height_45)
|
center_x - width_45, center_y + height_45)
|
||||||
|
|
||||||
self.drawTitle(qp)
|
self.drawTitle(qp)
|
||||||
|
|
||||||
def zoomTo(self, x1, y1, x2, y2):
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
|
@ -94,6 +94,3 @@ class SmithChart(SquareChart):
|
||||||
qp.drawText(
|
qp.drawText(
|
||||||
QtCore.QRect(centerX - 50, centerY - 4 + r, 100, 20),
|
QtCore.QRect(centerX - 50, centerY - 4 + r, 100, 20),
|
||||||
QtCore.Qt.AlignCenter, str(swr))
|
QtCore.Qt.AlignCenter, str(swr))
|
||||||
|
|
||||||
def zoomTo(self, x1, y1, x2, y2):
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
|
@ -138,8 +138,12 @@ class SquareChart(Chart):
|
||||||
m.setFrequency(str(round(target[minimum_position].freq)))
|
m.setFrequency(str(round(target[minimum_position].freq)))
|
||||||
m.frequencyInput.setText(str(round(target[minimum_position].freq)))
|
m.frequencyInput.setText(str(round(target[minimum_position].freq)))
|
||||||
|
|
||||||
|
|
||||||
def getXPosition(self, d: Datapoint) -> int:
|
def getXPosition(self, d: Datapoint) -> int:
|
||||||
return int(self.width()/2 + d.re * self.dim.width/2)
|
return int(self.width()/2 + d.re * self.dim.width/2)
|
||||||
|
|
||||||
def getYPosition(self, d: Datapoint) -> int:
|
def getYPosition(self, d: Datapoint) -> int:
|
||||||
return int(self.height()/2 + d.im * -1 * self.dim.height/2)
|
return int(self.height()/2 + d.im * -1 * self.dim.height/2)
|
||||||
|
|
||||||
|
def zoomTo(self, x1, y1, x2, y2):
|
||||||
|
pass
|
||||||
|
|
|
@ -41,10 +41,10 @@ class TDRChart(Chart):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
self.tdrWindow = None
|
self.tdrWindow = None
|
||||||
self.leftMargin = 30
|
|
||||||
self.rightMargin = 20
|
|
||||||
self.bottomMargin = 25
|
self.bottomMargin = 25
|
||||||
self.topMargin = 20
|
self.topMargin = 20
|
||||||
|
|
||||||
self.setMinimumSize(300, 300)
|
self.setMinimumSize(300, 300)
|
||||||
self.setSizePolicy(
|
self.setSizePolicy(
|
||||||
QtWidgets.QSizePolicy(
|
QtWidgets.QSizePolicy(
|
||||||
|
|
Ładowanie…
Reference in New Issue