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()
|
self.updateThread = QThread()
|
||||||
|
|
||||||
print(QThread.currentThread(),self.updateThread)
|
|
||||||
|
|
||||||
self.mainLoop = mainLoop(self)
|
self.mainLoop = mainLoop(self)
|
||||||
|
|
||||||
self.mainLoop.moveToThread(self.updateThread)
|
self.mainLoop.moveToThread(self.updateThread)
|
||||||
@ -66,12 +64,17 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def updateFPS(self):
|
def updateFPS(self):
|
||||||
widget = self.findChild(QLabel,"mainFps")
|
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()
|
widget.update()
|
||||||
|
|
||||||
@Slot(int)
|
@Slot(int)
|
||||||
def updatePhysicsFps(self,t):
|
def updatePhysicsFps(self,t):
|
||||||
widget = self.findChild(QLabel,"physicsFPS")
|
widget = self.findChild(QLabel,"physicsFPS")
|
||||||
|
if(t == 0):
|
||||||
|
return
|
||||||
widget.setText(f"ph fps : {1000/t:.1f}")
|
widget.setText(f"ph fps : {1000/t:.1f}")
|
||||||
|
|
||||||
def openNetwork(self):
|
def openNetwork(self):
|
||||||
@ -82,6 +85,12 @@ class MainWindow(QMainWindow):
|
|||||||
filename = QFileDialog.getOpenFileName(self,"Open Vehicle trip description", "./", "Route File (*.rou.xml)")
|
filename = QFileDialog.getOpenFileName(self,"Open Vehicle trip description", "./", "Route File (*.rou.xml)")
|
||||||
self.mainLoop.openVehicles(filename[0])
|
self.mainLoop.openVehicles(filename[0])
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.updateThread.quit()
|
||||||
|
self.updateThread.wait()
|
||||||
|
super().close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QApplication()
|
app = QApplication()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user