swarm-0.5.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.TUI.Launch.Prep

Description

Prepares and validates scenario launch parameters

Synopsis

Documentation

initConfigPanel :: IO LaunchOptions Source #

Called before any particular scenario is selected, so we supply some Nothings as defaults to the ValidatedLaunchParams.

prepareLaunchDialog :: ScenarioInfoPair -> EventM Name LaunchOptions () Source #

If the selected scenario has been launched with an initial script before, set the file browser to initially open that script's directory. Then set the launch dialog to be displayed.

Note that the FileBrowser widget normally allows multiple selections ("marked" files). However, there do not exist any public "setters" set the marked files, so we have some workarounds:

  • When the user marks the first file, we immediately close the FileBrowser widget.
  • We re-instantiate the FileBrowser from scratch every time it is opened, so that it is not possible to mark more than one file.
  • The "marked file" is persisted outside of the FileBrowser state, and the "initial directory" is set upon instantiation from that external state.