Prevent multiple character selector dialogs from opening at once

This commit is contained in:
Isaiah Odhner 2023-04-20 11:54:42 -04:00
parent 74c4af1a5b
commit 61d1532552

View File

@ -1305,10 +1305,13 @@ class PaintApp(App):
def action_open_character_selector(self) -> None:
"""Show dialog to select a character."""
for old_window in self.query("#character_selector_dialog").nodes:
old_window.close()
def handle_selected_character(character):
self.selected_char = character
window.close()
window = CharacterSelectorDialog(
id="character_selector_dialog",
handle_selected_character=handle_selected_character,
selected_character=self.selected_char,
title=_("Choose Character"),