Condense budget and intel sections of the top panel.

Budget and Intel panels now house a single button instead of separate Details buttons. Makes the top bar more compact and can fit in a 1080p monitor now.
This commit is contained in:
HerrTom 2021-04-25 18:38:45 -07:00 committed by GitHub
parent 5c0f6cf65e
commit fa5d64022d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 14 deletions

View File

@ -14,18 +14,14 @@ class QBudgetBox(QGroupBox):
super(QBudgetBox, self).__init__("Budget")
self.game = game
self.money_icon = QLabel()
self.money_icon.setPixmap(CONST.ICONS["Money"])
self.money_amount = QLabel()
self.finances = QPushButton("Details")
self.finances = QPushButton()
self.finances.setDisabled(True)
self.finances.setProperty("style", "btn-primary")
self.finances.setIcon(CONST.ICONS["Money"])
self.finances.clicked.connect(self.openFinances)
self.layout = QHBoxLayout()
self.layout.addWidget(self.money_icon)
self.layout.addWidget(self.money_amount)
self.layout.addWidget(self.finances)
self.setLayout(self.layout)
@ -35,7 +31,7 @@ class QBudgetBox(QGroupBox):
:param budget: Current money available
:param reward: Planned reward for next turn
"""
self.money_amount.setText(
self.finances.setText(
str(round(budget, 2)) + "M (+" + str(round(reward, 2)) + "M)"
)

View File

@ -24,23 +24,39 @@ class QIntelBox(QGroupBox):
self.setLayout(columns)
summary = QGridLayout()
columns.addLayout(summary)
summary.setContentsMargins(5, 5, 5, 5)
summary.addWidget(QLabel("Air superiority:"), 0, 0)
air_superiority = QLabel("Air superiority:")
summary.addWidget(air_superiority, 0, 0)
self.air_strength = QLabel()
summary.addWidget(self.air_strength, 0, 1)
summary.addWidget(QLabel("Front line:"), 1, 0)
front_line = QLabel("Front line:")
summary.addWidget(front_line, 1, 0)
self.ground_strength = QLabel()
summary.addWidget(self.ground_strength, 1, 1)
summary.addWidget(QLabel("Economic strength:"), 2, 0)
economy = QLabel("Economic strength:")
summary.addWidget(economy, 2, 0)
self.economic_strength = QLabel()
summary.addWidget(self.economic_strength, 2, 1)
details = QPushButton("Details")
columns.addWidget(details)
details.clicked.connect(self.open_details_window)
# some dirty styling to make the labels show up well on the button
button_text_style = "background-color: rgba(0,0,0,0%); color: white;"
air_superiority.setStyleSheet(button_text_style)
front_line.setStyleSheet(button_text_style)
economy.setStyleSheet(button_text_style)
self.air_strength.setStyleSheet(button_text_style)
self.ground_strength.setStyleSheet(button_text_style)
self.economic_strength.setStyleSheet(button_text_style)
self.details = QPushButton()
self.details.setMinimumHeight(50)
self.details.setMinimumWidth(210)
self.details.setLayout(summary)
columns.addWidget(self.details)
self.details.clicked.connect(self.open_details_window)
self.details.setEnabled(False)
self.update_summary()
@ -48,6 +64,7 @@ class QIntelBox(QGroupBox):
def set_game(self, game: Optional[Game]) -> None:
self.game = game
self.details.setEnabled(True)
self.update_summary()
@staticmethod