Merge pull request #510 from zarath/bugfix/dont_chrash_on_zoom

fix zoom crash when wheel on square charts
pull/515/head
Holger Müller 2022-05-28 22:51:57 +02:00 zatwierdzone przez GitHub
commit 16f028e5ed
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 11 dodań i 8 usunięć

Wyświetl plik

@ -103,6 +103,11 @@ class Chart(QtWidgets.QWidget):
self.name = name
self.sweepTitle = ''
self.leftMargin = 30
self.rightMargin = 20
self.bottomMargin = 20
self.topMargin = 30
self.dim = ChartDimensions()
self.dragbox = ChartDragBox()
self.flag = ChartFlags()

Wyświetl plik

@ -52,6 +52,3 @@ class PolarChart(SquareChart):
center_x - width_45, center_y + height_45)
self.drawTitle(qp)
def zoomTo(self, x1, y1, x2, y2):
raise NotImplementedError()

Wyświetl plik

@ -94,6 +94,3 @@ class SmithChart(SquareChart):
qp.drawText(
QtCore.QRect(centerX - 50, centerY - 4 + r, 100, 20),
QtCore.Qt.AlignCenter, str(swr))
def zoomTo(self, x1, y1, x2, y2):
raise NotImplementedError()

Wyświetl plik

@ -138,8 +138,12 @@ class SquareChart(Chart):
m.setFrequency(str(round(target[minimum_position].freq)))
m.frequencyInput.setText(str(round(target[minimum_position].freq)))
def getXPosition(self, d: Datapoint) -> int:
return int(self.width()/2 + d.re * self.dim.width/2)
def getYPosition(self, d: Datapoint) -> int:
return int(self.height()/2 + d.im * -1 * self.dim.height/2)
def zoomTo(self, x1, y1, x2, y2):
pass

Wyświetl plik

@ -41,10 +41,10 @@ class TDRChart(Chart):
def __init__(self, name):
super().__init__(name)
self.tdrWindow = None
self.leftMargin = 30
self.rightMargin = 20
self.bottomMargin = 25
self.topMargin = 20
self.setMinimumSize(300, 300)
self.setSizePolicy(
QtWidgets.QSizePolicy(