Some minor UI tweaks

This commit is contained in:
Alex Davies 2024-11-06 15:59:04 -04:00
parent a272fdff0f
commit 5f5aa7f830
2 changed files with 7 additions and 8 deletions

View File

@ -62,7 +62,7 @@ async def main():
ui.separator()
ui.label("Current robots")
robots_widget = ui.element()
robots_widget = ui.element().classes("w-full")
#Add a new robot
with new_robot_widget:

View File

@ -64,23 +64,20 @@ class Robot:
self.processes = []
robots.add(self)
async def async_stop(self):
return await run.io_bound(self.stop)
async def ui(self, element):
adocker = aiodocker.Docker()
with element:
robot_ui = ui.element()
robot_ui = ui.element().classes("w-full outline p-4")
with robot_ui:
ui.label(f"{self.robot_type}")
ui.label(f"""Sysid: {self.sysid}""")
ui.button("Start", on_click=self.start)
ui.button("Stop", on_click=self.async_stop)
ui.button("Start", on_click=self.start).classes("m-2")
ui.button("Stop", on_click=self.async_stop).classes("m-2")
async def delete_robot():
await self.async_stop()
robots.remove(self)
element.remove(robot_ui)
ui.button("Delete", on_click=delete_robot)
ui.button("Delete", on_click=delete_robot).classes("m-2")
docker_elements = {}
container_status = {}
while True:
@ -105,6 +102,8 @@ class Robot:
docker_elements.pop(container)
await asyncio.sleep(1)
async def async_stop(self):
return await run.io_bound(self.stop)
def stop(self):
#Signal all processes to stop