2026-02-05 08:42:38 +01:00
|
|
|
from PyQt6.QtWidgets import QWidget, QDialog
|
|
|
|
|
|
2026-02-12 15:12:28 +01:00
|
|
|
from warchron.constants import Icons, IconName
|
2026-02-05 08:42:38 +01:00
|
|
|
from warchron.view.ui.ui_player_dialog import Ui_playerDialog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PlayerDialog(QDialog):
|
|
|
|
|
def __init__(
|
|
|
|
|
self, parent: QWidget | None = None, *, default_name: str = ""
|
|
|
|
|
) -> None:
|
|
|
|
|
super().__init__(parent)
|
|
|
|
|
self.ui: Ui_playerDialog = Ui_playerDialog()
|
|
|
|
|
self.ui.setupUi(self) # type: ignore
|
|
|
|
|
self.ui.playerName.setText(default_name)
|
2026-02-12 15:12:28 +01:00
|
|
|
self.setWindowIcon(Icons.get(IconName.WARCHRON))
|
2026-02-05 08:42:38 +01:00
|
|
|
|
|
|
|
|
def get_player_name(self) -> str:
|
|
|
|
|
return self.ui.playerName.text().strip()
|