|
@@ -2,11 +2,13 @@ import tkinter as tk
|
|
|
import time
|
|
|
import queue
|
|
|
|
|
|
+import gui.Popup as Popup
|
|
|
import gui.graph as Graph
|
|
|
|
|
|
class MainWindow(tk.Frame):
|
|
|
def __init__(self, root, up_queue, down_queue,calibration_state):
|
|
|
self.root = root
|
|
|
+ self.popup = None
|
|
|
self.calibration_state = calibration_state
|
|
|
self.down_queue = down_queue
|
|
|
self.up_queue = up_queue
|
|
@@ -22,12 +24,6 @@ class MainWindow(tk.Frame):
|
|
|
l.pack(side="top", fill="both", expand=True)
|
|
|
calibrate_button = tk.Button(self.controls,text="calibrate",command=self.calibrate)
|
|
|
calibrate_button.pack(side="top")
|
|
|
- calibrate_button_next = tk.Button(self.controls,text="calibrate_next",command=self.calibration_state.next_state_gui)
|
|
|
- calibrate_button_next.pack(side="top")
|
|
|
-
|
|
|
- self.csString = tk.StringVar()
|
|
|
- cs = tk.Label(self.controls, textvariable=self.csString, anchor="c")
|
|
|
- cs.pack(side="top", fill="both", expand=True)
|
|
|
|
|
|
def update(self):
|
|
|
ac_data = []
|
|
@@ -35,14 +31,20 @@ class MainWindow(tk.Frame):
|
|
|
name, data = self.up_queue.get()
|
|
|
if name == "ac_data":
|
|
|
ac_data.append(data)
|
|
|
-
|
|
|
self.graph.update([ac_data])
|
|
|
- self.csString.set(self.calibration_state.state_clearname())
|
|
|
+
|
|
|
+ if self.popup:
|
|
|
+ self.popup.update()
|
|
|
self.root.after(30, self.update)
|
|
|
|
|
|
def calibrate(self):
|
|
|
self.down_queue.put("calibrate")
|
|
|
-
|
|
|
+ pu_root = tk.Tk()
|
|
|
+ pu_root.title("Calibration")
|
|
|
+ self.popup = Popup.CalibrationPopUp(pu_root,self.up_queue,self.down_queue,self.calibration_state)
|
|
|
+ self.popup.pack(side="top", fill="both", expand=True)
|
|
|
+
|
|
|
+
|
|
|
if __name__ == "__main__":
|
|
|
root = tk.Tk()
|
|
|
up_queue = queue.Queue()
|