mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Stop cluttering the kneeboard with empty notes.
This commit is contained in:
parent
8e977f994f
commit
d11174da21
@ -578,20 +578,16 @@ class NotesPage(KneeboardPage):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
game: "Game",
|
||||
notes: str,
|
||||
dark_kneeboard: bool,
|
||||
) -> None:
|
||||
self.game = game
|
||||
self.notes = notes
|
||||
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.text(self.notes)
|
||||
writer.write(path)
|
||||
|
||||
|
||||
@ -663,12 +659,12 @@ class KneeboardGenerator(MissionInfoGenerator):
|
||||
self.mission.start_time,
|
||||
self.dark_kneeboard,
|
||||
),
|
||||
NotesPage(
|
||||
self.game,
|
||||
self.dark_kneeboard,
|
||||
),
|
||||
]
|
||||
|
||||
# Only create the notes page if there are notes to show.
|
||||
if notes := self.game.notes:
|
||||
pages.append(NotesPage(notes, self.dark_kneeboard))
|
||||
|
||||
if (target_page := self.generate_task_page(flight)) is not None:
|
||||
pages.append(target_page)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user