Remove type check param from query(); it's only allowed on query_one()

This commit is contained in:
Isaiah Odhner 2023-04-21 11:38:20 -04:00
parent 502a68209d
commit 04a99f8a1d

View File

@ -934,7 +934,7 @@ class PaintApp(App):
def watch_selected_tool(self, old_selected_tool: Tool, selected_tool: Tool) -> None: def watch_selected_tool(self, old_selected_tool: Tool, selected_tool: Tool) -> None:
"""Called when selected_tool changes.""" """Called when selected_tool changes."""
for button in self.query(".tool_button", Button): for button in self.query(".tool_button"):
if button.represented_tool == selected_tool: if button.represented_tool == selected_tool:
button.add_class("selected") button.add_class("selected")
else: else:
@ -1050,7 +1050,7 @@ class PaintApp(App):
async def save_as(self) -> None: async def save_as(self) -> None:
"""Save the image as a new file.""" """Save the image as a new file."""
for old_window in self.query("#save_as_dialog, #open_dialog", DialogWindow).nodes: for old_window in self.query("#save_as_dialog, #open_dialog").nodes:
old_window.close() old_window.close()
saved_future = asyncio.Future() saved_future = asyncio.Future()
@ -1150,7 +1150,7 @@ class PaintApp(App):
def warning_message_box(self, title: str, message_widget: Widget, button_types: str = "ok", callback = None) -> None: def warning_message_box(self, title: str, message_widget: Widget, button_types: str = "ok", callback = None) -> None:
"""Show a warning message box with the given title, message, and buttons.""" """Show a warning message box with the given title, message, and buttons."""
for old_window in self.query("#message_box", MessageBox).nodes: for old_window in self.query("#message_box").nodes:
old_window.close() old_window.close()
self.bell() self.bell()
@ -1219,7 +1219,7 @@ class PaintApp(App):
except Exception as e: except Exception as e:
self.warning_message_box(_("Open"), Static(_("An unexpected error occurred while reading %1.").replace("%1", filename) + "\n\n" + str(e)), "ok") self.warning_message_box(_("Open"), Static(_("An unexpected error occurred while reading %1.").replace("%1", filename) + "\n\n" + str(e)), "ok")
for old_window in self.query("#save_as_dialog, #open_dialog", DialogWindow).nodes: for old_window in self.query("#save_as_dialog, #open_dialog").nodes:
old_window.close() old_window.close()
window = DialogWindow( window = DialogWindow(
id="open_dialog", id="open_dialog",
@ -1264,7 +1264,7 @@ class PaintApp(App):
def action_open_character_selector(self) -> None: def action_open_character_selector(self) -> None:
"""Show dialog to select a character.""" """Show dialog to select a character."""
for old_window in self.query("#character_selector_dialog", CharacterSelectorDialogWindow).nodes: for old_window in self.query("#character_selector_dialog").nodes:
old_window.close() old_window.close()
def handle_selected_character(character): def handle_selected_character(character):
self.selected_char = character self.selected_char = character
@ -1337,7 +1337,7 @@ class PaintApp(App):
self.warning_message_box(_("Paint"), "Not implemented.", "ok") self.warning_message_box(_("Paint"), "Not implemented.", "ok")
def action_help_topics(self) -> None: def action_help_topics(self) -> None:
for old_window in self.query("#help_dialog", DialogWindow).nodes: for old_window in self.query("#help_dialog").nodes:
old_window.close() old_window.close()
window = DialogWindow( window = DialogWindow(
id="help_dialog", id="help_dialog",
@ -1351,7 +1351,7 @@ class PaintApp(App):
def action_about_paint(self) -> None: def action_about_paint(self) -> None:
"""Show the About Paint dialog.""" """Show the About Paint dialog."""
for old_window in self.query("#about_paint_dialog", DialogWindow).nodes: for old_window in self.query("#about_paint_dialog").nodes:
old_window.close() old_window.close()
window = DialogWindow( window = DialogWindow(
id="about_paint_dialog", id="about_paint_dialog",