This commit is contained in:
leo 2022-02-19 18:48:48 +01:00
parent c811196a53
commit acdb10cb15
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB

15
main.py
View File

@ -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()