mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Possible fix for debriefing updates.
This commit is contained in:
parent
b5893ce521
commit
0a47669b14
@ -7,7 +7,7 @@ from PySide2.QtGui import QMovie, QIcon, QPixmap
|
|||||||
from PySide2.QtWidgets import QLabel, QDialog, QGroupBox, QGridLayout, QPushButton, QFileDialog, QMessageBox, QTextEdit, \
|
from PySide2.QtWidgets import QLabel, QDialog, QGroupBox, QGridLayout, QPushButton, QFileDialog, QMessageBox, QTextEdit, \
|
||||||
QHBoxLayout
|
QHBoxLayout
|
||||||
|
|
||||||
from game.game import Event, Game
|
from game.game import Event, Game, logging
|
||||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||||
from userdata.debriefing import wait_for_debriefing, Debriefing
|
from userdata.debriefing import wait_for_debriefing, Debriefing
|
||||||
from userdata.persistency import base_path
|
from userdata.persistency import base_path
|
||||||
@ -142,12 +142,14 @@ class QWaitingForMissionResultWindow(QDialog):
|
|||||||
self.gridLayout.addLayout(bottom_layout, 1, 0)
|
self.gridLayout.addLayout(bottom_layout, 1, 0)
|
||||||
|
|
||||||
def on_debriefing_udpate(self, debriefing):
|
def on_debriefing_udpate(self, debriefing):
|
||||||
print("On Debriefing update")
|
try:
|
||||||
print(debriefing)
|
logging.info("On Debriefing update")
|
||||||
DebriefingFileWrittenSignal.get_instance().sendDebriefing(debriefing)
|
print(debriefing)
|
||||||
|
DebriefingFileWrittenSignal.get_instance().sendDebriefing(debriefing)
|
||||||
if not debriefing.mission_ended:
|
except Exception as e:
|
||||||
self.wait_thread = wait_for_debriefing(lambda debriefing: self.on_debriefing_udpate(debriefing), self.game)
|
logging.error("Got an error while sending debriefing")
|
||||||
|
logging.error(e)
|
||||||
|
self.wait_thread = wait_for_debriefing(lambda debriefing: self.on_debriefing_udpate(debriefing), self.game)
|
||||||
|
|
||||||
def process_debriefing(self, debriefing: Debriefing):
|
def process_debriefing(self, debriefing: Debriefing):
|
||||||
self.game.finish_event(event=self.gameEvent, debriefing=debriefing)
|
self.game.finish_event(event=self.gameEvent, debriefing=debriefing)
|
||||||
@ -165,18 +167,19 @@ class QWaitingForMissionResultWindow(QDialog):
|
|||||||
self.wait_thread.stop()
|
self.wait_thread.stop()
|
||||||
|
|
||||||
def submit_manually(self):
|
def submit_manually(self):
|
||||||
file = str(QFileDialog.getOpenFileName(self, "Select game file to open", filter="json(*.json)"))
|
file = QFileDialog.getOpenFileName(self, "Select game file to open", filter="json(*.json)", dir=".")
|
||||||
print(file)
|
print(file)
|
||||||
try:
|
try:
|
||||||
with open("state.json", "r") as json_file:
|
with open(file[0], "r") as json_file:
|
||||||
json_data = json.load(json_file)
|
json_data = json.load(json_file)
|
||||||
json_data["mission_ended"] = True
|
json_data["mission_ended"] = True
|
||||||
debriefing = Debriefing(json_data, self.game)
|
debriefing = Debriefing(json_data, self.game)
|
||||||
self.on_debriefing_udpate(debriefing)
|
self.on_debriefing_udpate(debriefing)
|
||||||
except:
|
except Exception as e:
|
||||||
|
logging.error(e)
|
||||||
msg = QMessageBox()
|
msg = QMessageBox()
|
||||||
msg.setIcon(QMessageBox.Information)
|
msg.setIcon(QMessageBox.Information)
|
||||||
msg.setText("Invalid file : " + file)
|
msg.setText("Invalid file : " + file[0])
|
||||||
msg.setWindowTitle("Invalid file.")
|
msg.setWindowTitle("Invalid file.")
|
||||||
msg.setStandardButtons(QMessageBox.Ok)
|
msg.setStandardButtons(QMessageBox.Ok)
|
||||||
msg.setWindowFlags(Qt.WindowStaysOnTopHint)
|
msg.setWindowFlags(Qt.WindowStaysOnTopHint)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user