Move misc buttons to the toolbar.

The top panel is a bit overfull on some displays whenever the weather
description is verbose.
This commit is contained in:
Dan Albert 2023-06-07 21:17:51 -07:00
parent e44b6b416b
commit 6640609caf
3 changed files with 22 additions and 30 deletions

View File

@ -25,9 +25,7 @@ from qt_ui.widgets.QFactionsInfos import QFactionsInfos
from qt_ui.widgets.QIntelBox import QIntelBox
from qt_ui.widgets.clientslots import MaxPlayerCount
from qt_ui.widgets.simspeedcontrols import SimSpeedControls
from qt_ui.windows.AirWingDialog import AirWingDialog
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
from qt_ui.windows.PendingTransfersDialog import PendingTransfersDialog
from qt_ui.windows.QWaitingForMissionResultWindow import QWaitingForMissionResultWindow
@ -69,24 +67,8 @@ class QTopPanel(QFrame):
self.factionsInfos = QFactionsInfos(self.game)
self.air_wing = QPushButton("Air Wing")
self.air_wing.setDisabled(True)
self.air_wing.setProperty("style", "btn-primary")
self.air_wing.clicked.connect(self.open_air_wing)
self.transfers = QPushButton("Transfers")
self.transfers.setDisabled(True)
self.transfers.setProperty("style", "btn-primary")
self.transfers.clicked.connect(self.open_transfers)
self.intel_box = QIntelBox(self.game)
self.buttonBox = QGroupBox("Misc")
self.buttonBoxLayout = QHBoxLayout()
self.buttonBoxLayout.addWidget(self.air_wing)
self.buttonBoxLayout.addWidget(self.transfers)
self.buttonBox.setLayout(self.buttonBoxLayout)
self.proceedBox = QGroupBox("Proceed")
self.proceedBoxLayout = QHBoxLayout()
if ui_flags.show_sim_speed_controls:
@ -102,7 +84,6 @@ class QTopPanel(QFrame):
self.layout.addWidget(self.conditionsWidget)
self.layout.addWidget(self.budgetBox)
self.layout.addWidget(self.intel_box)
self.layout.addWidget(self.buttonBox)
self.layout.addStretch(1)
self.layout.addWidget(self.proceedBox)
@ -121,9 +102,6 @@ class QTopPanel(QFrame):
if game is None:
return
self.air_wing.setEnabled(True)
self.transfers.setEnabled(True)
self.conditionsWidget.setCurrentTurn(game.turn, game.conditions)
if game.conditions.weather.clouds:
@ -147,14 +125,6 @@ class QTopPanel(QFrame):
else:
self.proceedButton.setEnabled(True)
def open_air_wing(self):
self.dialog = AirWingDialog(self.game_model, self.window())
self.dialog.show()
def open_transfers(self):
self.dialog = PendingTransfersDialog(self.game_model)
self.dialog.show()
def passTurn(self):
with logged_duration("Skipping turn"):
self.game.pass_turn(no_action=True)

View File

@ -33,8 +33,10 @@ from qt_ui.uncaughtexceptionhandler import UncaughtExceptionHandler
from qt_ui.widgets.QTopPanel import QTopPanel
from qt_ui.widgets.ato import QAirTaskingOrderPanel
from qt_ui.widgets.map.QLiberationMap import QLiberationMap
from qt_ui.windows.AirWingDialog import AirWingDialog
from qt_ui.windows.BugReportDialog import BugReportDialog
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
from qt_ui.windows.PendingTransfersDialog import PendingTransfersDialog
from qt_ui.windows.QDebriefingWindow import QDebriefingWindow
from qt_ui.windows.basemenu.QBaseMenu2 import QBaseMenu2
from qt_ui.windows.groundobject.QGroundObjectMenu import QGroundObjectMenu
@ -221,6 +223,12 @@ class QLiberationWindow(QMainWindow):
self.openNotesAction.setIcon(CONST.ICONS["Notes"])
self.openNotesAction.triggered.connect(self.showNotesDialog)
self.openAirWingAction = QAction("Air Wing", self)
self.openAirWingAction.triggered.connect(self.showAirWingDialog)
self.openTransfersAction = QAction("Transfers", self)
self.openTransfersAction.triggered.connect(self.showTransfersDialog)
self.importTemplatesAction = QAction("Import Layouts", self)
self.importTemplatesAction.triggered.connect(self.import_templates)
@ -253,6 +261,8 @@ class QLiberationWindow(QMainWindow):
self.actions_bar.addAction(self.openSettingsAction)
self.actions_bar.addAction(self.openStatsAction)
self.actions_bar.addAction(self.openNotesAction)
self.actions_bar.addAction(self.openAirWingAction)
self.actions_bar.addAction(self.openTransfersAction)
def initMenuBar(self):
self.menu = self.menuBar()
@ -526,6 +536,14 @@ class QLiberationWindow(QMainWindow):
self.dialog = QNotesWindow(self.game)
self.dialog.show()
def showAirWingDialog(self) -> None:
self.dialog = AirWingDialog(self.game_model, self)
self.dialog.show()
def showTransfersDialog(self) -> None:
self.dialog = PendingTransfersDialog(self.game_model)
self.dialog.show()
def import_templates(self):
LAYOUTS.import_templates()

View File

@ -63,6 +63,10 @@ QToolBar::separator {
height:1px;
}
QToolBar QToolButton {
font: bold 18px;
}
QMenu::item:selected {
background: #435466;
}