mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Merge pull request #525 from root0fall/fix_221
refresh budget after purchase from sub-dialog
This commit is contained in:
commit
f687a30c7e
@ -170,3 +170,10 @@ class QBaseMenu2(QDialog):
|
|||||||
|
|
||||||
def new_package(self) -> None:
|
def new_package(self) -> None:
|
||||||
Dialog.open_new_package_dialog(self.cp, parent=self.window())
|
Dialog.open_new_package_dialog(self.cp, parent=self.window())
|
||||||
|
|
||||||
|
def update_dialogue_budget(self, budget: int):
|
||||||
|
GameUpdateSignal.get_instance().updateBudget(self.game_model.game)
|
||||||
|
for child in self.children():
|
||||||
|
if child.objectName() == "budgetField":
|
||||||
|
child.setText(
|
||||||
|
QRecruitBehaviour.BUDGET_FORMAT.format(budget))
|
||||||
|
|||||||
@ -125,10 +125,7 @@ class QRecruitBehaviour:
|
|||||||
parent = self.parent()
|
parent = self.parent()
|
||||||
while parent.objectName != "menuDialogue":
|
while parent.objectName != "menuDialogue":
|
||||||
parent = parent.parent()
|
parent = parent.parent()
|
||||||
for child in parent.children():
|
parent.update_dialogue_budget(self.budget)
|
||||||
if child.objectName() == "budgetField":
|
|
||||||
child.setText(
|
|
||||||
QRecruitBehaviour.BUDGET_FORMAT.format(self.budget))
|
|
||||||
|
|
||||||
def buy(self, unit_type: Type[UnitType]):
|
def buy(self, unit_type: Type[UnitType]):
|
||||||
price = db.PRICES[unit_type]
|
price = db.PRICES[unit_type]
|
||||||
|
|||||||
@ -190,6 +190,7 @@ class QGroundObjectMenu(QDialog):
|
|||||||
group.units_losts = [u for u in group.units_losts if u.id != unit.id]
|
group.units_losts = [u for u in group.units_losts if u.id != unit.id]
|
||||||
group.units.append(unit)
|
group.units.append(unit)
|
||||||
GameUpdateSignal.get_instance().updateGame(self.game)
|
GameUpdateSignal.get_instance().updateGame(self.game)
|
||||||
|
self.parent().update_dialogue_budget(self.game.budget)
|
||||||
|
|
||||||
# Remove destroyed units in the vicinity
|
# Remove destroyed units in the vicinity
|
||||||
destroyed_units = self.game.get_destroyed_units()
|
destroyed_units = self.game.get_destroyed_units()
|
||||||
@ -209,6 +210,7 @@ class QGroundObjectMenu(QDialog):
|
|||||||
self.ground_object.groups = []
|
self.ground_object.groups = []
|
||||||
self.do_refresh_layout()
|
self.do_refresh_layout()
|
||||||
GameUpdateSignal.get_instance().updateBudget(self.game)
|
GameUpdateSignal.get_instance().updateBudget(self.game)
|
||||||
|
self.parent().update_dialogue_budget(self.game.budget)
|
||||||
|
|
||||||
def buy_group(self):
|
def buy_group(self):
|
||||||
self.subwindow = QBuyGroupForGroundObjectDialog(self, self.ground_object, self.cp, self.game, self.total_value)
|
self.subwindow = QBuyGroupForGroundObjectDialog(self, self.ground_object, self.cp, self.game, self.total_value)
|
||||||
@ -333,6 +335,7 @@ class QBuyGroupForGroundObjectDialog(QDialog):
|
|||||||
self.ground_object.groups = [group]
|
self.ground_object.groups = [group]
|
||||||
|
|
||||||
GameUpdateSignal.get_instance().updateBudget(self.game)
|
GameUpdateSignal.get_instance().updateBudget(self.game)
|
||||||
|
self.parent().parent().update_dialogue_budget(self.game.budget)
|
||||||
|
|
||||||
self.changed.emit()
|
self.changed.emit()
|
||||||
self.close()
|
self.close()
|
||||||
@ -353,6 +356,7 @@ class QBuyGroupForGroundObjectDialog(QDialog):
|
|||||||
self.ground_object.groups = [generated_group]
|
self.ground_object.groups = [generated_group]
|
||||||
|
|
||||||
GameUpdateSignal.get_instance().updateBudget(self.game)
|
GameUpdateSignal.get_instance().updateBudget(self.game)
|
||||||
|
self.parent().parent().update_dialogue_budget(self.game.budget)
|
||||||
|
|
||||||
self.changed.emit()
|
self.changed.emit()
|
||||||
self.close()
|
self.close()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user