From 53a4235dc2aca727523d7c5a25cac48fe7177877 Mon Sep 17 00:00:00 2001
From: Jdrezen <jeremie.drezen@gmail.com>
Date: Wed, 19 May 2021 13:33:51 +0200
Subject: [PATCH] Ajout d'un bouton de sauvegarde

---
 pyAmakIHM/classes/controleur.py     | 8 +++++++-
 pyAmakIHM/classes/panelCommandes.py | 6 ++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/pyAmakIHM/classes/controleur.py b/pyAmakIHM/classes/controleur.py
index 2391014..c47fcc8 100644
--- a/pyAmakIHM/classes/controleur.py
+++ b/pyAmakIHM/classes/controleur.py
@@ -204,7 +204,7 @@ class Controleur:
     """
     def updateAdd(self) -> None:
         print("Ajout d'un agent")
-        
+
     """
     Remove an agent from amas
     """
@@ -234,6 +234,12 @@ class Controleur:
             self.__is_run = True
             self.__scheduler.start()
 
+    """
+    Save the current state
+    """
+    def updateSave(self) -> None:
+        self.__scheduler.save()
+
     def updateCycle(self) -> None:
         try:
             self.updateWindow()
diff --git a/pyAmakIHM/classes/panelCommandes.py b/pyAmakIHM/classes/panelCommandes.py
index b0c775f..81a1a72 100644
--- a/pyAmakIHM/classes/panelCommandes.py
+++ b/pyAmakIHM/classes/panelCommandes.py
@@ -24,6 +24,9 @@ class PanelCommandes(LabelFrame):
         bouttonStartStop = Button(self, text='start/stop',height=2,command=self.notifyObserverAboutStartStop)
         bouttonStartStop.pack(side='top',fill='x')
 
+        bouttonSaveState = Button(self, text='save state',height=2,command=self.notifyObserverAboutSave)
+        bouttonSaveState.pack(side='top',fill='x')
+
         frameBoutons = Frame(self)
         frameBoutons.pack(side='bottom',fill='x')
 
@@ -55,6 +58,9 @@ class PanelCommandes(LabelFrame):
     def notifyObserverAboutStartStop(self) -> None:
         self.__observer.updateStartStop()
 
+    def notifyObserverAboutSave(self) -> None:
+        self.__observer.updateSave()
+
     """
     Notify the observer that the scale has change its value and give the current value
     """
-- 
GitLab