implement separate button handlers

patch bump
This commit is contained in:
onyx-and-iris 2026-02-22 15:04:50 +00:00
parent e10bec03ed
commit ee45bfd03f
2 changed files with 20 additions and 14 deletions

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
#
# SPDX-License-Identifier: MIT
__version__ = '0.6.0'
__version__ = '0.6.1'

View File

@ -37,9 +37,18 @@ class RconApp(App):
self.query_one('#config', Button).press()
async def on_button_pressed(self, event: Button.Pressed) -> None:
if event.button.id == 'quit':
match event.button.id:
case 'quit':
self._quit_button_handler()
case 'config':
await self._config_button_handler()
case 'send':
await self._send_button_handler()
def _quit_button_handler(self):
self.app.exit()
elif event.button.id == 'config':
async def _config_button_handler(self):
result = await self.push_screen(
ConfigScreen(settings.host, settings.port, settings.password)
)
@ -47,11 +56,8 @@ class RconApp(App):
self.query_one('#response', RichLog).write(
f'Configuration updated: {settings.host}:{settings.port}'
)
return
if event.button.id != 'send':
return
async def _send_button_handler(self):
if not settings.append:
self.query_one('#response', RichLog).clear()