quickload

This commit is contained in:
leo 2022-05-14 17:01:21 +02:00
parent a7de2f3974
commit 1dd72068c0
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB
3 changed files with 19 additions and 7 deletions

2
Car.py
View File

@ -433,7 +433,7 @@ class Car():
#print(self.distToInter, self.minSpace, dts)
# Si on est bloqué dans une dépendance circulaire
if self.timeAtInter >= 0 and self.leader is None and self.circularLeaderDep(self.leaderAtInter, 20):
if self.timeAtInter >= 1 and self.leader is None and self.circularLeaderDep(self.leaderAtInter, 20):
self.forceThrough = True
# si on est suffisement loin de l'intersection (i.e on s'en fout du leader)

View File

@ -68,8 +68,6 @@ class MainWindow(QMainWindow):
self.close()
elif e.key() == Qt.Key_V:
self.mainLoop.controller.vroomEnable = not self.mainLoop.controller.vroomEnable
elif e.key() == Qt.Key_S:
self.mainLoop.quickLoad()
elif e.key() == Qt.Key_G:
self.startMainLoop.emit()
elif e.key() == Qt.Key_E:
@ -78,6 +76,8 @@ class MainWindow(QMainWindow):
self.setPhTimerInterval.emit(17)
elif e.key() == Qt.Key_F:
self.setPhTimerInterval.emit(500)
else:
self.mainLoop.quickLoad(e.key())
def mousePressEvent(self, QMouseEvent):
tran = self.ui.mainSurf.transform.inverted()[0]

View File

@ -4,12 +4,21 @@ from Map import Map
from CarController import CarController
from PySide6.QtWidgets import QFileDialog, QToolBox
from PySide6.QtCore import QElapsedTimer, QTimer, QElapsedTimer, QObject, Signal, Slot, QThread, QMutex
from PySide6.QtCore import QElapsedTimer, QTimer, QElapsedTimer, QObject, Signal, Slot, QThread, QMutex, Qt
class mainLoop(QObject):
updateFPS = Signal(int)
mutex = QMutex()
qlPresets = {
Qt.Key_0 : ["comp_inter.net.xml", "comp_inter.rou.xml"],
Qt.Key_1 : ["comp_inter.net.xml", "comp_inter_t2.rou.xml"],
Qt.Key_2 : ["comp_rdp.net.xml", "comp_rdp.rou.xml"],
Qt.Key_3 : ["comp_rdp.net.xml", "comp_rdp_t3.rou.xml"],
Qt.Key_4 : ["rdpt_polytech_fixed.net.xml", "rdpt_polytech_burst.rou.xml"],
Qt.Key_5 : ["rdpt_polytech_fixed.net.xml", "rdpt_polytech_burst_2.rou.xml"]
}
def __init__(self, parent):
super().__init__()
self.parent = parent
@ -87,10 +96,13 @@ class mainLoop(QObject):
self.controller.prepareRoute()
@threadSafe
def quickLoad(self):
self.map.fromPath("comp_rdp.net.xml")
def quickLoad(self, key):
paths = self.qlPresets.get(key)
if paths == None:
return
self.map.fromPath(paths[0])
self.painter.generateTransform()
self.controller.fromPath("comp_rdp.rou.xml")
self.controller.fromPath(paths[1])
self.controller.prepareRoute()
def updateFps(self):