Ejemplo n.º 1
0
 def __init__(self, master, parent_notebook, graph_properties, bg=OPTIONS_BACKGROUND,
              initialize=True):
     """ Make a ttk frame to hold all the info for cyclic voltammetry, frame is split in 2,
     one for graph area and another for the buttons
     :param master: tk.Tk overall master program
     :param parent_notebook: ttk.Notebook that this frame is embedded in
     :param graph_properties: properties for the graph
     :param bg: color to make the background frame
     """
     ttk.Frame.__init__(self, parent_notebook)
     self.master = master
     self.settings = master.device_params.cv_settings
     self.data = data_class.PyplotData()
     self.graph = self.make_graph_area(master, graph_properties)  # make graph
     self.graph.pack(side='left', expand=True, fill=tk.BOTH)
     options_frame = tk.Frame(self, bg=bg, bd=3)
     options_frame.pack(side='left', fill=tk.BOTH)
     buttons_frame = tk.Frame(options_frame)
     buttons_frame.pack(side='bottom', fill=tk.X)
     # assign device to special handler for CV protocols
     self.device = self.USBHandler(self.graph, master.device, master, self.data)
     # make area to show the CV settings with a custom class
     self.cv_settings_frame = self.CVSettingDisplay(master, options_frame,
                                                    self.graph, master.device_params,
                                                    self.device)
     self.cv_settings_frame.pack(side="top", fill=tk.X)
     # initialize the device so the user can hit the run button
     if initialize:
         time.sleep(0.4)  # give time for the calibration data to be processed
         self.device.send_cv_parameters()
         time.sleep(0.1)
         master.device.usb_write("L|3")
         time.sleep(0.1)
     # make the buttons the user can use in the CV experiments
     self.make_cv_buttons(buttons_frame, self.graph, self.device)
Ejemplo n.º 2
0
    def __init__(self,
                 master,
                 parent_notebook,
                 graph_properties,
                 bg=OPTIONS_BACKGROUND,
                 initialize=True):
        """ Make a ttk frame to hold all the info, frame is split in 2,
        one for graph area and another for the buttons
        :param master: tk.Tk overall master program
        :param parent_notebook: ttk.Notebook that this frame is embedded in
        :param graph_properties: properties for the graph
        :param bg: color to make the background frame
        """
        ttk.Frame.__init__(self, parent_notebook)
        self.sensor_settings = master.sensor_settings
        self._sensor_hold = {}
        self.Checkbutton = {}
        self.time_target = 1
        self.master = master
        self.settings = master.device_params.cv_settings
        self.data = data_class.PyplotData()
        self.sensors_selected = set()
        self.graph = self.make_graph_area(master,
                                          graph_properties)  # make graph

        self._sensor_hold = {}
        for i in range(8):
            self._sensor_hold[i] = []  # add a list to store the column data

        count = 0
        while (count < 128):
            for row in self._sensor_hold:
                count += 1
                self._sensor_hold[row].append(count)

        for i in range(len(self._sensor_hold)):
            self.Checkbutton[i] = Checkbar(
                self, self._sensor_hold[i], "left", "w",
                self.sensor_settings.sensors_selected)
            self.Checkbutton[i].pack(side="top", fill=tk.BOTH, padx=2)
            if i % 2 == 0:
                self.Checkbutton[i].config(relief='groove', bd=2)

        buttons_frame = tk.Frame(self, bg=bg, bd=3)
        buttons_frame.pack(side='bottom', fill=tk.BOTH)

        self.device = self.USBHandler(self.graph, master.device, master,
                                      self.data)

        # initialize the device so the user can hit the run button
        # if initialize:
        #     time.sleep(0.4)  # give time for the calibration data to be processed
        #     self.device.send_cv_parameters()
        #     time.sleep(0.1)
        #     master.device.usb_write("L|3")
        #     time.sleep(0.1)
        # make the buttons the user can use in the CV experiments
        self.make_cv_buttons(buttons_frame, self.graph, self.device)
Ejemplo n.º 3
0
 def delete_all_data(self):
     """
     Delete all the data collected so far and clear the lines from the plot area
     :return:
     """
     """ Clear data """
     # self.plotted_lines
     logging.debug("len self.data.values: %i", self.data.index)
     """ Delete all displayed lines """
     self.graph.delete_all_lines()
     self.data = data_class.PyplotData()
Ejemplo n.º 4
0
    def __init__(self, parent=None):

        logging.basicConfig(
            level=logging.DEBUG,
            format="%(levelname)s %(module)s %(lineno)d: %(message)s")
        self.data_save_type = "Converted"
        self.device = None  # no device connected yet
        self.data = data_class.PyplotData()

        self.operation_params = operation_params
        self.display_type = check_display_type()
        tk.Tk.__init__(self, parent)
        self.parent = parent
        self.device = usb_comm.AmpUsb(self, operation_params)
        """Make Notebooks to separate the CV and amperometry methods"""
        self.notebook = ttk.Notebook(self)
        amp_frame = ttk.Frame(self.notebook)
        cv_frame = ttk.Frame(self.notebook)
        self.notebook.add(cv_frame, text="Cyclic Voltammetry")
        self.notebook.add(amp_frame, text="Amperometry")

        self.init(amp_frame, cv_frame)
Ejemplo n.º 5
0
 def delete_all_data(self):
     """ Clear all the lines in the graph and reset the data
     :return:
     """
     self.graph.delete_all_lines()
     self.data = data_class.PyplotData()