Christian Woköck vor 3 Jahren
Ursprung
Commit
3ee279210a
1 geänderte Dateien mit 26 neuen und 6 gelöschten Zeilen
  1. 26 6
      raspberry-pi/gui/mainWindow.py

+ 26 - 6
raspberry-pi/gui/mainWindow.py

@@ -11,11 +11,12 @@ import logHandler
 
 
 class MainWindow(tk.Frame):
-  def __init__(self, root, conf, ac_sensor, opt_sensor):
+  def __init__(self, root, conf, ac_sensor, opt_sensor, mag_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
@@ -55,17 +56,20 @@ 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")
+
     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.pack_forget(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.pack_forget(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.pack_forget(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")
+    logscreen_button.pack_forget(side="bottom", fill="both")
 
   def update(self):
     if not self.root.winfo_exists():
@@ -173,4 +177,20 @@ 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()
+    self.calibrate_button.pack()
+    self.clear_button.pack()
+    self.logScreen_button.pack()
+    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() 
+    self.quit_button.pack_forget()
+    self.calibrate_button.pack_forget()
+    self.clear_button.pack_forget()
+    self.logScreen_button.pack_forget()
+    self.goback_button.pack_forget()