Ejemplo n.º 1
0
    def __init__(self, sensor_type, ip, current_config):
        self.sensor_type = sensor_type
        self.sensor_type_name = ""
        self.measurement_type = ""
        self.ip = ip
        self.current_config = current_config
        self.temperature_offset = self.current_config.temperature_offset
        self.get_commands = app_variables.CreateNetworkGetCommands()

        self.sql_column_names = app_variables.CreateSQLColumnNames()
        self.readable_column_names = app_variables.CreateSQLColumnsReadable()
        self.sensor_measurements = app_variables.CreateMeasurementsTypes()

        self.first_datetime = str(datetime.time(datetime.now()))[:8]

        self.fig = pyplot.figure()
        self.fig.canvas.set_window_title('Live Sensor Graph')
        self.ax1 = self.fig.add_subplot(1, 1, 1)
        self.x = []
        self.y = []

        self.ani = animation.FuncAnimation(
            self.fig,
            self._update_graph,
            interval=float(self.current_config.live_refresh) * 1000)
        pyplot.show()
    def _get_column_checkboxes(self):
        """ Returns selected SQL Columns from the Graph Window, depending on the Data Source Selected. """
        sql_columns = app_variables.CreateSQLColumnNames()
        column_checkboxes = [
            sql_columns.date_time, sql_columns.sensor_name, sql_columns.ip
        ]

        if self.checkbox_up_time.value:
            column_checkboxes.append(sql_columns.system_uptime)
        if self.checkbox_cpu_temp.value:
            column_checkboxes.append(sql_columns.cpu_temp)
        if self.checkbox_temperature.value:
            column_checkboxes.append(sql_columns.environmental_temp)
        if self.checkbox_pressure.value:
            column_checkboxes.append(sql_columns.pressure)
        if self.checkbox_altitude.value:
            column_checkboxes.append(sql_columns.altitude)
        if self.checkbox_humidity.value:
            column_checkboxes.append(sql_columns.humidity)
        if self.checkbox_distance.value:
            column_checkboxes.append(sql_columns.distance)
        if self.checkbox_gas.value:
            for column in sql_columns.gas:
                column_checkboxes.append(column)
        if self.checkbox_particulate_matter.value:
            for column in sql_columns.particulate_matter:
                column_checkboxes.append(column)
        if self.checkbox_lumen.value:
            column_checkboxes.append(sql_columns.lumen)
        if self.checkbox_colour.value:
            for column in sql_columns.six_chan_color:
                column_checkboxes.append(column)
        if self.checkbox_ultra_violet.value:
            for column in sql_columns.ultra_violet:
                column_checkboxes.append(column)
        if self.checkbox_acc.value:
            for column in sql_columns.accelerometer_xyz:
                column_checkboxes.append(column)
        if self.checkbox_mag.value:
            for column in sql_columns.magnetometer_xyz:
                column_checkboxes.append(column)
        if self.checkbox_gyro.value:
            for column in sql_columns.gyroscope_xyz:
                column_checkboxes.append(column)

        if self.checkbox_gyro.value or self.checkbox_mag.value or self.checkbox_acc.value:
            column_checkboxes.append(sql_columns.date_time)
            column_checkboxes.append(sql_columns.ip)
            column_checkboxes.append(sql_columns.sensor_name)

        app_logger.app_logger.debug(str(column_checkboxes))
        return column_checkboxes
    def __init__(self, app, ip_selection, current_config):
        self.ip_selection = ip_selection
        self.current_config = current_config
        self.readable_column_names = app_variables.CreateSQLColumnsReadable()
        self.sql_columns = app_variables.CreateSQLColumnNames()

        self.window = guizero.Window(app,
                                     title="Remote Sensor Display",
                                     width=275,
                                     height=400,
                                     layout="grid",
                                     visible=False)

        self.text_temperature_offset = guizero.Text(self.window,
                                                    text="Env Temp Offset:",
                                                    color='green',
                                                    grid=[1, 11],
                                                    align="left")

        self.textbox_temperature_offset = guizero.TextBox(self.window,
                                                          text="",
                                                          width=5,
                                                          grid=[2, 11],
                                                          align="left")

        self.checkbox_default_offset = guizero.CheckBox(
            self.window,
            text="Use Sensor\nDefault",
            command=self._click_checkbox_offset,
            grid=[2, 11],
            align="right")

        self.checkbox_custom_text = guizero.CheckBox(
            self.window,
            text="Text Message",
            command=self._text_checkbox,
            grid=[1, 16],
            align="left")

        self.checkbox_master = guizero.CheckBox(self.window,
                                                text="All Sensors",
                                                command=self._master_checkbox,
                                                grid=[2, 16],
                                                align="left")

        self.text_space1 = guizero.Text(self.window,
                                        text=" ",
                                        grid=[1, 17],
                                        align="left")

        self.checkbox_up_time = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.system_uptime,
            args=[self.sql_columns.system_uptime],
            grid=[1, 27],
            align="left")

        self.checkbox_cpu_temp = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.cpu_temp,
            args=[self.sql_columns.cpu_temp],
            grid=[1, 28],
            align="left")

        self.checkbox_temperature = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.environmental_temp,
            args=[self.sql_columns.environmental_temp],
            grid=[1, 29],
            align="left")

        self.checkbox_pressure = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.pressure,
            args=[self.sql_columns.pressure],
            grid=[1, 30],
            align="left")

        self.checkbox_altitude = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.altitude,
            args=[self.sql_columns.altitude],
            grid=[1, 31],
            align="left")

        self.checkbox_humidity = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.humidity,
            args=[self.sql_columns.humidity],
            grid=[1, 32],
            align="left")

        self.checkbox_distance = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.distance,
            args=[self.sql_columns.distance],
            grid=[1, 33],
            align="left")

        self.checkbox_gas = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.gas,
            args=[self.sql_columns.gas],
            grid=[1, 34],
            align="left")

        self.checkbox_particulate_matter = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.particulate_matter,
            args=[self.sql_columns.particulate_matter],
            grid=[2, 27],
            align="left")

        self.checkbox_lumen = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.lumen,
            args=[self.sql_columns.lumen],
            grid=[2, 28],
            align="left")

        self.checkbox_colour = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.colours,
            args=[self.sql_columns.rgb],
            grid=[2, 29],
            align="left")

        self.checkbox_ultra_violet = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.ultra_violet,
            args=[self.sql_columns.ultra_violet],
            grid=[2, 30],
            align="left")

        self.checkbox_acc = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.accelerometer_xyz,
            args=[self.sql_columns.accelerometer_xyz],
            grid=[2, 31],
            align="left")

        self.checkbox_mag = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.magnetometer_xyz,
            args=[self.sql_columns.magnetometer_xyz],
            grid=[2, 32],
            align="left")

        self.checkbox_gyro = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.gyroscope_xyz,
            args=[self.sql_columns.gyroscope_xyz],
            grid=[2, 33],
            align="left")

        self.text_space4 = guizero.Text(self.window,
                                        text=" ",
                                        grid=[1, 45],
                                        align="right")

        self.button_send_to_display = guizero.PushButton(
            self.window,
            text="Show Reading\non Remote\nSensor Display",
            command=self._remote_sensor_display_selection,
            grid=[1, 46, 2, 1],
            align="top")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self.checkbox_default_offset.value = 1
        self._set_config()
        self._click_checkbox_offset()
        self.checkbox_up_time.value = 0
        self.checkbox_temperature.value = 0
        self.checkbox_pressure.value = 0
        self.checkbox_humidity.value = 0
        self.checkbox_lumen.value = 0
        self.checkbox_colour.value = 0
    def __init__(self, app, ip_selection, current_config, database_or_sensor):
        self.database_or_sensor = database_or_sensor
        self.current_config = current_config
        self.ip_selection = ip_selection
        self.selected_ip = ""
        self.db_location = ""
        self.database_notes = []
        self.database_notes_dates = []
        self.database_user_note_dates = []

        self.text_variables_generic = CreateGenericNoteVariables()
        self.text_variables_sensor = CreateSensorNoteVariables()
        self.text_variables_database = CreateDatabaseNoteVariables()

        self.sql_column_names = app_variables.CreateSQLColumnNames()
        self.network_send_commands = app_variables.CreateNetworkSendCommands()
        self.sensor_get_commands = app_variables.CreateNetworkGetCommands()

        self.window = guizero.Window(app,
                                     title=self.text_variables_database.window_title,
                                     width=580,
                                     height=525,
                                     layout="grid",
                                     visible=False)

        self.text_connected_to = guizero.Text(self.window,
                                              text=self.text_variables_database.text_connected_to,
                                              color="red",
                                              size=8,
                                              grid=[1, 1, 3, 1],
                                              align="left")

        self.checkbox_use_current_datetime = guizero.CheckBox(self.window,
                                                              text=self.text_variables_generic.checkbox_enable_datetime,
                                                              command=self._reset_datetime,
                                                              grid=[4, 1, 5, 1],
                                                              align="left")

        self.button_connect = guizero.PushButton(self.window,
                                                 text=self.text_variables_database.button_connect,
                                                 command=self._open_database,
                                                 grid=[1, 5],
                                                 align="left")

        self.button_back_note = guizero.PushButton(self.window,
                                                   text="Back",
                                                   command=self._back_button,
                                                   grid=[2, 5],
                                                   align="left")

        self.text_note_current = guizero.Text(self.window,
                                              text=self.text_variables_generic.text_note_current,
                                              color="blue",
                                              grid=[3, 5],
                                              align="top")

        self.textbox_on_number_notes = guizero.TextBox(self.window,
                                                       text="0",
                                                       width=5,
                                                       grid=[3, 5],
                                                       align="bottom")

        self.text_date_label1 = guizero.Text(self.window,
                                             text=self.text_variables_generic.text_date_label1,
                                             color="blue",
                                             grid=[4, 5],
                                             align="top")

        self.textbox_note_date = guizero.TextBox(self.window,
                                                 text=self.text_variables_generic.textbox_note_date,
                                                 grid=[4, 5],
                                                 width=23,
                                                 align="bottom")

        self.text_total_notes_label = guizero.Text(self.window,
                                                   text=self.text_variables_generic.text_total_notes_label,
                                                   color="blue",
                                                   grid=[5, 5],
                                                   align="top")

        self.textbox_total_notes = guizero.TextBox(self.window,
                                                   text="0",
                                                   width=5,
                                                   grid=[5, 5],
                                                   align="bottom")

        self.button_next_note = guizero.PushButton(self.window,
                                                   text=self.text_variables_generic.button_next_note,
                                                   command=self._next_button,
                                                   grid=[6, 5],
                                                   align="left")

        self.textbox_current_note = guizero.TextBox(self.window,
                                                    text=self.text_variables_database.textbox_current_note,
                                                    width=70,
                                                    height=25,
                                                    grid=[1, 10, 6, 1],
                                                    multiline=True,
                                                    scrollbar=True,
                                                    align="left")

        self.button_new_note = guizero.PushButton(self.window,
                                                  text=self.text_variables_generic.button_new_note,
                                                  command=self._database_add_note_button,
                                                  grid=[1, 12],
                                                  align="left")

        self.button_delete_note = guizero.PushButton(self.window,
                                                     text=self.text_variables_generic.button_delete_note,
                                                     command=self._database_delete_button,
                                                     grid=[4, 12],
                                                     align="left")

        self.button_update_note = guizero.PushButton(self.window,
                                                     text=self.text_variables_generic.button_update_note,
                                                     command=self._database_update_note_button,
                                                     grid=[5, 12, 2, 1],
                                                     align="left")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self._disable_notes_window_functions()
        self.checkbox_use_current_datetime.value = True
        self.textbox_current_note.bg = "black"
        self.textbox_current_note.text_color = "white"
        self.textbox_current_note.tk.config(insertbackground="red")

        if database_or_sensor == self.text_variables_generic.sensor_notes_verification:
            self._change_for_sensor()
Ejemplo n.º 5
0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
"""
import guizero
import sqlite3
import os.path
from tkinter import filedialog
from app_modules import app_logger
from app_modules import app_variables
from app_modules import app_useful_functions

sql_column_names = app_variables.CreateSQLColumnNames()


class CreateDataBaseInfoWindow:
    """ Creates a GUI window for generating database information. """
    def __init__(self, app, current_config):
        self.current_config = current_config
        self.database_line_width = 40
        self.textbox_table_width = 22

        self.window = guizero.Window(app,
                                     title="DataBase Information",
                                     width=595,
                                     height=635,
                                     layout="grid",
                                     visible=False)
Ejemplo n.º 6
0
def start_plotly_graph(graph_data):
    """ Creates a Offline Plotly graph from a SQL database. """
    app_logger.app_logger.debug("SQL Columns: " +
                                str(graph_data.graph_columns))
    app_logger.app_logger.debug("SQL Table(s): " + str(graph_data.graph_table))
    app_logger.app_logger.debug("SQL Start DateTime: " +
                                str(graph_data.graph_start))
    app_logger.app_logger.debug("SQL End DateTime: " +
                                str(graph_data.graph_end))
    app_logger.app_logger.debug("SQL DataBase Location: " +
                                str(graph_data.db_location))

    # Adjust dates to Database timezone in UTC 0
    sql_column_names = app_variables.CreateSQLColumnNames()
    new_time_offset = int(graph_data.datetime_offset) * -1
    get_sql_graph_start = app_useful_functions.adjust_datetime(
        graph_data.graph_start, new_time_offset)
    get_sql_graph_end = app_useful_functions.adjust_datetime(
        graph_data.graph_end, new_time_offset)
    for var_column in graph_data.graph_columns:
        var_sql_query = "SELECT " + \
                        str(var_column) + \
                        " FROM " + \
                        str(graph_data.graph_table) + \
                        " WHERE DateTime BETWEEN datetime('" + \
                        str(get_sql_graph_start) + \
                        "') AND datetime('" + \
                        str(get_sql_graph_end) + \
                        "') LIMIT " + \
                        str(graph_data.max_sql_queries)

        sql_column_data = _get_sql_data(graph_data, var_sql_query)

        # Adjust SQL data from its UTC time, to user set timezone (Hour Offset)
        if str(var_column) == sql_column_names.date_time:
            count = 0
            for data in sql_column_data:
                sql_column_data[count] = app_useful_functions.adjust_datetime(
                    data, int(graph_data.datetime_offset))
                count = count + 1
            graph_data.sql_time = sql_column_data
        elif str(var_column) == sql_column_names.ip:
            graph_data.sql_ip = sql_column_data
        elif str(var_column) == sql_column_names.sensor_name:
            graph_data.sql_host_name = sql_column_data
        elif str(var_column) == sql_column_names.system_uptime:
            graph_data.sql_up_time = sql_column_data
        elif str(var_column) == sql_column_names.cpu_temp:
            graph_data.sql_cpu_temp = sql_column_data
        elif str(var_column) == sql_column_names.environmental_temp:
            count = 0
            if graph_data.enable_custom_temp_offset:
                for data in sql_column_data:
                    try:
                        sql_column_data[count] = str(
                            float(data) + float(graph_data.temperature_offset))
                        count = count + 1
                    except Exception as error:
                        count = count + 1
                        app_logger.app_logger.error(
                            "Bad SQL entry from Column 'EnvironmentTemp' - " +
                            str(error))
            else:

                var_sql_query = "SELECT EnvTempOffset FROM " + \
                                str(graph_data.graph_table) + \
                                " WHERE DateTime BETWEEN datetime('" + \
                                str(get_sql_graph_start) + \
                                "') AND datetime('" + \
                                str(get_sql_graph_end) + \
                                "') LIMIT " + \
                                str(graph_data.max_sql_queries)

                sql_temp_offset_data = _get_sql_data(graph_data, var_sql_query)

                warn_message = False
                count = 0
                for data in sql_column_data:
                    try:
                        sql_column_data[count] = str(
                            float(data) + float(sql_temp_offset_data[count]))
                        count = count + 1
                    except IndexError:
                        count = count + 1
                        warn_message = True
                    except ValueError:
                        count = count + 1
                        warn_message = True

                if warn_message:
                    app_logger.app_logger.warning(
                        "Plotly Graph: " +
                        "One or more missing entries in 'EnvironmentTemp' or 'EnvTempOffset'"
                    )

            graph_data.sql_hat_temp = sql_column_data
        elif str(var_column) == sql_column_names.pressure:
            graph_data.sql_pressure = sql_column_data
        elif str(var_column) == sql_column_names.altitude:
            graph_data.sql_altitude = sql_column_data
        elif str(var_column) == sql_column_names.humidity:
            graph_data.sql_humidity = sql_column_data
        elif str(var_column) == sql_column_names.distance:
            graph_data.sql_distance = sql_column_data
        elif str(var_column) == sql_column_names.gas[0]:
            graph_data.sql_gas_resistance = sql_column_data
        elif str(var_column) == sql_column_names.gas[1]:
            graph_data.sql_gas_oxidising = sql_column_data
        elif str(var_column) == sql_column_names.gas[2]:
            graph_data.sql_gas_reducing = sql_column_data
        elif str(var_column) == sql_column_names.gas[3]:
            graph_data.sql_gas_nh3 = sql_column_data
        elif str(var_column) == sql_column_names.particulate_matter[0]:
            graph_data.sql_pm_1 = sql_column_data
        elif str(var_column) == sql_column_names.particulate_matter[1]:
            graph_data.sql_pm_2_5 = sql_column_data
        elif str(var_column) == sql_column_names.particulate_matter[2]:
            graph_data.sql_pm_10 = sql_column_data
        elif str(var_column) == sql_column_names.lumen:
            graph_data.sql_lumen = sql_column_data
        elif str(var_column) == sql_column_names.six_chan_color[0]:
            graph_data.sql_red = sql_column_data
        elif str(var_column) == sql_column_names.six_chan_color[1]:
            graph_data.sql_orange = sql_column_data
        elif str(var_column) == sql_column_names.six_chan_color[2]:
            graph_data.sql_yellow = sql_column_data
        elif str(var_column) == sql_column_names.six_chan_color[3]:
            graph_data.sql_green = sql_column_data
        elif str(var_column) == sql_column_names.six_chan_color[4]:
            graph_data.sql_blue = sql_column_data
        elif str(var_column) == sql_column_names.six_chan_color[5]:
            graph_data.sql_violet = sql_column_data
        elif str(var_column) == sql_column_names.ultra_violet[0]:
            graph_data.sql_uv_index = sql_column_data
        elif str(var_column) == sql_column_names.ultra_violet[1]:
            graph_data.sql_uv_a = sql_column_data
        elif str(var_column) == sql_column_names.ultra_violet[2]:
            graph_data.sql_uv_b = sql_column_data
        elif str(var_column) == sql_column_names.accelerometer_xyz[0]:
            graph_data.sql_acc_x = sql_column_data
        elif str(var_column) == sql_column_names.accelerometer_xyz[1]:
            graph_data.sql_acc_y = sql_column_data
        elif str(var_column) == sql_column_names.accelerometer_xyz[2]:
            graph_data.sql_acc_z = sql_column_data
        elif str(var_column) == sql_column_names.magnetometer_xyz[0]:
            graph_data.sql_mg_x = sql_column_data
        elif str(var_column) == sql_column_names.magnetometer_xyz[1]:
            graph_data.sql_mg_y = sql_column_data
        elif str(var_column) == sql_column_names.magnetometer_xyz[2]:
            graph_data.sql_mg_z = sql_column_data
        elif str(var_column) == sql_column_names.gyroscope_xyz[0]:
            graph_data.sql_gyro_x = sql_column_data
        elif str(var_column) == sql_column_names.gyroscope_xyz[1]:
            graph_data.sql_gyro_y = sql_column_data
        elif str(var_column) == sql_column_names.gyroscope_xyz[2]:
            graph_data.sql_gyro_z = sql_column_data
        else:
            app_logger.app_logger.error(var_column + " - Does Not Exist")
    _plotly_graph(graph_data)
    app_logger.app_logger.debug("Interval DB Graph Complete")
    def __init__(self, app, ip_selection, current_config):
        self.ip_selection = ip_selection
        self.current_config = current_config
        self.readable_column_names = app_variables.CreateSQLColumnsReadable()
        self.sql_columns = app_variables.CreateSQLColumnNames()

        self.window = guizero.Window(app,
                                     title="Graphing",
                                     width=280,
                                     height=580,
                                     layout="grid",
                                     visible=False)

        self.text_sensor_type_name = guizero.Text(self.window,
                                                  text="Data Source",
                                                  color='blue',
                                                  grid=[1, 1, 2, 1],
                                                  align="top")

        self.radio_sensor_type = guizero.ButtonGroup(
            self.window,
            options=["Live Sensor", "SQL Database"],
            horizontal="True",
            command=self._radio_source_selection,
            grid=[1, 2, 2, 1],
            align="top")

        self.text_space3 = guizero.Text(self.window,
                                        text="SQL Recording Type",
                                        color="blue",
                                        grid=[1, 3, 2, 1],
                                        align="top")

        self.radio_recording_type_selection = guizero.ButtonGroup(
            self.window,
            options=["Interval", "Triggers"],
            horizontal="True",
            command=self._radio_sql_type_selection,
            grid=[1, 4, 2, 1],
            align="top")

        self.text_sensor_type_name = guizero.Text(self.window,
                                                  text="Graph Options",
                                                  color='blue',
                                                  grid=[1, 6, 2, 1],
                                                  align="top")

        self.text_space2 = guizero.Text(self.window,
                                        text="YYYY-MM-DD HH:MM:SS",
                                        size=7,
                                        color='#CB0000',
                                        grid=[2, 7, 2, 1],
                                        align="left")

        self.text_start = guizero.Text(self.window,
                                       text="Start Date & Time: ",
                                       color='green',
                                       grid=[1, 8],
                                       align="left")

        self.textbox_start = guizero.TextBox(self.window,
                                             text="",
                                             width=20,
                                             grid=[2, 8],
                                             align="left")

        self.text_end = guizero.Text(self.window,
                                     text="End Date & Time:",
                                     color='green',
                                     grid=[1, 9],
                                     align="left")

        self.textbox_end = guizero.TextBox(self.window,
                                           text="",
                                           width=20,
                                           grid=[2, 9],
                                           align="left")

        self.text_sql_skip = guizero.Text(self.window,
                                          text="Plot Data - Skip:  ",
                                          color='green',
                                          grid=[1, 10],
                                          align="right")

        self.textbox_sql_skip = guizero.TextBox(self.window,
                                                text="",
                                                width=10,
                                                grid=[2, 10],
                                                align="left")

        self.text_sql_skip2 = guizero.Text(self.window,
                                           text=" Plot 1    ",
                                           color='green',
                                           grid=[2, 10],
                                           align="right")

        self.text_temperature_offset = guizero.Text(self.window,
                                                    text="Env Temp Offset:",
                                                    color='green',
                                                    grid=[1, 11],
                                                    align="left")

        self.textbox_temperature_offset = guizero.TextBox(self.window,
                                                          text="",
                                                          width=5,
                                                          grid=[2, 11],
                                                          align="left")

        self.checkbox_default_offset = guizero.CheckBox(
            self.window,
            text="Use Sensor\nDefault",
            command=self._click_checkbox_offset,
            grid=[2, 11],
            align="right")

        self.text_refresh_time = guizero.Text(self.window,
                                              text="Live refresh (Sec):",
                                              color='green',
                                              grid=[1, 12],
                                              align="left")

        self.textbox_refresh_time = guizero.TextBox(self.window,
                                                    text="2",
                                                    width=5,
                                                    grid=[2, 12],
                                                    align="left")

        self.checkbox_master = guizero.CheckBox(self.window,
                                                text="All Sensors",
                                                command=self._master_checkbox,
                                                grid=[1, 16, 2, 1],
                                                align="top")

        self.checkbox_up_time = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.system_uptime,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.system_uptime],
            grid=[1, 17],
            align="left")

        self.checkbox_cpu_temp = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.cpu_temp,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.cpu_temp],
            grid=[1, 18],
            align="left")

        self.checkbox_env_temperature = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.environmental_temp,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.environmental_temp],
            grid=[1, 19],
            align="left")

        self.checkbox_pressure = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.pressure,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.pressure],
            grid=[1, 20],
            align="left")

        self.checkbox_altitude = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.altitude,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.altitude],
            grid=[1, 21],
            align="left")

        self.checkbox_humidity = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.humidity,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.humidity],
            grid=[1, 22],
            align="left")

        self.checkbox_distance = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.distance,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.distance],
            grid=[1, 23],
            align="left")

        self.checkbox_gas = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.gas,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.gas],
            grid=[1, 24],
            align="left")

        self.checkbox_particulate_matter = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.particulate_matter,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.particulate_matter],
            grid=[2, 17],
            align="left")

        self.checkbox_lumen = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.lumen,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.lumen],
            grid=[2, 18],
            align="left")

        self.checkbox_colour = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.colours,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.rgb],
            grid=[2, 19],
            align="left")

        self.checkbox_ultra_violet = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.ultra_violet,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.ultra_violet],
            grid=[2, 20],
            align="left")

        self.checkbox_acc = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.accelerometer_xyz,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.accelerometer_xyz],
            grid=[2, 21],
            align="left")

        self.checkbox_mag = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.magnetometer_xyz,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.magnetometer_xyz],
            grid=[2, 22],
            align="left")

        self.checkbox_gyro = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.gyroscope_xyz,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.gyroscope_xyz],
            grid=[2, 23],
            align="left")

        self.text_space4 = guizero.Text(self.window,
                                        text=" ",
                                        grid=[1, 35],
                                        align="right")

        self.button_live = guizero.PushButton(
            self.window,
            text="Create Graph",
            command=self._create_graph_button,
            grid=[1, 36, 2, 1],
            align="top")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self.checkbox_default_offset.value = 1
        self._set_config()
        self._radio_source_selection()
        self._click_checkbox_offset()
        self.checkbox_up_time.value = 0
        self.checkbox_env_temperature.value = 0
        self.checkbox_pressure.value = 0
        self.checkbox_humidity.value = 0
        self.checkbox_lumen.value = 0
        self.checkbox_colour.value = 0

        # Temp disable radio box until triggers working
        self.radio_recording_type_selection.disable()