Christian Woköck 3 anni fa
parent
commit
0e5c99c39d
1 ha cambiato i file con 47 aggiunte e 30 eliminazioni
  1. 47 30
      raspberry-pi/gui/mainWindow.py

+ 47 - 30
raspberry-pi/gui/mainWindow.py

@@ -11,15 +11,15 @@ import logHandler
 
 
 class MainWindow(tk.Frame):
-  def __init__(self, root, conf, ac_sensor, opt_sensor, mag_sensor):
+  def __init__(self, root, conf, ac_sensor, opt_sensor):
     self.root        = root
     self.conf        = conf
     self.ac_sensor   = ac_sensor
     self.opt_sensor  = opt_sensor
-    self.mag_sensor = mag_sensor
     self.log_handler = logHandler.get_log_handler()
     self.popup_window       = None
     self.log_window  = None
+    self.mainWindow= None
 
     tk.Frame.__init__(self, root)
     # data plot at left side
@@ -56,24 +56,33 @@ class MainWindow(tk.Frame):
     tk.Label(self.controls, textvariable=self.opt_dro_offset, anchor="nw").pack(side="top", fill="both", expand=False)
     tk.Label(self.controls, textvariable=self.opt_dro_size, anchor="nw").pack(side="top", fill="both", expand=False)
 
-    menu_button = tk.Button(self.controls, text="Menu", command=self.menu, height=4)
-    menu_button.pack(side="bottom", fill="both")
+    
+
+    self.quit_button = tk.Button(self.controls, text="Quit", command=self.root.destroy, height=2, foreground="red")
+    self.quit_button.pack(side="bottom", fill="both")
 
-    quit_button = tk.Button(self.controls, text="Quit", command=self.root.destroy, height=2, foreground="red")
-    quit_button.pack(side="bottom", fill="both")
-    quit_button.forget_pack()
+    self.calibrate_button = tk.Button(self.controls, text="Calibrate AC", command=self.calibrate_ac, height=4)
+    self.calibrate_button.pack(side="bottom", fill="both")
 
-    calibrate_button = tk.Button(self.controls, text="Calibrate AC", command=self.calibrate_ac, height=4)
-    calibrate_button.pack(side="bottom", fill="both")
-    calibrate_button.foreget_pack()
+    self.clear_button = tk.Button(self.controls, text="Clear graph", command=self.graph.clear, height=4)
+    self.clear_button.pack(side="bottom", fill="both")
 
-    clear_button = tk.Button(self.controls, text="Clear graph", command=self.graph.clear, height=4)
-    clear_button.pack(side="bottom", fill="both")
-    clear_button.forget_pack()
+    self.logscreen_button = tk.Button(self.controls, text="Log", command=self.open_log, height=4)
+    self.logscreen_button.pack(side="bottom", fill="both")
 
-    logscreen_button = tk.Button(self.controls, text="Log", command=self.open_log, height=4)
-    logscreen_button.pack(side="bottom", fill="both")
-    logscren_button.forget_pack()
+    self.menu_button = tk.Button(self.controls, text="Menu", command=self.menu, height=4)
+    self.menu_button.pack(side="bottom", fill="both")
+    
+    self.menu_back_button = tk.Button(self.controls, text="Back", command=self.back, height=4)
+    self.menu_back_button.pack_forget()
+
+    #"verstecken" der Buttons für Platz für Statusanzeigen Magnetsensor
+
+    self.calibrate_button.pack_forget()
+
+    self.clear_button.pack_forget()
+
+    self.logscreen_button.pack_forget()
 
   def update(self):
     if not self.root.winfo_exists():
@@ -181,20 +190,28 @@ class MainWindow(tk.Frame):
     self.log_root.grab_set()
     self.log_window = LogScreen(self.log_root)
     self.log_window.pack(side="top", fill="both", expand=True)
-    
+
   def menu(self):
-    self.menu_button.pack_forget()
-    self.quit_button.pack(side="bottom", fill="both")
+    #Menu
     self.calibrate_button.pack(side="bottom", fill="both")
     self.clear_button.pack(side="bottom", fill="both")
-    self.logScreen_button.pack(side="bottom", fill="both")
-    self.goback_button=tk.Button(self.controls, text="Go Back", command="goback", height=4)
-    self.goback_button.pack(side="bottom", fill="both")
-
-  def goback(self):
-    self.menu_button.pack(side="bottom", fill="both") 
-    self.quit_button.forget_pack()
-    self.calibrate_button.forget_pack()
-    self.clear_button.forget_pack()
-    self.logScreen_button.forget_pack()
-    self.goback_button.forget_pack()
+    self.logscreen_button.pack(side="bottom", fill="both")
+    self.menu_button.pack_forget()
+    self.menu_back_button.pack(side="bottom", fill="both")
+
+    
+  
+  def back(self):
+    self.calibrate_button.pack_forget()
+    self.clear_button.pack_forget()
+    self.logscreen_button.pack_forget()
+    self.menu_button.pack(side="bottom", fill="both")
+    self.menu_back_button.pack_forget()
+
+  
+
+    
+    
+  
+  
+