Small fixes. Need to limit drawPaths() -- it's slow.
This commit is contained in:
parent
6cb59af3a5
commit
77768ebcc6
@ -71,15 +71,15 @@ class az_map_model(QtCore.QObject):
|
|||||||
if distance > self._data[row][i]:
|
if distance > self._data[row][i]:
|
||||||
self._data[row][i] = distance
|
self._data[row][i] = distance
|
||||||
update = True
|
update = True
|
||||||
if update:
|
if update:
|
||||||
self.dataChanged.emit()
|
self.dataChanged.emit()
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self._data = []
|
self._data = []
|
||||||
for i in range(0,az_map_model.npoints):
|
for i in range(0,az_map_model.npoints):
|
||||||
self._data.append([0] * len(self._altitudes))
|
self._data.append([0] * len(self._altitudes))
|
||||||
self.dataChanged.emit()
|
self.dataChanged.emit()
|
||||||
|
|
||||||
|
|
||||||
# the azimuth map widget
|
# the azimuth map widget
|
||||||
@ -105,16 +105,14 @@ class az_map(QtGui.QWidget):
|
|||||||
|
|
||||||
def setModel(self, model):
|
def setModel(self, model):
|
||||||
self._model = model
|
self._model = model
|
||||||
self._model.dataChanged.connect(self.update)
|
self._model.dataChanged.connect(self.repaint)
|
||||||
|
|
||||||
def update(self):
|
|
||||||
self.drawPaths()
|
|
||||||
self.repaint()
|
|
||||||
|
|
||||||
def paintEvent(self, event):
|
def paintEvent(self, event):
|
||||||
painter = QtGui.QPainter(self)
|
painter = QtGui.QPainter(self)
|
||||||
painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
painter.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||||
#TODO: make it not have to redraw paths EVERY repaint
|
#TODO: make it not have to redraw paths EVERY repaint
|
||||||
|
#drawing paths is VERY SLOW
|
||||||
|
#maybe use a QTimer to limit repaints
|
||||||
self.drawPaths()
|
self.drawPaths()
|
||||||
|
|
||||||
#set background
|
#set background
|
||||||
@ -122,7 +120,6 @@ class az_map(QtGui.QWidget):
|
|||||||
|
|
||||||
#draw the range rings
|
#draw the range rings
|
||||||
self.drawRangeRings(painter)
|
self.drawRangeRings(painter)
|
||||||
#painter.setPen(az_map.rangepen)
|
|
||||||
for i in range(len(self._paths)):
|
for i in range(len(self._paths)):
|
||||||
alpha = 230 * (i+1) / (len(self._paths)) + 25
|
alpha = 230 * (i+1) / (len(self._paths)) + 25
|
||||||
painter.setPen(QtGui.QPen(QtGui.QColor(alpha,alpha,0,255), 1.0))
|
painter.setPen(QtGui.QPen(QtGui.QColor(alpha,alpha,0,255), 1.0))
|
||||||
@ -212,7 +209,7 @@ class model_updater(threading.Thread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
for i in range(az_map_model.npoints):
|
for i in range(az_map_model.npoints):
|
||||||
time.sleep(0.05)
|
time.sleep(0.005)
|
||||||
if(self.model):
|
if(self.model):
|
||||||
for alt in self.model._altitudes:
|
for alt in self.model._altitudes:
|
||||||
self.model.addRecord(i*360./az_map_model.npoints, alt, random.randint(0,az_map.maxrange)*alt / max(self.model._altitudes))
|
self.model.addRecord(i*360./az_map_model.npoints, alt, random.randint(0,az_map.maxrange)*alt / max(self.model._altitudes))
|
||||||
|
Loading…
Reference in New Issue
Block a user