doc
This commit is contained in:
parent
c811196a53
commit
acdb10cb15
15
main.py
15
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user