def __init__(self, app): self.about_text = app_variables.about_window_text_file_location self.window = guizero.Window( app, title="About || KootNet Sensors - Control Center", width=610, height=325, layout="grid", visible=False) self.about_text1 = guizero.Text(self.window, text=app_variables.software_version, grid=[1, 1], align="right") self.about_textbox = guizero.TextBox(self.window, text="About", grid=[1, 2], width=75, height=18, multiline=True, align="left") # Window Tweaks self.window.tk.resizable(False, False) self._set_about_text() self.about_textbox.disable() self.about_textbox.bg = "black" self.about_textbox.text_color = "white"
def edit_identity_cards(identity_cards,matrix,desktop): windows=guizero.Window(desktop,layout='grid',title='Edit',visible=False) road={} text_box=guizero.TextBox(windows,grid=[20,0],width=45,enabled=False) end = guizero.PushButton(windows, grid=[20, 1], text='End',command=lambda: save_(identity_cards, road, matrix, windows)) directs=guizero.Combo(windows,options=["up", "down", "left","right"],grid=[20,2]) option=guizero.PushButton(windows,grid=[20,4],text='Nome') y=14 for i in range(15): for x in range(20): dictionary = {'X': 'black', 'o': 'green', ' ': 'white', 'v': 'yellow'} road[x,y]=box(x,i,identity_cards[x,y],windows,text_box,directs,option) road[x,y].step.bg=dictionary[matrix[x,y]] y-=1 windows.show(wait=True)
def visualize(matrix, steps, image, desktop, n_step): windows = guizero.Window(desktop, layout='grid', visible=False, title='End') dictionary = {'X': 'black', 'o': 'green', ' ': 'white', 'v': 'yellow'} global n_steps n_steps = n_step global xd global yd y = 14 xd, yd = location('o', matrix) road = {} for iy in range(15): for ix in range(20): road[ix, iy] = guizero.Picture(windows, image=image, grid=[ix, y]) road[ix, iy].bg = dictionary[matrix[ix, iy]] y -= 1 windows.show(wait=True) guizero.PushButton( windows, text='Go forward', grid=[(ix + 1), 0], command=lambda: forward(steps, road, int(len(steps)), windows))
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()
import guizero import sys import time import os os.system("cat script.py > script_backup.py") filewrite = open("script.py", "w") #windows mainwindow = guizero.App(title = "gpguio by arnitdo", width = 720, height = 540) mainwindow.hide() mainwindow.disable() LEDwindow = guizero.Window(mainwindow, width = 720, height = 540, title = "New LED") LEDwindow.hide() LEDwindow.disable() PWMLEDwindow = guizero.Window(mainwindow, width = 720, height = 540, title = "New PWM LED") PWMLEDwindow.hide() PWMLEDwindow.disable() Sleepwindow = guizero.Window(mainwindow, width = 720, height = 540, title = "Add Sleep Timer") Sleepwindow.hide() Sleepwindow.disable() LEDcontrolwindow = guizero.Window(mainwindow, width = 720, height = 540, title = "LED controls") LEDcontrolwindow.hide() LEDcontrolwindow.disable() PWMLEDcontrolwindow = guizero.Window(mainwindow, width = 720, height = 540, title = "PWMLED controls") PWMLEDcontrolwindow.hide() PWMLEDcontrolwindow.disable() Buttonwindow = guizero.Window(mainwindow, width = 720, height = 540, title = "New Button") Buttonwindow.hide() Buttonwindow.disable() Buttoncontrolwindow = guizero.Window(mainwindow, width = 720, height = 540, title = "Button controls")
def __init__(self, app, ip_selection, current_config): self.ip_selection = ip_selection self.current_config = current_config self.window = guizero.Window(app, title="Sensors Configuration", width=625, height=385, layout="grid", visible=False) self.text_select = guizero.Text( self.window, text="Select Sensor IPs in the main window", grid=[1, 1, 3, 1], color='#CB0000', align="left") self.textbox_config = guizero.TextBox( self.window, text=app_variables.default_sensor_config_text.strip(), grid=[1, 2], width=75, height=18, multiline=True, scrollbar=True, align="right") self.button_get_config = guizero.PushButton( self.window, text="Get Sensor\nConfiguration", command=self.button_get, grid=[1, 10], align="left") self.text_select_combo = guizero.Text( self.window, text="Select Configuration File to Edit", grid=[1, 10], color='blue', align="top") self.combo_dropdown_selection = guizero.Combo( self.window, options=[ "Configuration", "Installed Sensors", "Wifi", "Trigger Variances" ], grid=[1, 10], command=self.combo_selection, align="bottom") self.button_set_config = guizero.PushButton( self.window, text="Set Sensor\nConfiguration", command=self.button_set, grid=[1, 10], align="right") # Window Tweaks self.window.tk.resizable(False, False) self.textbox_config.bg = "black" self.textbox_config.text_color = "white" self.textbox_config.tk.config(insertbackground="red")
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) self.button_open_database = guizero.PushButton( self.window, text="Open\nDatabase", command=self._open_database, grid=[1, 1, 1, 2], align="left") self.text_database_label = guizero.Text(self.window, text="Database: ", color='blue', grid=[1, 1], align="right") self.textbox_database_name = guizero.TextBox( self.window, text="Please Open a Database", width=self.database_line_width, grid=[2, 1, 2, 1], align="left") self.text_database_location_label = guizero.Text(self.window, text="Location: ", color='blue', grid=[1, 2], align="right") self.textbox_database_location = guizero.TextBox( self.window, text="Please Open a Database", width=self.database_line_width, height=2, grid=[2, 2, 2, 1], multiline=True, scrollbar=True, align="left") self.text_db_dates = guizero.Text(self.window, text="Date Range: ", color='blue', grid=[1, 3], align="right") self.textbox_db_dates = guizero.TextBox( self.window, text="First Recorded Date || Last Recorded Date", width=self.database_line_width, grid=[2, 3, 2, 1], align="left") self.text_db_size = guizero.Text(self.window, text="Database Misc. Info: ", color='blue', grid=[1, 4], align="right") self.textbox_misc_db_info = guizero.TextBox( self.window, text="DB Size: MB || Notes: XX || Reboots: XX", width=self.database_line_width, grid=[2, 4, 2, 1], align="left") self.text_name_changes = guizero.Text( self.window, text="\nRecorded Name Changes\nCurrent: ", color='purple', grid=[2, 7, 2, 1], align="left") self.text_name_date = guizero.Text(self.window, text="Date of Change", color='blue', grid=[1, 10], align="left") self.textbox_name_dates = guizero.TextBox( self.window, text="1. Date", width=self.textbox_table_width, height=10, grid=[1, 11], multiline=True, scrollbar=True, align="left") self.text_name_new = guizero.Text(self.window, text="New Name", color='blue', grid=[2, 10], align="left") self.textbox_new_names = guizero.TextBox( self.window, text="1. NewName", width=self.textbox_table_width, height=10, grid=[2, 11], multiline=True, scrollbar=True, align="left") self.text_name_old = guizero.Text(self.window, text="Old Name", color='blue', grid=[3, 10], align="left") self.textbox_old_names = guizero.TextBox( self.window, text="1. OldName", width=self.textbox_table_width, height=10, grid=[3, 11], multiline=True, scrollbar=True, align="left") self.text_ip_changes = guizero.Text( self.window, text="\nRecorded IP Changes\nCurrent: ", color='purple', grid=[2, 12], align="left") self.text_ip_date = guizero.Text(self.window, text="Date of Change", color='blue', grid=[1, 16], align="left") self.textbox_ip_dates = guizero.TextBox(self.window, text="1. Date", width=self.textbox_table_width, height=10, grid=[1, 17], multiline=True, scrollbar=True, align="left") self.text_ip_new = guizero.Text(self.window, text="New IP", color='blue', grid=[2, 16], align="left") self.textbox_new_ips = guizero.TextBox(self.window, text="1. NewIP", width=self.textbox_table_width, height=10, grid=[2, 17], multiline=True, scrollbar=True, align="left") self.text_ip_old = guizero.Text(self.window, text="Old IP", color='blue', grid=[3, 16], align="left") self.textbox_old_ips = guizero.TextBox(self.window, text="1. OldIP", width=self.textbox_table_width, height=10, grid=[3, 17], multiline=True, scrollbar=True, align="left") self.text_spacer = guizero.Text(self.window, text="", grid=[1, 18], align="left") # Window Tweaks self.window.tk.resizable(False, False) self.textbox_database_name.disable() self.textbox_database_location.disable() self.textbox_db_dates.disable() self.textbox_misc_db_info.disable() self.textbox_name_dates.bg = "black" self.textbox_name_dates.text_color = "white" self.textbox_name_dates.tk.config(insertbackground="red") self.textbox_new_names.bg = "black" self.textbox_new_names.text_color = "white" self.textbox_new_names.tk.config(insertbackground="red") self.textbox_old_names.bg = "black" self.textbox_old_names.text_color = "white" self.textbox_old_names.tk.config(insertbackground="red") self.textbox_ip_dates.bg = "black" self.textbox_ip_dates.text_color = "white" self.textbox_ip_dates.tk.config(insertbackground="red") self.textbox_new_ips.bg = "black" self.textbox_new_ips.text_color = "white" self.textbox_new_ips.tk.config(insertbackground="red") self.textbox_old_ips.bg = "black" self.textbox_old_ips.text_color = "white" self.textbox_old_ips.tk.config(insertbackground="red")
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()
def __init__(self, app, ip_selection, current_config): self.ip_selection = ip_selection self.current_config = current_config self.text_upgrades_smb = "Regular SMB" self.text_upgrades_http = "Regular HTTP" self.text_upgrades_smb_dev = "Development SMB" self.text_upgrades_http_dev = "Development HTTP" self.text_upgrades_os = "Operating System" self.text_power_restart_services = "Restart Services" self.text_power_reboot = "Reboot" self.text_power_shutdown = "Shutdown" self.text_system_change_name = "Change Sensors Names" self.text_system_check_dependencies = "Check Dependencies" self.text_system_sync_clock = "Sync Date & Time" self.text_system_clear_log_primary = "Clear Primary Log" self.text_system_clear_log_network = "Clear Network Log" self.text_system_clear_log_sensors = "Clear Sensors Log" self.window = guizero.Window(app, title="Sensor Commands", width=280, height=240, layout="grid", visible=False) self.text_select = guizero.Text( self.window, text="Select Sensor IPs in the main window", grid=[1, 1], color='#CB0000', align="left") self.text_upgrade = guizero.Text(self.window, text="Upgrade Commands", grid=[1, 2], color='blue', align="left") self.upgrade_dropdown_selection = guizero.Combo( self.window, options=[ self.text_upgrades_http, self.text_upgrades_smb, self.text_upgrades_http_dev, self.text_upgrades_smb_dev, self.text_upgrades_os ], grid=[1, 3], align="left") self.button_upgrade_proceed = guizero.PushButton( self.window, text="Proceed", command=self._proceed_upgrade, grid=[1, 3], align="right") self.text_power = guizero.Text(self.window, text="Power Commands", grid=[1, 24], color='blue', align="left") self.power_dropdown_selection = guizero.Combo( self.window, options=[ self.text_power_restart_services, self.text_power_reboot, self.text_power_shutdown ], grid=[1, 25], align="left") self.button_power_proceed = guizero.PushButton( self.window, text="Proceed", command=self._proceed_power, grid=[1, 25], align="right") self.text_other = guizero.Text(self.window, text="System Commands", grid=[1, 36], color='blue', align="left") self.system_dropdown_selection = guizero.Combo( self.window, options=[ self.text_system_change_name, self.text_system_check_dependencies, self.text_system_sync_clock, self.text_system_clear_log_primary, self.text_system_clear_log_network, self.text_system_clear_log_sensors ], grid=[1, 37], align="left") self.button_system_proceed = guizero.PushButton( self.window, text="Proceed", command=self._proceed_system, grid=[1, 37], align="right") # Window Tweaks self.window.tk.resizable(False, False)
def __init__(self, app, ip_selection, current_config): self.ip_selection = ip_selection self.current_config = current_config self.network_get_commands = app_variables.CreateNetworkGetCommands() self.window = guizero.Window(app, title="Sensor Logs", width=975, height=450, layout="grid", visible=False) self.app_menubar = guizero.MenuBar( self.window, toplevel=[["Download"]], options=[[[ "Download All Selected Sensors Logs", self._download_logs ]]]) self.text_select_ip = guizero.Text( self.window, text="Select Sensor IPs in the main window", color="#CB0000", grid=[1, 1], align="left") self.text_choose = guizero.Text(self.window, text="Last lines of selected log", color="blue", grid=[1, 1], align="top") self.radio_log_type = guizero.ButtonGroup( self.window, options=["Primary Log", "Network Log", "Sensors Log"], horizontal="True", grid=[1, 1], align="right") self.textbox_log = guizero.TextBox( self.window, text="\nPlease select the log type in the top right" + " and press 'Update Sensor Log View' in the bottom right\n\n" + "You may also use the 'Download' menu in the top left to " + "download ALL logs from selected sensors to a chosen folder", grid=[1, 2], width=118, height=22, multiline=True, scrollbar=True, align="left") self.button_get = guizero.PushButton(self.window, text="Update Sensor\nLog View", command=self._get_log, grid=[1, 3], align="right") # Window Tweaks self.window.tk.resizable(False, False) self.textbox_log.bg = "black" self.textbox_log.text_color = "white" self.textbox_log.tk.config(insertbackground="red")
def __init__(self, app, current_config, ip_selection): self.current_config = current_config self.ip_selection = ip_selection self.window = guizero.Window(app, title="Control Center Configuration", width=580, height=300, layout="grid", visible=False) self.button_reset = guizero.PushButton(self.window, text="Reset to\nDefaults", command=self._reset_to_defaults, grid=[1, 1], align="right") self.checkbox_power_controls = guizero.CheckBox( self.window, text="Enable 'Reset to Defaults'", command=self._enable_config_reset, grid=[1, 1], align="top") self.button_save_apply = guizero.PushButton( self.window, text="Save", command=self._button_save_apply, grid=[1, 1], align="left") self.text3 = guizero.Text(self.window, text="Save files to", color='blue', grid=[1, 2], align="left") self.textbox_save_to = guizero.TextBox(self.window, text='', width=50, grid=[1, 3], align="bottom") self.button_save_dir = guizero.PushButton(self.window, text="Choose Folder", command=self._button_save_to, grid=[1, 4], align="left") self.button_set_http_auth = guizero.PushButton( self.window, text="Set Sensors Authentication", command=self._update_http_authentication_credentials, grid=[1, 4], align="right") self.checkbox_enable_open_gl_plotly = guizero.CheckBox( self.window, text="Render Plotly with OpenGL", grid=[1, 5], align="top") self.text_info = guizero.Text(self.window, text="Default graph date range", color='blue', grid=[1, 6], align="top") self.text_spacer3 = guizero.Text(self.window, text="YYYY-MM-DD HH:MM:SS", size=7, color='#CB0000', grid=[1, 7], align="right") self.text_start = guizero.Text(self.window, text=" Start DateTime: ", color='green', grid=[1, 8], align="left") self.textbox_start = guizero.TextBox(self.window, text="", width=20, grid=[1, 8], align="right") self.text_end = guizero.Text(self.window, text=" End DateTime: ", color='green', grid=[1, 9], align="left") self.textbox_end = guizero.TextBox(self.window, text="", width=20, grid=[1, 9], align="right") self.text_live_refresh = guizero.Text( self.window, text="Live graph refresh in seconds: ", color='green', grid=[1, 10], align="left") self.textbox_live_refresh = guizero.TextBox(self.window, text="", width=5, grid=[1, 10], align="right") self.text_database_time = guizero.Text( self.window, text="Sensor Databases are\nsaved in UTC 0", size=10, grid=[2, 1], color='#CB0000', align="top") self.text_time_offset2 = guizero.Text(self.window, text="DateTime offset in hours", color='blue', grid=[2, 1], align="bottom") self.textbox_time_offset = guizero.TextBox(self.window, text="", width="5", grid=[2, 2], align="bottom") self.text_sql_skip = guizero.Text( self.window, text="Graph sensor data every 'X' entries", color='blue', grid=[2, 3], align="top") self.textbox_sql_skip = guizero.TextBox(self.window, text="", width="5", grid=[2, 4], align="top") self.text_temperature_offset = guizero.Text( self.window, text="Manual temperature offset in °C", color='blue', grid=[2, 4], align="bottom") self.textbox_temperature_offset = guizero.TextBox(self.window, text="", width="5", grid=[2, 5], align="bottom") self.text_network_timeouts = guizero.Text( self.window, text="Network timeouts in seconds", color='blue', grid=[2, 6], align="top") self.text_network_timeouts1 = guizero.Text(self.window, text="Sensor checks", color='green', grid=[2, 7], align="top") self.textbox_network_check = guizero.TextBox(self.window, text="", width="5", grid=[2, 8], align="top") self.text_network_timeouts2 = guizero.Text(self.window, text="Sensor data", color='green', grid=[2, 9], align="top") self.textbox_network_details = guizero.TextBox(self.window, text="", width="5", grid=[2, 10], align="top") # Window Tweaks self.window.tk.resizable(False, False) self.set_config(self.current_config) self.textbox_save_to.disable() self._enable_config_reset()