mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Air/ground intel prettification. (#1285)
* Sort rows. * Add totals to group headers. * Indent content. * Add space between sections.
This commit is contained in:
parent
7808da118a
commit
7e17533cc6
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ resources/tools/a.miz
|
|||||||
# User-specific stuff
|
# User-specific stuff
|
||||||
.idea/
|
.idea/
|
||||||
.env
|
.env
|
||||||
|
env/
|
||||||
|
|
||||||
/kneeboards
|
/kneeboards
|
||||||
/liberation_preferences.json
|
/liberation_preferences.json
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import itertools
|
import itertools
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from PySide2.QtWidgets import (
|
from PySide2.QtWidgets import (
|
||||||
QCheckBox,
|
QCheckBox,
|
||||||
@ -63,10 +64,11 @@ class IntelTableLayout(QGridLayout):
|
|||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_row(self, text: str, count: int) -> None:
|
def add_row(self, text: str, count: Optional[int] = None) -> None:
|
||||||
row = next(self.row)
|
row = next(self.row)
|
||||||
self.addWidget(QLabel(text), row, 0)
|
self.addWidget(QLabel(text), row, 0)
|
||||||
self.addWidget(QLabel(str(count)), row, 1)
|
if count is not None: # optional count for blank rows
|
||||||
|
self.addWidget(QLabel(str(count)), row, 1)
|
||||||
|
|
||||||
|
|
||||||
class AircraftIntelLayout(IntelTableLayout):
|
class AircraftIntelLayout(IntelTableLayout):
|
||||||
@ -80,14 +82,16 @@ class AircraftIntelLayout(IntelTableLayout):
|
|||||||
if not base.total_aircraft:
|
if not base.total_aircraft:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.add_header(control_point.name)
|
self.add_header(f"{control_point.name} ({base.total_aircraft})")
|
||||||
for airframe, count in base.aircraft.items():
|
for airframe in sorted(base.aircraft, key=lambda k: k.name):
|
||||||
|
count = base.aircraft[airframe]
|
||||||
if not count:
|
if not count:
|
||||||
continue
|
continue
|
||||||
self.add_row(airframe.name, count)
|
self.add_row(f" {airframe.name}", count)
|
||||||
|
self.add_row("")
|
||||||
|
|
||||||
self.add_spacer()
|
|
||||||
self.add_row("<b>Total</b>", total)
|
self.add_row("<b>Total</b>", total)
|
||||||
|
self.add_spacer()
|
||||||
|
|
||||||
|
|
||||||
class AircraftIntelTab(ScrollingFrame):
|
class AircraftIntelTab(ScrollingFrame):
|
||||||
@ -107,14 +111,16 @@ class ArmyIntelLayout(IntelTableLayout):
|
|||||||
if not base.total_armor:
|
if not base.total_armor:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.add_header(control_point.name)
|
self.add_header(f"{control_point.name} ({base.total_armor})")
|
||||||
for vehicle, count in base.armor.items():
|
for vehicle in sorted(base.armor, key=lambda k: k.name):
|
||||||
|
count = base.armor[vehicle]
|
||||||
if not count:
|
if not count:
|
||||||
continue
|
continue
|
||||||
self.add_row(vehicle.name, count)
|
self.add_row(f" {vehicle.name}", count)
|
||||||
|
self.add_row("")
|
||||||
|
|
||||||
self.add_spacer()
|
|
||||||
self.add_row("<b>Total</b>", total)
|
self.add_row("<b>Total</b>", total)
|
||||||
|
self.add_spacer()
|
||||||
|
|
||||||
|
|
||||||
class ArmyIntelTab(ScrollingFrame):
|
class ArmyIntelTab(ScrollingFrame):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user