Пример #1
0
 def __init__(self, win, outer_frame, communicator, console):
     self.win = win
     self.outer_frame = outer_frame
     self.communicator = communicator
     self.frame = ttk.LabelFrame(outer_frame, text="Step 1: Connect")
     display_tools.create_blank_rows(self.frame)
     super().__init__(self.frame)
Пример #2
0
 def initialize_TE_interface(self):
     display_tools.create_blank_rows(self.frame)
     self.therm_fan_button = ttk.Button(self.frame, text=self.TURN_FAN_ON, state=tk.DISABLED)
     self.therm_fan_button['command'] = lambda already_activated=False: self.change_fan(already_activated=already_activated)
     self.therm_fan_button.pack(side=tk.TOP)
     self.therm_electric_button = ttk.Button(self.frame, text=self.TURN_TE_ON, state=tk.DISABLED)
     self.therm_electric_button['command'] = lambda already_activated=False: self.change_te(already_activated)
     self.therm_electric_button.pack(side=tk.TOP)
     self.make_PWM_regulator()
Пример #3
0
 def initialize_buttons(self):
     display_tools.create_blank_rows(self.frame)
     for label in self.PUMP_BUTTON_LABELS:
         button = tk.Button(self.frame,
                            text=label + "ON",
                            state=tk.DISABLED,
                            bg='red')
         button['command'] = lambda lab=label: self.change_state(lab)
         self.buttons[label] = button
         button.pack(side=tk.TOP)
Пример #4
0
    def initialize(self, win):
        self.win = win
        self.communicator = main.msp430Communicator()

        main_frame = ttk.Frame(win)
        main_frame.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH)

        step_frame, bottom_frame = self.make_subframes(main_frame)

        self.console = Console(bottom_frame, self.communicator)

        #fill_top_frame:
        self.STEPS = self.make_steps(step_frame)
        display_tools.create_blank_rows(step_frame)

        #fill_bottom_frame
        self.console.pack(side=tk.LEFT)
        self.stats_panel = stats_panel.StatsPanel(bottom_frame)
        self.stats_panel.pack(side=tk.LEFT)
        self.graph_panel = graph_panel.GraphPanel(win, bottom_frame)
        self.graph_panel.pack()

        #make update threads:
        connect_step = self.STEPS[0]
        self.connected = threading.Event()
        self.connect_button = connect_step.make_connect_button(self.connected)
        self.stats_panel.disable()

        self.connection_thread = threading.Thread(target=self.check_connection,
                                                  args=())
        self.connection_thread.start()

        self.detector_step = self.STEPS[len(self.STEPS) - 1]
        self.update_spectrum = threading.Event()
        self.spectrum_updated = threading.Event()
        self.detector_step.set_update_flags(self.update_spectrum,
                                            self.spectrum_updated)

        self.graph_thread = threading.Thread(target=self.check_graph, args=())
        self.graph_thread.start()

        win.mainloop()
Пример #5
0
 def make_communicator_entries(self, frame):
     entry_map = {}
     halfway = int(len(TITLES) / 2)
     for index in range(len(TITLES)):
         if index == 0 or index == halfway:
             column = ttk.Frame(frame)
             column.pack(side=tk.LEFT)
         subframe = ttk.Frame(column)
         subframe.pack(side=tk.TOP)
         title = TITLES[index]
         label = ttk.Label(subframe, text=title)
         label.pack(side=tk.LEFT)
         entry = ttk.Entry(subframe)
         entry.pack(side=tk.LEFT)
         default = DEFAULTS[title]
         entry.insert(tk.END, default)
         entry.configure(state=tk.DISABLED)
         entry_map[title] = entry
         tools.create_blank_rows(column)
     tools.create_blank_rows(frame)
     return entry_map
Пример #6
0
    def fill_interface(self):
        tools.create_blank_rows(self.frame)
        frame1 = ttk.Frame(self.frame)
        frame1.pack(side=tk.TOP)
        self.on_button = ttk.Button(frame1,
                                    text=TURN_ON,
                                    state=tk.DISABLED,
                                    command=lambda activated=False: self.
                                    detector_on(already_activated=activated))
        self.on_button.pack(side=tk.LEFT, anchor=tk.CENTER)

        tools.create_blank_rows(self.frame)
        frame2 = ttk.LabelFrame(self.frame, text="Connect")
        frame2.pack(side=tk.TOP)
        entryframe = ttk.Frame(frame2)
        entryframe.pack(side=tk.TOP)
        self.entry_map = self.make_communicator_entries(entryframe)
        buttframe = ttk.Frame(frame2)
        buttframe.pack(side=tk.TOP)
        self.com_button = ttk.Button(
            buttframe,
            text="Connect",
            state="disabled",
            command=lambda frame=frame2: self.detector_connect(frame))
        self.com_button.pack(side=tk.TOP, anchor=tk.CENTER)

        tools.create_blank_rows(self.frame)
        self.make_spectrum_frame()
Пример #7
0
 def __init__(self, outer_frame, communicator):
     self.outer_frame = outer_frame
     self.communicator = communicator
     self.frame = ttk.LabelFrame(self.outer_frame, text="Console")
     self.frame.pack(side=tk.BOTTOM)
     send_box_frame = ttk.Frame(self.frame)
     send_box_frame.pack(side=tk.TOP)
     display_tools.create_blank_rows(self.frame)
     console_frame = ttk.Frame(self.frame)
     console_frame.pack(side=tk.TOP)
     display_tools.create_blank_rows(send_box_frame)
     self.entry = display_tools.create_packed_entry_box(
         frame=send_box_frame, side=tk.LEFT)
     self.send_button = ttk.Button(send_box_frame,
                                   text="SEND",
                                   state=tk.DISABLED)
     self.send_button['command'] = self.display_entry
     self.send_button.pack(side=tk.LEFT)
     self.listbox = display_tools.make_scrollable_listbox(
         frame=console_frame,
         height=defaults.CONSOLE_LISTBOX_HEIGHT,
         width=defaults.CONSOLE_LISTBOX_WIDTH,
         side=tk.TOP)
Пример #8
0
    def make_subframes(self, main_frame):
        display_tools.create_blank_rows(main_frame)

        step_frame = ttk.LabelFrame(main_frame, text="Steps")
        step_frame.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH)

        display_tools.create_blank_rows(step_frame)
        display_tools.create_blank_rows(main_frame)

        bottom_frame = ttk.LabelFrame(main_frame, text="Status")
        bottom_frame.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH)

        return step_frame, bottom_frame
Пример #9
0
    def make_spectrum_frame(self):
        detec_frame = ttk.LabelFrame(self.frame, text="Take Spectrum")
        detec_frame.pack(side=tk.TOP)

        entry_frame = ttk.Frame(detec_frame)
        entry_frame.pack(side=tk.TOP)

        tools.create_blank_rows(entry_frame)
        acq_label = ttk.Label(entry_frame, text="Acquisitions: ")
        acq_label.pack(side=tk.LEFT)
        self.acq_entry = ttk.Entry(entry_frame)
        self.acq_entry.pack(side=tk.LEFT)
        self.acq_entry.insert(tk.END, DEFAULTS[ACQS])
        self.acq_entry.configure(state="disabled")

        gain_label = ttk.Label(entry_frame, text="Gain: ")
        gain_label.pack(side=tk.LEFT)
        self.gain_entry = ttk.Entry(entry_frame)
        self.gain_entry.pack(side=tk.LEFT)
        self.gain_entry.insert(tk.END, DEFAULTS[GAIN])
        self.gain_entry.configure(state="disabled")
        tools.create_blank_rows(entry_frame)

        self.canvas_frame = ttk.Frame(detec_frame)
        self.canvas_frame.pack(side=tk.TOP)

        button_frame = ttk.Frame(detec_frame)
        button_frame.pack(side=tk.TOP)

        tools.create_blank_rows(button_frame)
        self.spectrum_button = ttk.Button(button_frame,
                                          text=TAKE_SPECTRUM,
                                          state="disabled",
                                          command=self.run)
        self.spectrum_button.pack(side=tk.TOP, anchor=tk.CENTER)
        tools.create_blank_rows(button_frame)
Пример #10
0
 def __init__(self, win, side=tk.LEFT):
     self.all_stats = {}
     self.frame = ttk.LabelFrame(win, text="Status Bar")
     tools.create_blank_rows(self.frame, 2)
     self.pump_display = StatsFrame(win, self.frame, stats.PUMP_FRAME_LABEL,
                                    stats.PUMP_STAT_COLUMNS,
                                    stats.PUMP_INFO)
     self.all_stats = {**self.all_stats, **self.pump_display.stat_map}
     tools.create_blank_rows(self.frame, 2)
     self.voltage_display = StatsFrame(win, self.frame,
                                       stats.VOLTAGE_FRAME_LABEL,
                                       stats.VOLTAGE_STAT_COLUMNS,
                                       stats.VOLTAGE_INFO)
     self.all_stats = {**self.all_stats, **self.voltage_display.stat_map}
     tools.create_blank_rows(self.frame, 2)
     self.frame.pack(side=side, expand=tk.YES, fill=tk.BOTH)
     self.stat_frames = (self.voltage_display, self.pump_display)
Пример #11
0
    def make_sector_frames(self):
        self.entry_map = {}
        self.buttons = {}
        self.gpib_id_map = {}
        self.button_frames = {}
        self.checkmarks = {}

        for sector in self.SECTORS:
            sector_frame = ttk.LabelFrame(self.frame, text=sector)
            sector_frame.pack(side=tk.TOP)

            voltage_frame = ttk.Frame(sector_frame)
            voltage_frame.pack(side=tk.TOP)
            display_tools.create_blank_rows(voltage_frame)
            voltage_label = ttk.Label(voltage_frame, text="Desired Voltage:")
            voltage_label.pack(side=tk.LEFT)
            voltage_entry = ttk.Entry(voltage_frame, state="disabled")
            voltage_entry.pack(side=tk.LEFT)
            self.entry_map[sector] = voltage_entry

            id_frame = ttk.Frame(sector_frame)
            id_frame.pack(side=tk.TOP)

            display_tools.create_blank_rows(id_frame)
            id_label = ttk.Label(voltage_frame, text="GPIB Device ID:")
            id_label.pack(side=tk.LEFT)
            id_entry = ttk.Entry(voltage_frame, state="disabled")
            id_entry.pack(side=tk.LEFT)
            self.gpib_id_map[sector] = id_entry

            button_frame = ttk.Frame(sector_frame)
            button_frame.pack(side=tk.TOP)
            button = ttk.Button(button_frame, text="Enter", state="disabled", command=lambda sec=sector: self.run(sec))
            button.pack(side=tk.LEFT, anchor=tk.CENTER)
            self.buttons[sector] = button
            self.button_frames[sector] = button_frame

            display_tools.create_blank_rows(self.frame)
Пример #12
0
 def fill_interface(self):
     display_tools.create_blank_rows(self.frame)
     self.config_button = ttk.Button(self.frame, text=self.TURN_ON, state=tk.DISABLED, command=self.change_state)
     self.config_button.pack()
     display_tools.create_blank_rows(self.frame)
     self.make_sector_frames()