Skip to content

Commit afb8523

Browse files
authored
Merge pull request #11 from c-jimenez/dev/new_start_all_buttoms
Dev/new start all buttoms
2 parents b0d1f0d + a4b9e2e commit afb8523

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

imgs/connect.png

48 Bytes
Loading

imgs/instances.png

10.8 KB
Loading

src/supervisor/ChargePointManager.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,21 @@ def remove_charge_point(self, cp_id: str) -> bool:
192192
""" Send the command to remove the simulated charge point """
193193
ret = self.__remove_charge_points([{"id": cp_id}])
194194

195+
def restart_all_charge_points(self) -> bool:
196+
""" send restart command to all simulated charge points """
197+
ret = True
198+
199+
for cp_id in self.__cps.keys():
200+
ret = ret and self.restart_charge_point(cp_id)
201+
202+
return ret
203+
204+
def kill_all_charge_points(self):
205+
""" send kill command to all simulated charge points """
206+
cp_ids = self.__cps.keys()
207+
for cp_id in cp_ids:
208+
self.kill_charge_point(cp_id)
209+
195210
def restart_charge_point(self, cp_id: str) -> bool:
196211
""" Send the command to restart the simulated charge point """
197212

src/supervisor/ui/SupervisorScreen.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ def load_callback(filepath: str, filename: str):
185185
content.popup = popup
186186
popup.open()
187187

188+
def bt_restart_all_cp(self) -> None:
189+
self.__cp_mgr.restart_all_charge_points()
190+
def bt_kill_all_cp(self) -> None:
191+
self.__cp_mgr.kill_all_charge_points()
192+
188193
def __on_connection_change(self, connected: bool) -> None:
189194
""" Called when MQTT connection state has changed """
190195
if connected:

src/supervisor/ui/supervisor.kv

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ SupervisorScreen:
174174
disabled: not self.active or not bt_connect.connected or not lbl_launcher_status.alive
175175
on_release: root.bt_kill_restart_cp_click()
176176

177+
177178
Button:
178179
id: bt_save_setup
179180
text: 'Save setup'
@@ -198,6 +199,30 @@ SupervisorScreen:
198199
disabled: not bt_connect.connected or not lbl_launcher_status.alive
199200
on_release: root.bt_load_setup_click()
200201

202+
Button:
203+
id: bt_restart_all_cp
204+
text: 'Restart all CP'
205+
text_size: self.size
206+
halign: 'center'
207+
valign: 'middle'
208+
size_hint: None, 1.
209+
size: 100, 0
210+
211+
disabled: not bt_connect.connected or not lbl_launcher_status.alive
212+
on_release: root.bt_restart_all_cp()
213+
214+
Button:
215+
id: bt_kill_all_cp
216+
text: 'kill all CP'
217+
text_size: self.size
218+
halign: 'center'
219+
valign: 'middle'
220+
size_hint: None, 1.
221+
size: 100, 0
222+
223+
disabled: not bt_connect.connected or not lbl_launcher_status.alive
224+
on_release: root.bt_kill_all_cp()
225+
201226
BackgroundLabel:
202227
id: lbl_launcher_status
203228
text: 'LAUNCHER'

0 commit comments

Comments
 (0)