Improved layout for airbase window layout.

Fixed missing icons for some windows.
This commit is contained in:
Khopa 2019-10-11 01:14:43 +02:00
parent 6b77e1cce5
commit 4c3ff906ff
12 changed files with 57 additions and 33 deletions

View File

@ -1130,7 +1130,7 @@ FACTIONS = {
] ]
}, },
"USA 1944 (WIP)": { "USA 1944 (WIP) (Require WW2 Pack)": {
"country": "USA", "country": "USA",
"side": "blue", "side": "blue",
"units": [ "units": [
@ -1150,7 +1150,7 @@ FACTIONS = {
] ]
}, },
"Germany 1944 (WIP)": { "Germany 1944 (WIP) (Require WW2 Pack)": {
"country": "Russia", # WIP "country": "Russia", # WIP
"side": "red", "side": "red",
"units": [ "units": [
@ -1405,6 +1405,8 @@ def task_name(task) -> str:
return "AirDefence" return "AirDefence"
elif task == Embarking: elif task == Embarking:
return "Transportation" return "Transportation"
elif task == PinpointStrike:
return "Ground units"
else: else:
return task.name return task.name

View File

@ -43,7 +43,7 @@ if __name__ == "__main__":
app.processEvents() app.processEvents()
# Uncomment to apply CSS (need works) # Uncomment to apply CSS (need works)
#app.setStyleSheet(css) app.setStyleSheet(css)
GameUpdateSignal() GameUpdateSignal()

View File

@ -72,6 +72,11 @@ def load_icons():
ICONS["Missile"] = QPixmap("./resources/ui/misc/missile.png") ICONS["Missile"] = QPixmap("./resources/ui/misc/missile.png")
ICONS["Cheat"] = QPixmap("./resources/ui/misc/cheat.png") ICONS["Cheat"] = QPixmap("./resources/ui/misc/cheat.png")
ICONS["TaskCAS"] = QPixmap("./resources/ui/tasks/cas.png")
ICONS["TaskCAP"] = QPixmap("./resources/ui/tasks/cap.png")
ICONS["TaskSEAD"] = QPixmap("./resources/ui/tasks/sead.png")
ICONS["TaskEmpty"] = QPixmap("./resources/ui/tasks/empty.png")
EVENT_ICONS: Dict[str, QPixmap] = {} EVENT_ICONS: Dict[str, QPixmap] = {}

View File

@ -59,13 +59,11 @@ class QBaseMenu(QDialog):
Embarking: db.find_unittype(Embarking, self.game.player_name), Embarking: db.find_unittype(Embarking, self.game.player_name),
CAS: db.find_unittype(CAS, self.game.player_name), CAS: db.find_unittype(CAS, self.game.player_name),
PinpointStrike: db.find_unittype(PinpointStrike, self.game.player_name), PinpointStrike: db.find_unittype(PinpointStrike, self.game.player_name),
AirDefence: db.find_unittype(AirDefence, self.game.player_name),
} }
else: else:
units = { units = {
CAP: db.find_unittype(CAP, self.game.enemy_name), CAP: db.find_unittype(CAP, self.game.enemy_name),
Embarking: db.find_unittype(Embarking, self.game.enemy_name), Embarking: db.find_unittype(Embarking, self.game.enemy_name),
AirDefence: db.find_unittype(AirDefence, self.game.enemy_name),
CAS: db.find_unittype(CAS, self.game.enemy_name), CAS: db.find_unittype(CAS, self.game.enemy_name),
PinpointStrike: db.find_unittype(PinpointStrike, self.game.enemy_name), PinpointStrike: db.find_unittype(PinpointStrike, self.game.enemy_name),
} }
@ -76,12 +74,12 @@ class QBaseMenu(QDialog):
tasks = list(units.keys()) tasks = list(units.keys())
tasks_per_column = 3 tasks_per_column = 3
self.unitLayout = QGridLayout() self.unitLayout = QVBoxLayout()
self.bought_amount_labels = {} self.bought_amount_labels = {}
row = 0 row = 0
def add_purchase_row(unit_type): def add_purchase_row(unit_type, layout):
nonlocal row nonlocal row
existing_units = self.cp.base.total_units_of_type(unit_type) existing_units = self.cp.base.total_units_of_type(unit_type)
@ -94,16 +92,18 @@ class QBaseMenu(QDialog):
price = QLabel("{}m".format(db.PRICES[unit_type])) price = QLabel("{}m".format(db.PRICES[unit_type]))
buy = QPushButton("+") buy = QPushButton("+")
buy.setProperty("style", "btn-success")
buy.clicked.connect(lambda: self.buy(unit_type)) buy.clicked.connect(lambda: self.buy(unit_type))
sell = QPushButton("-") sell = QPushButton("-")
sell.setProperty("style", "btn-danger")
sell.clicked.connect(lambda: self.sell(unit_type)) sell.clicked.connect(lambda: self.sell(unit_type))
self.unitLayout.addWidget(unitName, row, 0) layout.addWidget(unitName, row, 0)
self.unitLayout.addWidget(amountBought, row, 1) layout.addWidget(amountBought, row, 1)
self.unitLayout.addWidget(price, row, 2) layout.addWidget(price, row, 2)
self.unitLayout.addWidget(buy, row, 3) layout.addWidget(buy, row, 3)
self.unitLayout.addWidget(sell, row, 4) layout.addWidget(sell, row, 4)
row = row + 1 row = row + 1
@ -115,12 +115,14 @@ class QBaseMenu(QDialog):
if len(units_column) == 0: continue if len(units_column) == 0: continue
units_column.sort(key=lambda x: db.PRICES[x]) units_column.sort(key=lambda x: db.PRICES[x])
taskTypeLabel = QLabel("<b>{}</b>".format(db.task_name(task_type))) taskBox = QGroupBox("{}".format(db.task_name(task_type)))
self.unitLayout.addWidget(taskTypeLabel, row, 0) taskBoxLayout = QGridLayout()
row = row + 1 taskBox.setLayout(taskBoxLayout)
row = 0
for unit_type in units_column: for unit_type in units_column:
add_purchase_row(unit_type) add_purchase_row(unit_type, taskBoxLayout)
self.unitLayout.addWidget(taskBox)
self.mainLayout.addLayout(self.unitLayout) self.mainLayout.addLayout(self.unitLayout)
else: else:
intel = QGroupBox("Intel") intel = QGroupBox("Intel")

View File

@ -1,12 +1,8 @@
import os from PySide2.QtGui import QIcon
from PySide2 import QtCore
from PySide2.QtGui import QMovie
from PySide2.QtWidgets import QLabel, QDialog, QVBoxLayout, QGroupBox, QGridLayout, QPushButton from PySide2.QtWidgets import QLabel, QDialog, QVBoxLayout, QGroupBox, QGridLayout, QPushButton
from game.game import Event, db, Game from game.game import Event, db, Game
from userdata.debriefing import wait_for_debriefing, Debriefing from userdata.debriefing import Debriefing
from userdata.persistency import base_path
class QDebriefingWindow(QDialog): class QDebriefingWindow(QDialog):
@ -17,6 +13,7 @@ class QDebriefingWindow(QDialog):
self.setModal(True) self.setModal(True)
self.setWindowTitle("Debriefing") self.setWindowTitle("Debriefing")
self.setMinimumSize(300, 200) self.setMinimumSize(300, 200)
self.setWindowIcon(QIcon("./resources/icon.png"))
self.game = game self.game = game
self.gameEvent = gameEvent self.gameEvent = gameEvent

View File

@ -1,7 +1,7 @@
import os import os
from PySide2 import QtCore from PySide2 import QtCore
from PySide2.QtGui import QMovie from PySide2.QtGui import QMovie, QIcon
from PySide2.QtWidgets import QLabel, QDialog, QVBoxLayout from PySide2.QtWidgets import QLabel, QDialog, QVBoxLayout
from game.game import Event, Game from game.game import Event, Game
@ -19,6 +19,7 @@ class QWaitingForMissionResultWindow(QDialog):
self.game = game self.game = game
self.setWindowTitle("Waiting for mission completion.") self.setWindowTitle("Waiting for mission completion.")
self.setWindowFlag(QtCore.Qt.WindowCloseButtonHint, False) self.setWindowFlag(QtCore.Qt.WindowCloseButtonHint, False)
self.setWindowIcon(QIcon("./resources/icon.png"))
self.initUi() self.initUi()
wait_for_debriefing(lambda debriefing: self.process_debriefing(debriefing)) wait_for_debriefing(lambda debriefing: self.process_debriefing(debriefing))

View File

@ -1,6 +1,6 @@
QWidget { /*QWidget {
background-color: #4E5760; background-color: #4E5760;
color:white; color:white;
} }
@ -21,22 +21,39 @@ QTopPanel *{
color: white; color: white;
font-size: 12px; font-size: 12px;
font-weight: bold; font-weight: bold;
} }*/
QPushButton[style="btn-primary"]{ QPushButton[style="btn-success"]{
background-color:#699245; background-color:#699245;
color: white;
cursor:pointer; cursor:pointer;
padding: 5px 5px 5px 5px; padding: 5px 5px 5px 5px;
border-radius:2px; border-radius:5px;
} }
QPushButton[style="btn-primary"]:hover{ QPushButton[style="btn-success"]:hover{
background-color:#f00; background-color:#8ABC5A;
padding: 5px 5px 5px 5px; padding: 5px 5px 5px 5px;
border-radius:2px; border-radius:5px;
cursor: pointer;
} }
QBaseMenu{ QPushButton[style="btn-danger"]{
background-color:#9E3232;
color: white;
cursor:pointer;
padding: 5px 5px 5px 5px;
border-radius:5px;
}
QPushButton[style="btn-danger"]:hover{
background-color:#D84545;
padding: 5px 5px 5px 5px;
border-radius:5px;
cursor: pointer;
}
/*QBaseMenu{
background-color:#699245; background-color:#699245;
color:white; color:white;
} }
@ -44,4 +61,4 @@ QBaseMenu{
QWidget[style="baseMenuHeader"]{ QWidget[style="baseMenuHeader"]{
font-size: 24px; font-size: 24px;
font-weight: bold; font-weight: bold;
} }*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

BIN
resources/ui/tasks/cap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

BIN
resources/ui/tasks/cas.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

BIN
resources/ui/tasks/sead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B