Hide sim speed controls behind a flag.

Flag is only controlled from the command-line because redoing Qt layout
usually breaks things. Off by default in 6 since this feature is nowhere
near done enough to even be used experimentally (most changes to the ATO
made after the sim begins will break the game).

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2535.
This commit is contained in:
Dan Albert
2022-11-19 15:47:22 -08:00
parent 7b50894ca6
commit 8ed0efe241
4 changed files with 48 additions and 10 deletions

View File

@@ -28,6 +28,7 @@ from qt_ui import (
liberation_theme,
uiconstants,
)
from qt_ui.uiflags import UiFlags
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
from qt_ui.windows.QLiberationWindow import QLiberationWindow
from qt_ui.windows.preferences.QLiberationFirstStartWindow import (
@@ -61,7 +62,7 @@ def on_game_load(game: Game | None) -> None:
EventStream.put_nowait(GameUpdateEvents().game_loaded(game))
def run_ui(game: Game | None, dev: bool) -> None:
def run_ui(game: Game | None, ui_flags: UiFlags) -> None:
os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "1" # Potential fix for 4K screens
QApplication.setHighDpiScaleFactorRoundingPolicy(
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
@@ -150,7 +151,7 @@ def run_ui(game: Game | None, dev: bool) -> None:
GameUpdateSignal.get_instance().game_loaded.connect(on_game_load)
# Start window
window = QLiberationWindow(game, dev)
window = QLiberationWindow(game, ui_flags)
window.showMaximized()
splash.finish(window)
qt_execution_code = app.exec_()
@@ -180,6 +181,19 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--dev", action="store_true", help="Enable development mode.")
speed_controls_group = parser.add_argument_group()
speed_controls_group.add_argument(
"--show-sim-speed-controls",
action="store_true",
help="Shows the sim speed controls in the top panel.",
)
speed_controls_group.add_argument(
"--no-show-sim-speed-controls",
dest="show_sim_speed_controls",
action="store_false",
help="Hides the sim speed controls in the top panel (default).",
)
parser.add_argument("--new-map", help="Deprecated. Does nothing.")
parser.add_argument("--old-map", help="Deprecated. Does nothing.")
@@ -364,7 +378,7 @@ def main():
return
with Server().run_in_thread():
run_ui(game, args.dev)
run_ui(game, UiFlags(args.dev, args.show_sim_speed_controls))
if __name__ == "__main__":