From 4c3ff906ffc9c4f097d2510d3855463d08ac2c4d Mon Sep 17 00:00:00 2001 From: Khopa Date: Fri, 11 Oct 2019 01:14:43 +0200 Subject: [PATCH] Improved layout for airbase window layout. Fixed missing icons for some windows. --- game/db.py | 6 ++- qt_ui/main.py | 2 +- qt_ui/uiconstants.py | 5 +++ qt_ui/windows/QBaseMenu.py | 30 ++++++++------- qt_ui/windows/QDebriefingWindow.py | 9 ++--- .../windows/QWaitingForMissionResultWindow.py | 3 +- resources/stylesheets/style.css | 35 +++++++++++++----- resources/ui/ground_assets/aa_blue.png | Bin 0 -> 234 bytes resources/ui/tasks/cap.png | Bin 0 -> 718 bytes resources/ui/tasks/cas.png | Bin 0 -> 551 bytes resources/ui/tasks/empty.png | Bin 0 -> 217 bytes resources/ui/tasks/sead.png | Bin 0 -> 572 bytes 12 files changed, 57 insertions(+), 33 deletions(-) create mode 100644 resources/ui/ground_assets/aa_blue.png create mode 100644 resources/ui/tasks/cap.png create mode 100644 resources/ui/tasks/cas.png create mode 100644 resources/ui/tasks/empty.png create mode 100644 resources/ui/tasks/sead.png diff --git a/game/db.py b/game/db.py index 4b22f9d1..4065b162 100644 --- a/game/db.py +++ b/game/db.py @@ -1130,7 +1130,7 @@ FACTIONS = { ] }, - "USA 1944 (WIP)": { + "USA 1944 (WIP) (Require WW2 Pack)": { "country": "USA", "side": "blue", "units": [ @@ -1150,7 +1150,7 @@ FACTIONS = { ] }, - "Germany 1944 (WIP)": { + "Germany 1944 (WIP) (Require WW2 Pack)": { "country": "Russia", # WIP "side": "red", "units": [ @@ -1405,6 +1405,8 @@ def task_name(task) -> str: return "AirDefence" elif task == Embarking: return "Transportation" + elif task == PinpointStrike: + return "Ground units" else: return task.name diff --git a/qt_ui/main.py b/qt_ui/main.py index b05d4232..9dd279ff 100644 --- a/qt_ui/main.py +++ b/qt_ui/main.py @@ -43,7 +43,7 @@ if __name__ == "__main__": app.processEvents() # Uncomment to apply CSS (need works) - #app.setStyleSheet(css) + app.setStyleSheet(css) GameUpdateSignal() diff --git a/qt_ui/uiconstants.py b/qt_ui/uiconstants.py index 8bb3a30d..12173ea8 100644 --- a/qt_ui/uiconstants.py +++ b/qt_ui/uiconstants.py @@ -72,6 +72,11 @@ def load_icons(): ICONS["Missile"] = QPixmap("./resources/ui/misc/missile.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] = {} diff --git a/qt_ui/windows/QBaseMenu.py b/qt_ui/windows/QBaseMenu.py index 7047c1ce..f6de6acf 100644 --- a/qt_ui/windows/QBaseMenu.py +++ b/qt_ui/windows/QBaseMenu.py @@ -59,13 +59,11 @@ class QBaseMenu(QDialog): Embarking: db.find_unittype(Embarking, self.game.player_name), CAS: db.find_unittype(CAS, self.game.player_name), PinpointStrike: db.find_unittype(PinpointStrike, self.game.player_name), - AirDefence: db.find_unittype(AirDefence, self.game.player_name), } else: units = { CAP: db.find_unittype(CAP, 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), PinpointStrike: db.find_unittype(PinpointStrike, self.game.enemy_name), } @@ -76,12 +74,12 @@ class QBaseMenu(QDialog): tasks = list(units.keys()) tasks_per_column = 3 - self.unitLayout = QGridLayout() + self.unitLayout = QVBoxLayout() self.bought_amount_labels = {} row = 0 - def add_purchase_row(unit_type): + def add_purchase_row(unit_type, layout): nonlocal row 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])) buy = QPushButton("+") + buy.setProperty("style", "btn-success") buy.clicked.connect(lambda: self.buy(unit_type)) sell = QPushButton("-") + sell.setProperty("style", "btn-danger") sell.clicked.connect(lambda: self.sell(unit_type)) - self.unitLayout.addWidget(unitName, row, 0) - self.unitLayout.addWidget(amountBought, row, 1) - self.unitLayout.addWidget(price, row, 2) - self.unitLayout.addWidget(buy, row, 3) - self.unitLayout.addWidget(sell, row, 4) + layout.addWidget(unitName, row, 0) + layout.addWidget(amountBought, row, 1) + layout.addWidget(price, row, 2) + layout.addWidget(buy, row, 3) + layout.addWidget(sell, row, 4) row = row + 1 @@ -115,12 +115,14 @@ class QBaseMenu(QDialog): if len(units_column) == 0: continue units_column.sort(key=lambda x: db.PRICES[x]) - taskTypeLabel = QLabel("{}".format(db.task_name(task_type))) - self.unitLayout.addWidget(taskTypeLabel, row, 0) - row = row + 1 - + taskBox = QGroupBox("{}".format(db.task_name(task_type))) + taskBoxLayout = QGridLayout() + taskBox.setLayout(taskBoxLayout) + row = 0 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) else: intel = QGroupBox("Intel") diff --git a/qt_ui/windows/QDebriefingWindow.py b/qt_ui/windows/QDebriefingWindow.py index af57ade5..1f2161f5 100644 --- a/qt_ui/windows/QDebriefingWindow.py +++ b/qt_ui/windows/QDebriefingWindow.py @@ -1,12 +1,8 @@ -import os - -from PySide2 import QtCore -from PySide2.QtGui import QMovie +from PySide2.QtGui import QIcon from PySide2.QtWidgets import QLabel, QDialog, QVBoxLayout, QGroupBox, QGridLayout, QPushButton from game.game import Event, db, Game -from userdata.debriefing import wait_for_debriefing, Debriefing -from userdata.persistency import base_path +from userdata.debriefing import Debriefing class QDebriefingWindow(QDialog): @@ -17,6 +13,7 @@ class QDebriefingWindow(QDialog): self.setModal(True) self.setWindowTitle("Debriefing") self.setMinimumSize(300, 200) + self.setWindowIcon(QIcon("./resources/icon.png")) self.game = game self.gameEvent = gameEvent diff --git a/qt_ui/windows/QWaitingForMissionResultWindow.py b/qt_ui/windows/QWaitingForMissionResultWindow.py index 26817fcb..c9ebb14b 100644 --- a/qt_ui/windows/QWaitingForMissionResultWindow.py +++ b/qt_ui/windows/QWaitingForMissionResultWindow.py @@ -1,7 +1,7 @@ import os from PySide2 import QtCore -from PySide2.QtGui import QMovie +from PySide2.QtGui import QMovie, QIcon from PySide2.QtWidgets import QLabel, QDialog, QVBoxLayout from game.game import Event, Game @@ -19,6 +19,7 @@ class QWaitingForMissionResultWindow(QDialog): self.game = game self.setWindowTitle("Waiting for mission completion.") self.setWindowFlag(QtCore.Qt.WindowCloseButtonHint, False) + self.setWindowIcon(QIcon("./resources/icon.png")) self.initUi() wait_for_debriefing(lambda debriefing: self.process_debriefing(debriefing)) diff --git a/resources/stylesheets/style.css b/resources/stylesheets/style.css index 2b15f333..c60a21fb 100644 --- a/resources/stylesheets/style.css +++ b/resources/stylesheets/style.css @@ -1,6 +1,6 @@ -QWidget { +/*QWidget { background-color: #4E5760; color:white; } @@ -21,22 +21,39 @@ QTopPanel *{ color: white; font-size: 12px; font-weight: bold; -} +}*/ -QPushButton[style="btn-primary"]{ +QPushButton[style="btn-success"]{ background-color:#699245; + color: white; cursor:pointer; padding: 5px 5px 5px 5px; - border-radius:2px; + border-radius:5px; } -QPushButton[style="btn-primary"]:hover{ - background-color:#f00; +QPushButton[style="btn-success"]:hover{ + background-color:#8ABC5A; 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; color:white; } @@ -44,4 +61,4 @@ QBaseMenu{ QWidget[style="baseMenuHeader"]{ font-size: 24px; font-weight: bold; -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/resources/ui/ground_assets/aa_blue.png b/resources/ui/ground_assets/aa_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..e3ecca48be4606276d37dd9ae024069e9770303d GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Ea{HEjtmSN`?>!lvI6;>1s;*b z3=Dh+L6~vJ#O${~L5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt3(J+r@loG*ZCGCW-z zLoEF7c3$seB8re z>6f-kigl5K&o;?KuMe+&&OPvn<-dl-n^4wZ_f>%%GLxG$c3n{DIGy-tYkZ3125#w< aWz1H)qcoK@4>bbqWbkzLb6Mw<&;$Tv7ElBL literal 0 HcmV?d00001 diff --git a/resources/ui/tasks/cap.png b/resources/ui/tasks/cap.png new file mode 100644 index 0000000000000000000000000000000000000000..6551c737803f4ec72f65919d799462a55f81972c GIT binary patch literal 718 zcmV;<0x|uGP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;jv63FrU-0zXMaK~zXfW1t6MN}cv-?sam8?K`XPCNJps2+@-Ad6$SpnT?T zA#quVI3pvIwNETu3W$Uy<$>aDYc3%Rib^X&)B}N>x&hDxm^g+7Kvx5~jv?tlmjb!9 z3yuJ}3(x(5$O3hOl{5IIR6|4{2xzN)U}+Q8ChIJNEVftj3^cH0>UJO--GcdNegWAz-K!u!s-x|3YUUg z(6#XKrXrkEi2Ch*$qohLbRbF3y(+@Jxd7NH@S*~i+9n5e-JLv0*E<4 zpk?OVyy6^09NmIBC%yvNIbACu(#QxX#l+0Q&dCiykeVc`V;Mvin2JoCgMjAFIQ$N- z1uTvc$r{G?KqtUez)@QB0-!RWiP@biAV^8a%*eqXA`7&@Bc>3p7>=-5P&#b~kZT{9 z3=FO*`(6}G*dV8--@oG_Fy&ZzMZPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;jv63FrU-0hmcdK~zXf?N-T313?rlMWY_nC6?Ul^)8 zxNO;ggCC&o;If%Pbz}xL@vjDtz&Y?yNfP(KO^PJmfKyd188e>V@B;#ou=}t-S^aD#8Tr201ttenmRhPGF#ZaOvy*u+^+xt literal 0 HcmV?d00001 diff --git a/resources/ui/tasks/empty.png b/resources/ui/tasks/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..b7ff2b232736c29dc4329bebc09f253a7bae9b82 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={W7>k44ofy`glX(f`u%tWsIx;Y9 z?C1WI$O`0h7I;J!GcfQS24TkI`72U@f)XXJ5hcO-X(i=}MX3x0iJ5sNdU>fO3MP7n zdS-w9I9~wOczL=whIn|ty|$3=fB^?X;F(z`XU+QezrL(Pt=QIh**n(ehdLkISKqBY zb6)-YI|seh4)aV4(ikKi*d{QhK&UTlr{>>x669~$>ugfw$Gi||Dubu1pUXO@geCyi CE=7I- literal 0 HcmV?d00001 diff --git a/resources/ui/tasks/sead.png b/resources/ui/tasks/sead.png new file mode 100644 index 0000000000000000000000000000000000000000..06eb74721ebdbd3ba4a3df0a8c3023599e1ae92d GIT binary patch literal 572 zcmV-C0>k}@P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E;jv63FrU-0j)_yK~zXf?Uvh10#OjgzcRZTc{jA}qA8}C zX)1QHEKNv?BB+Q$s3;<$D2#}r{`F=&r*&(We9<0ahmU1u&dm7@=bVSdUzoMG-|q3Z zU9_zPP=Jq0+r`_OfL~<-TFL~plo8-CiKHJ3W2h}~xSv2qVPzEzSY-`~Y7XX_VSa)O z=v$q^Q&G+902ev9262|faSA=%oLQg7qyx1Ki&jPF(LAgcM7=U3`D`eMags*R$#Y!h zMP3Kki6QKkJwgPC`@UsJiBW9FxJ@0F0Hw%FT1F|%slpV81n}5U4Dnpoi=5e;#khkVx*o+Y zyR?9p4LN}^KT6uBhV+(J zgY2k)`vNAN{FWL8I)FGFdNyRcan2Bcj9_Ge5mci{2ShWAo)+C1IRv0{C!^Wbi!nZ; z_f6a`s}-!ba#Py8(DOQfsmo~92+&rUfR-`=E%l!O9sl|5paGxW=RW(d6rdac0000< KMNUMnLSTaXDD*1; literal 0 HcmV?d00001