diff --git a/main.py b/main.py index 101ea3d..fc7f737 100644 --- a/main.py +++ b/main.py @@ -22,8 +22,6 @@ class MainWindow(QMainWindow): self.updateThread = QThread() - print(QThread.currentThread(),self.updateThread) - self.mainLoop = mainLoop(self) self.mainLoop.moveToThread(self.updateThread) @@ -66,12 +64,17 @@ class MainWindow(QMainWindow): def updateFPS(self): widget = self.findChild(QLabel,"mainFps") - widget.setText(f"fps : {1000/self.fpsTimer.restart():.1f}") + t = self.fpsTimer.restart() + if(t == 0): + return + widget.setText(f"fps : {1000/t:.1f}") widget.update() @Slot(int) def updatePhysicsFps(self,t): widget = self.findChild(QLabel,"physicsFPS") + if(t == 0): + return widget.setText(f"ph fps : {1000/t:.1f}") def openNetwork(self): @@ -82,6 +85,12 @@ class MainWindow(QMainWindow): filename = QFileDialog.getOpenFileName(self,"Open Vehicle trip description", "./", "Route File (*.rou.xml)") self.mainLoop.openVehicles(filename[0]) + def close(self): + self.updateThread.quit() + self.updateThread.wait() + super().close() + + if __name__ == "__main__": app = QApplication()