mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
- Fix tgogenerator - Fix UI for ForceGroup and Layouts - Fix ammo depot handling - Split bigger files in smaller meaningful files (TGO, layouts, forces) - Renamed Template to Layout - Renamed GroundGroup to TheaterGroup and GroundUnit to TheaterUnit - Reorganize Layouts and UnitGroups to a ArmedForces class and ForceGroup similar to the AirWing and Squadron - Reworded the UnitClass, GroupRole, GroupTask (adopted to PEP8) and reworked the connection from Role and Task - added comments - added missing unit classes - added temp workaround for missing classes - add repariable property to TheaterUnit - Review and Cleanup Added serialization for loaded templates Loading the templates from the .miz files takes a lot of computation time and in the future there will be more templates added to the system. Therefore a local pickle serialization for the loaded templates was re-added: - The pickle will be created the first time the TemplateLoader will be accessed - Pickle is stored in Liberation SaveDir - Added UI option to (re-)import templates
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
import os
|
|
|
|
from PySide2.QtGui import QPixmap
|
|
from PySide2.QtWidgets import QGroupBox, QHBoxLayout, QLabel, QVBoxLayout
|
|
from game.theater import TheaterUnit
|
|
|
|
from game.config import REWARDS
|
|
|
|
|
|
class QBuildingInfo(QGroupBox):
|
|
def __init__(self, building: TheaterUnit, ground_object):
|
|
super(QBuildingInfo, self).__init__()
|
|
self.building = building
|
|
self.ground_object = ground_object
|
|
self.init_ui()
|
|
|
|
def init_ui(self):
|
|
self.header = QLabel()
|
|
path = os.path.join(
|
|
"./resources/ui/units/buildings/" + self.building.icon + ".png"
|
|
)
|
|
if not self.building.alive:
|
|
pixmap = QPixmap("./resources/ui/units/buildings/dead.png")
|
|
elif os.path.isfile(path):
|
|
pixmap = QPixmap(path)
|
|
else:
|
|
pixmap = QPixmap("./resources/ui/units/buildings/missing.png")
|
|
self.header.setPixmap(pixmap)
|
|
self.name = QLabel(self.building.short_name)
|
|
self.name.setProperty("style", "small")
|
|
layout = QVBoxLayout()
|
|
layout.addWidget(self.header)
|
|
layout.addWidget(self.name)
|
|
|
|
if self.ground_object.category in REWARDS:
|
|
income_label_text = (
|
|
"Value: " + str(REWARDS[self.ground_object.category]) + "M"
|
|
)
|
|
if not self.building.alive:
|
|
income_label_text = "<s>" + income_label_text + "</s>"
|
|
self.reward = QLabel(income_label_text)
|
|
layout.addWidget(self.reward)
|
|
|
|
footer = QHBoxLayout()
|
|
self.setLayout(layout)
|