mirror of
https://github.com/onyx-and-iris/q3rcon-tui.git
synced 2026-02-26 03:09:09 +00:00
implement separate button handlers
patch bump
This commit is contained in:
parent
e10bec03ed
commit
ee45bfd03f
@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
|
# SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
__version__ = '0.6.0'
|
__version__ = '0.6.1'
|
||||||
|
|||||||
@ -37,21 +37,27 @@ class RconApp(App):
|
|||||||
self.query_one('#config', Button).press()
|
self.query_one('#config', Button).press()
|
||||||
|
|
||||||
async def on_button_pressed(self, event: Button.Pressed) -> None:
|
async def on_button_pressed(self, event: Button.Pressed) -> None:
|
||||||
if event.button.id == 'quit':
|
match event.button.id:
|
||||||
self.app.exit()
|
case 'quit':
|
||||||
elif event.button.id == 'config':
|
self._quit_button_handler()
|
||||||
result = await self.push_screen(
|
case 'config':
|
||||||
ConfigScreen(settings.host, settings.port, settings.password)
|
await self._config_button_handler()
|
||||||
|
case 'send':
|
||||||
|
await self._send_button_handler()
|
||||||
|
|
||||||
|
def _quit_button_handler(self):
|
||||||
|
self.app.exit()
|
||||||
|
|
||||||
|
async def _config_button_handler(self):
|
||||||
|
result = await self.push_screen(
|
||||||
|
ConfigScreen(settings.host, settings.port, settings.password)
|
||||||
|
)
|
||||||
|
if result:
|
||||||
|
self.query_one('#response', RichLog).write(
|
||||||
|
f'Configuration updated: {settings.host}:{settings.port}'
|
||||||
)
|
)
|
||||||
if result:
|
|
||||||
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:
|
if not settings.append:
|
||||||
self.query_one('#response', RichLog).clear()
|
self.query_one('#response', RichLog).clear()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user