Small fixes. Need to limit drawPaths() -- it's slow.

This commit is contained in:
Nick Foster 2012-10-10 18:44:28 -07:00
parent 6cb59af3a5
commit 77768ebcc6

View File

@ -105,16 +105,14 @@ class az_map(QtGui.QWidget):
def setModel(self, model):
self._model = model
self._model.dataChanged.connect(self.update)
def update(self):
self.drawPaths()
self.repaint()
self._model.dataChanged.connect(self.repaint)
def paintEvent(self, event):
painter = QtGui.QPainter(self)
painter.setRenderHint(QtGui.QPainter.Antialiasing)
#TODO: make it not have to redraw paths EVERY repaint
#drawing paths is VERY SLOW
#maybe use a QTimer to limit repaints
self.drawPaths()
#set background
@ -122,7 +120,6 @@ class az_map(QtGui.QWidget):
#draw the range rings
self.drawRangeRings(painter)
#painter.setPen(az_map.rangepen)
for i in range(len(self._paths)):
alpha = 230 * (i+1) / (len(self._paths)) + 25
painter.setPen(QtGui.QPen(QtGui.QColor(alpha,alpha,0,255), 1.0))
@ -212,7 +209,7 @@ class model_updater(threading.Thread):
def run(self):
for i in range(az_map_model.npoints):
time.sleep(0.05)
time.sleep(0.005)
if(self.model):
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))