Notes to kneeboard (#1375)

Adds global-level kneeboard notes.  Explicit save compatability with 4.0.0
This commit is contained in:
Chris Seagraves
2021-06-30 17:07:53 -05:00
committed by GitHub
parent 2a5c523afd
commit e94d48c265
10 changed files with 106 additions and 0 deletions

View File

@@ -554,6 +554,28 @@ class StrikeTaskPage(KneeboardPage):
]
class NotesPage(KneeboardPage):
"""A kneeboard page containing the campaign owner's notes."""
def __init__(
self,
game: "Game",
dark_kneeboard: bool,
) -> None:
self.game = game
self.dark_kneeboard = dark_kneeboard
def write(self, path: Path) -> None:
writer = KneeboardPageWriter(dark_theme=self.dark_kneeboard)
writer.title(f"Notes")
try:
writer.text(self.game.notes)
except AttributeError: # old saves may not have .notes ;)
writer.text("")
writer.write(path)
class KneeboardGenerator(MissionInfoGenerator):
"""Creates kneeboard pages for each client flight in the mission."""
@@ -621,6 +643,10 @@ class KneeboardGenerator(MissionInfoGenerator):
self.mission.start_time,
self.dark_kneeboard,
),
NotesPage(
self.game,
self.dark_kneeboard,
),
]
if (target_page := self.generate_task_page(flight)) is not None: