Skip to content
Snippets Groups Projects
Commit 8f9d1f01 authored by Jdrezen's avatar Jdrezen
Browse files

Ajout d'une barre de menu pour sauvegarder l'état du système

parent 655da331
No related branches found
No related tags found
No related merge requests found
...@@ -237,11 +237,11 @@ class Controleur: ...@@ -237,11 +237,11 @@ class Controleur:
""" """
Save the current state Save the current state
""" """
def updateSave(self) -> None: def updateSave(self, filename : str) -> None:
self.__scheduler.save() if not (filename is None):
self.__scheduler.save()
def updateCycle(self) -> None: def updateCycle(self) -> None:
self.updateWindow()
try: try:
self.updateWindow() self.updateWindow()
except: except:
......
...@@ -5,7 +5,8 @@ Class Fenetre ...@@ -5,7 +5,8 @@ Class Fenetre
import os, sys import os, sys
import pathlib import pathlib
from tkinter.ttk import LabelFrame from tkinter.ttk import LabelFrame
from tkinter import ttk, Tk, PanedWindow, BOTTOM from tkinter import ttk, Tk, PanedWindow, BOTTOM, Menu
from tkinter.filedialog import askopenfilename
sys.path.insert(0, str(pathlib.Path(__file__).parent)) sys.path.insert(0, str(pathlib.Path(__file__).parent))
...@@ -39,6 +40,15 @@ class Fenetre : ...@@ -39,6 +40,15 @@ class Fenetre :
self.__root.geometry("1000x700") self.__root.geometry("1000x700")
menubar = Menu(self.__root)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Save", command=self.notifyAboutSave)
menubar.add_cascade(label="File", menu=filemenu)
self.__root.config(menu=menubar)
self.__panelCommandes = PanelCommandes(self.__root) self.__panelCommandes = PanelCommandes(self.__root)
self.__division = PanedWindow(self.__root, orient='vertical',showhandle = True,handlesize = 10) self.__division = PanedWindow(self.__root, orient='vertical',showhandle = True,handlesize = 10)
...@@ -293,6 +303,9 @@ class Fenetre : ...@@ -293,6 +303,9 @@ class Fenetre :
self.__observer.updateClosing() self.__observer.updateClosing()
for pan in self.__panelGraphiques: for pan in self.__panelGraphiques:
pan.quit() pan.quit()
self.__panelVue.quit()
self.__panelCommandes.quit()
self.__panel_log.quit()
self.__root.quit() self.__root.quit()
""" """
...@@ -309,3 +322,9 @@ class Fenetre : ...@@ -309,3 +322,9 @@ class Fenetre :
""" """
def errorDisplay(self,typeError : str, message : str) -> None: def errorDisplay(self,typeError : str, message : str) -> None:
self.__panel_log.errorDisplay(typeError,message) self.__panel_log.errorDisplay(typeError,message)
"""
"""
def notifyAboutSave(self):
fileName = askopenfilename(filetypes =[('Pickle Files', '*.pickle')])
self.__observer.updateSave(fileName)
...@@ -24,19 +24,12 @@ class PanelCommandes(LabelFrame): ...@@ -24,19 +24,12 @@ class PanelCommandes(LabelFrame):
bouttonStartStop = Button(self, text='start/stop',height=2,command=self.notifyObserverAboutStartStop) bouttonStartStop = Button(self, text='start/stop',height=2,command=self.notifyObserverAboutStartStop)
bouttonStartStop.pack(side='top',fill='x') 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 = Frame(self)
frameBoutons.pack(side='bottom',fill='x') frameBoutons.pack(side='bottom',fill='x')
frameBoutonAux = Frame(self) frameBoutonAux = Frame(self)
frameBoutonAux.pack(side='top') frameBoutonAux.pack(side='top')
for i in range (20):
Button(self, text='Aux', height=2).pack(fill='x')
self.__slider = Scale(frameBoutons,orient='horizontal',from_=1,to=10,command=self.notifyObserverAboutScale) self.__slider = Scale(frameBoutons,orient='horizontal',from_=1,to=10,command=self.notifyObserverAboutScale)
self.__slider.pack(side='bottom',fill='x') self.__slider.pack(side='bottom',fill='x')
...@@ -65,9 +58,6 @@ class PanelCommandes(LabelFrame): ...@@ -65,9 +58,6 @@ class PanelCommandes(LabelFrame):
def notifyObserverAboutStartStop(self) -> None: def notifyObserverAboutStartStop(self) -> None:
self.__observer.updateStartStop() 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 Notify the observer that the scale has change its value and give the current value
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment