Fix purchase groups.

The new class PurchaseGroup coming in with commit 9bb986c was not
initiallized correctly.

This causes the bug that the update function is not working when you
for example open the AircraftRecruitmentMenu press "+" or "-", close
the dialog and then open ArmorRecruitmentMenu. If you then want to buy
or sell the update function will raise an error "Internal C++ Object
Already Deleted".
This commit is contained in:
RndName 2021-06-19 19:33:35 +02:00 committed by GitHub
parent 930fb404af
commit 7e3cebb96d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -76,13 +76,14 @@ class PurchaseGroup(QGroupBox):
class QRecruitBehaviour:
game_model: GameModel
cp: ControlPoint
purchase_groups: dict[UnitType, PurchaseGroup] = {}
purchase_groups: dict[UnitType, PurchaseGroup]
existing_units_labels = None
maximum_units = -1
BUDGET_FORMAT = "Available Budget: <b>${:.2f}M</b>"
def __init__(self) -> None:
self.existing_units_labels = {}
self.purchase_groups = {}
self.update_available_budget()
@property

View File

@ -26,7 +26,7 @@ class QAircraftRecruitmentMenu(QFrame, QRecruitBehaviour):
QFrame.__init__(self)
self.cp = cp
self.game_model = game_model
self.purchase_groups = {}
self.bought_amount_labels = {}
self.existing_units_labels = {}

View File

@ -18,7 +18,7 @@ class QArmorRecruitmentMenu(QFrame, QRecruitBehaviour):
QFrame.__init__(self)
self.cp = cp
self.game_model = game_model
self.purchase_groups = {}
self.bought_amount_labels = {}
self.existing_units_labels = {}