Refactor the mod select changes, re-add accidentally deleted factions.

This commit is contained in:
Simon Clark
2021-06-21 01:14:07 +01:00
parent ef3f7125b3
commit c2f112e3a6
13 changed files with 341 additions and 138 deletions

View File

@@ -19,8 +19,8 @@ from game.data.weapons import (
Weapon,
)
from game.profiling import logged_duration
from game.settings import ModSettings, Settings
from game.theater.start_generator import GameGenerator, GeneratorSettings
from game.settings import Settings
from game.theater.start_generator import GameGenerator, GeneratorSettings, ModSettings
from qt_ui import (
liberation_install,
liberation_theme,

View File

@@ -24,8 +24,8 @@ class QFactionsInfos(QGroupBox):
def setGame(self, game: Game):
if game is not None:
self.player_name.setText(game.player_name)
self.enemy_name.setText(game.enemy_name)
self.player_name.setText(game.player_faction.name)
self.enemy_name.setText(game.enemy_faction.name)
else:
self.player_name.setText("")
self.enemy_name.setText("")

View File

@@ -267,8 +267,8 @@ class QTopPanel(QFrame):
closest_cps[0],
closest_cps[1],
self.game.theater.controlpoints[0].position,
self.game.player_name,
self.game.enemy_name,
self.game.player_faction.name,
self.game.enemy_faction.name,
)
unit_map = self.game.initiate_event(game_event)

View File

@@ -10,8 +10,9 @@ from PySide2.QtWidgets import QVBoxLayout, QTextEdit, QLabel, QCheckBox
from jinja2 import Environment, FileSystemLoader, select_autoescape
from game import db
from game.settings import Settings, ModSettings
from game.theater.start_generator import GameGenerator, GeneratorSettings
from game.settings import Settings
from game.theater.start_generator import GameGenerator, GeneratorSettings, ModSettings
from game.factions.faction import Faction
from qt_ui.widgets.QLiberationCalendar import QLiberationCalendar
from qt_ui.widgets.spinsliders import TenthsSpinSlider, TimeInputs, CurrencySpinner
from qt_ui.windows.newgame.QCampaignList import (
@@ -112,8 +113,8 @@ class NewGameWizard(QtWidgets.QWizard):
high_digit_sams=self.field("high_digit_sams"),
)
blue_faction = [c for c in db.FACTIONS][self.field("blueFaction")]
red_faction = [c for c in db.FACTIONS][self.field("redFaction")]
blue_faction = self.faction_selection_page.selected_blue_faction
red_faction = self.faction_selection_page.selected_red_faction
generator = GameGenerator(
blue_faction,
red_faction,
@@ -258,6 +259,14 @@ class FactionSelection(QtWidgets.QWizardPage):
self.blueFactionDescription.setText(blue_faction_txt)
self.redFactionDescription.setText(red_faction_txt)
@property
def selected_blue_faction(self) -> Faction:
return db.FACTIONS[self.blueFactionSelect.currentText()]
@property
def selected_red_faction(self) -> Faction:
return db.FACTIONS[self.redFactionSelect.currentText()]
class TheaterConfiguration(QtWidgets.QWizardPage):
def __init__(