format
This commit is contained in:
parent
4a6f5bf8e0
commit
7fb887e180
17
main.py
17
main.py
@ -1,5 +1,4 @@
|
||||
import os, sys
|
||||
import time
|
||||
if 'SUMO_HOME' in os.environ:
|
||||
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
|
||||
sys.path.append(tools)
|
||||
@ -15,7 +14,7 @@ from mainLoop import mainLoop
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super(MainWindow, self).__init__()
|
||||
super().__init__()
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
@ -37,7 +36,7 @@ class MainWindow(QMainWindow):
|
||||
openMenu.addAction(openVeh)
|
||||
|
||||
timer = QTimer(self)
|
||||
timer.timeout.connect(self.mainLoop.update)
|
||||
timer.timeout.connect(self.ui.mainSurf.update)
|
||||
timer.start(1.0/60)
|
||||
|
||||
def keyPressEvent(self, e):
|
||||
@ -50,12 +49,12 @@ class MainWindow(QMainWindow):
|
||||
if __name__ == "__main__":
|
||||
app = QApplication()
|
||||
|
||||
format = QSurfaceFormat()
|
||||
format.setDepthBufferSize(24)
|
||||
format.setVersion(3, 2)
|
||||
format.setSamples(4)
|
||||
format.setProfile(QSurfaceFormat.CoreProfile)
|
||||
QSurfaceFormat.setDefaultFormat(format)
|
||||
f = QSurfaceFormat()
|
||||
f.setDepthBufferSize(24)
|
||||
f.setVersion(3, 2)
|
||||
f.setSamples(4)
|
||||
f.setProfile(QSurfaceFormat.CoreProfile)
|
||||
QSurfaceFormat.setDefaultFormat(f)
|
||||
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
|
@ -18,11 +18,10 @@ class mainLoop():
|
||||
|
||||
def update(self):
|
||||
self.controller.update()
|
||||
self.painter.update()
|
||||
|
||||
def openNetwork(self):
|
||||
fileName = QFileDialog.getOpenFileName(self.parent,"Open Network", "./", "Network File (*.net.xml)")
|
||||
if(fileName[0] == ''):
|
||||
if fileName[0] == '':
|
||||
return
|
||||
self.map.fromPath(fileName[0])
|
||||
self.painter.generateTransform()
|
||||
@ -31,10 +30,10 @@ class mainLoop():
|
||||
|
||||
def openVehicles(self):
|
||||
fileName = QFileDialog.getOpenFileName(self.parent,"Open Vehicle trip description", "./", "Route File (*.rou.xml)")
|
||||
if(fileName[0] == ''):
|
||||
if fileName[0] == '':
|
||||
return
|
||||
self.controller.fromPath(fileName[0])
|
||||
if(self.map.isLoaded()):
|
||||
if self.map.isLoaded():
|
||||
self.controller.prepareRoute()
|
||||
|
||||
def quickLoad(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user