diff --git a/pyAmakIHM/classes/controleur.py b/pyAmakIHM/classes/controleur.py index c940eddc8c2b5bca476da71672342a5e169ee0f8..39b60d89cc1e170e13f3c28d480c7cbd2db4beca 100644 --- a/pyAmakIHM/classes/controleur.py +++ b/pyAmakIHM/classes/controleur.py @@ -241,10 +241,13 @@ class Controleur: self.__scheduler.save() def updateCycle(self) -> None: + self.updateWindow() + """ try: self.updateWindow() except: return + """ def updateWindow(self): pass @@ -273,4 +276,4 @@ class Controleur: self.__fenetre.errorDisplay(typeError, message) def logsDisplay(self, message : str) -> None: - self.__fenetre.logsDisplay() + self.__fenetre.logsDisplay(message) diff --git a/pyAmakIHM/classes/fenetre.py b/pyAmakIHM/classes/fenetre.py index 504a4eefc15899e8b638784a5dedb83d57de774e..e0a721f3bc6020644e36495777ccbd3160c3a89e 100644 --- a/pyAmakIHM/classes/fenetre.py +++ b/pyAmakIHM/classes/fenetre.py @@ -4,15 +4,17 @@ Class Fenetre import os, sys import pathlib +from tkinter.ttk import LabelFrame +from tkinter import ttk, Tk, PanedWindow, BOTTOM sys.path.insert(0, str(pathlib.Path(__file__).parent)) +from pyAmakIHM.classes.panelLogs import PanelLogs from pyAmakIHM.classes.panelCommandes import PanelCommandes from pyAmakIHM.classes.panelVue import PanelVue from pyAmakIHM.classes.panelBarChart import PanelBarChart from pyAmakIHM.classes.panelPlotChart import PanelPlotChart from pyAmakIHM.classes.panelLimitedPlotChart import PanelLimitedPlotChart -from tkinter import ttk, Tk class Fenetre : @@ -20,6 +22,7 @@ class Fenetre : Class Fenetre """ + """ def __init__( self, name : str @@ -47,6 +50,61 @@ class Fenetre : self.__panelVue = PanelVue(self.__onglet) self.__onglet.add(self.__panelVue, text = "Vue") +""" + def __init__( + self, + name: str + ) -> None: + + self.__images = [] + """1200/850=1,41 700/450==1,56""" + self.__root = Tk() + + self.__root.title(name) + + self.__root.geometry("850x650") + + self.__panelCommandes = PanelCommandes(self.__root) + + """ + support of the division of the right part + """ + self.__support = LabelFrame(self.__root) + self.__support.pack(side=BOTTOM, expand='y', fill='both', pady=2, padx=2) + + """ + self.__support.place(height=435,width=600,relx=0.2575,rely=0.01) + + division of the right part + """ + self.__division = PanedWindow(self.__support, orient='vertical') + self.__division.pack(side='top', expand='y', fill='both', pady=2, padx=2) + + self.__onglet = ttk.Notebook(self.__division, width=600, height=370) + + self.__onglet.place(relx=0.28, height=320, width=600) + + """ + place %panedWindow + self.__onglet.pack(fill='both',side='right',expand='yes') + place root + """ + self.__onglet.bind('<ButtonPress>', self.drag_tab) + + self.__panelGraphiques = [] + + self.__panelVue = PanelVue(self.__onglet) + + self.__onglet.add(self.__panelVue, text="Vue") + + self.__panel_log = PanelLogs(self.__division) + + """ + fulling divisions + """ + self.__division.add(self.__onglet) + + self.__division.add(self.__panel_log, height=300) def get_root(self) -> Tk: return self.__root @@ -293,23 +351,23 @@ class Fenetre : Displaying logs on the screen """ def errorDisplay(self,typeError : str, message : str) -> None: - if ((typeError != "") and (message != "")) : - self.__panelLogs.displayLog(typeError+" : "+message, self.__panelLogs.getText()) + if (typeError != "") and (message != ""): + self.__panel_log.logsDisplay(typeError+" : "+message) - elif (typeError == "") : - self.__panelLogs.displayLogs(message, self.__panelLogs.getText()) + elif typeError == "": + self.__panel_log.logsDisplay(message) - elif (typeError == "" ) : - self.__panelLogs.displayLogs(typeError, self.__panelLogs.getText()) + elif typeError == "": + self.__panel_log.logsDisplay(typeError) else : print("Empty string for typeError and message : at least one of them must not be empty \n") def logsDisplay(self, message : str) -> None: - if (message==""): + if message== "": print("The message you want to print is empty.\n") else : - self.__etat.logsDisplay(message) + self.__panel_log.logsDisplay(message) diff --git a/pyAmakIHM/classes/panelLogs.py b/pyAmakIHM/classes/panelLogs.py index 20934a57dd10e3c67070bb74b3b8ef2695344750..a2f11d72ec3765faf6bb6f052652c6be7e317f28 100644 --- a/pyAmakIHM/classes/panelLogs.py +++ b/pyAmakIHM/classes/panelLogs.py @@ -54,6 +54,6 @@ class PanelLogs(Text): """ def logsDisplay(self, message : str) -> None: place=self.getText() - place.insert("end", message) + place.insert("end", message+"\n")