diff --git a/guiTools/spiri_sdk_guitools/launcher.py b/guiTools/spiri_sdk_guitools/launcher.py index 4ec9b4a..6d53bf0 100644 --- a/guiTools/spiri_sdk_guitools/launcher.py +++ b/guiTools/spiri_sdk_guitools/launcher.py @@ -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: diff --git a/guiTools/spiri_sdk_guitools/sim_drone.py b/guiTools/spiri_sdk_guitools/sim_drone.py index 4a03dbe..904d8ed 100644 --- a/guiTools/spiri_sdk_guitools/sim_drone.py +++ b/guiTools/spiri_sdk_guitools/sim_drone.py @@ -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