mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Stats view now has a tab for vehicles forces. Display waypoint coordinates in waypoint tab.
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
from PySide2 import QtCharts
|
||||
from PySide2.QtCore import QPoint, Qt
|
||||
from PySide2.QtGui import QPainter
|
||||
from PySide2.QtWidgets import QDialog, QGridLayout
|
||||
from PySide2.QtCharts import QtCharts
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game.game import Game
|
||||
|
||||
|
||||
class QStatsWindow(QDialog):
|
||||
|
||||
def __init__(self, game: Game):
|
||||
super(QStatsWindow, self).__init__()
|
||||
|
||||
self.game = game
|
||||
|
||||
self.setModal(True)
|
||||
self.setWindowTitle("Stats")
|
||||
self.setWindowIcon(CONST.ICONS["Statistics"])
|
||||
self.setMinimumSize(600, 250)
|
||||
|
||||
self.initUi()
|
||||
|
||||
def initUi(self):
|
||||
self.layout = QGridLayout()
|
||||
self.generateUnitCharts()
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def generateUnitCharts(self):
|
||||
|
||||
self.alliedAircraft = [d.allied_units.aircraft_count for d in self.game.game_stats.data_per_turn]
|
||||
self.enemyAircraft = [d.enemy_units.aircraft_count for d in self.game.game_stats.data_per_turn]
|
||||
|
||||
self.alliedAircraftSerie = QtCharts.QLineSeries()
|
||||
self.alliedAircraftSerie.setName("Allied aircraft count")
|
||||
for a,i in enumerate(self.alliedAircraft):
|
||||
self.alliedAircraftSerie.append(QPoint(a, i))
|
||||
|
||||
self.enemyAircraftSerie = QtCharts.QLineSeries()
|
||||
self.enemyAircraftSerie.setColor(Qt.red)
|
||||
self.enemyAircraftSerie.setName("Enemy aircraft count")
|
||||
for a,i in enumerate(self.enemyAircraft):
|
||||
self.enemyAircraftSerie.append(QPoint(a, i))
|
||||
|
||||
self.chart = QtCharts.QChart()
|
||||
self.chart.addSeries(self.alliedAircraftSerie)
|
||||
self.chart.addSeries(self.enemyAircraftSerie)
|
||||
self.chart.setTitle("Aircraft forces over time")
|
||||
|
||||
self.chart.createDefaultAxes()
|
||||
self.chart.axisX().setRange(0, len(self.alliedAircraft))
|
||||
self.chart.axisY().setRange(0, max(max(self.alliedAircraft), max(self.enemyAircraft)) + 10)
|
||||
|
||||
self.chartView = QtCharts.QChartView(self.chart)
|
||||
self.chartView.setRenderHint(QPainter.Antialiasing)
|
||||
|
||||
self.layout.addWidget(self.chartView, 0, 0)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from PySide2.QtWidgets import QFrame, QHBoxLayout, QPushButton, QVBoxLayout, QMessageBox, QGridLayout
|
||||
from PySide2.QtWidgets import QFrame, QHBoxLayout, QPushButton, QVBoxLayout
|
||||
|
||||
from game import Game
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.widgets.QStatsWindow import QStatsWindow
|
||||
from qt_ui.windows.stats.QStatsWindow import QStatsWindow
|
||||
from qt_ui.widgets.QTurnCounter import QTurnCounter
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
|
||||
@@ -66,7 +66,7 @@ class QLiberationMap(QGraphicsView):
|
||||
scene.clear()
|
||||
|
||||
self.addBackground()
|
||||
self.add_game_events()
|
||||
#self.add_game_events()
|
||||
|
||||
for cp in self.game.theater.controlpoints:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user