def thresh_btn(self): if (self.root.settings_win.threshModeBtn.cget('text') == 'THRESH MODE' ): program_state.set_thresh(True) self.root.settings_win.threshModeBtn.configure( bg='red', activebackground='red', text='STOP THRESH MODE') elif (self.root.settings_win.threshModeBtn.cget('text') == 'STOP THRESH MODE'): program_state.set_thresh(False) self.root.settings_win.threshModeBtn.configure( bg='blue', activebackground='blue', text='THRESH MODE')
def admin(event, window): window.find_element('-LIVE-MODE-').Update( button_color=sg.theme_button_color()) window.find_element('-BARK-MODE-').Update( button_color=sg.theme_button_color()) window.find_element('-POSITION-MODE-').Update( button_color=sg.theme_button_color()) window.find_element('-CALIBRATE-LAYOUT-').Update(visible=False) window.find_element('-REJECT-LAYOUT-').Update(visible=False) window.find_element('-CAM-THRESH-LAYOUT-').Update(visible=False) window.find_element('-SIDE1-POSITION-LAYOUT-').Update(visible=False) window.find_element('-SIDE2-POSITION-LAYOUT-').Update(visible=False) window.find_element('-IO-LAYOUT-').Update(visible=False) window.find_element('-ADMIN-BOX1-TEXT-').Update('THRESH') window.find_element('-ADMIN-BOX1-TEXT-').Update(visible=True) # When the setup button is pressed if event == '-SETUP-': # stop run mode program_state.set_run_mode(False) # change to admin view window.find_element('-VIEW-LAYOUT-').Update(visible=False) window.find_element('-ADMIN-LAYOUT-').Update(visible=True) # default state to live mode program_state.set_live(True) # turn live button on window.find_element('-LIVE-MODE-').Update(button_color=('black', 'yellow')) window.find_element('-IO-LAYOUT-').Update(visible=True) window.find_element('-CALIBRATE-LAYOUT-').Update(visible=True) window.find_element('-REJECT-LAYOUT-').Update(visible=True) window.find_element('-ADMIN-BOX1-TEXT-').Update(visible=False) # When the cancel button is pressed if event == '-CANCEL-': window.find_element('-VIEW-LAYOUT-').Update(visible=True) window.find_element('-ADMIN-LAYOUT-').Update(visible=False) # make sure admin modes are off program_state.set_live(False) program_state.set_thresh(False) # When the shut down button is pressed if event == '-SHUT-DOWN-': program_state.stop_program() # When live mode button is pressed if event == '-LIVE-MODE-': program_state.set_live(True) # turn on live view mode # turn live button on window.find_element('-LIVE-MODE-').Update(button_color=('black', 'yellow')) window.find_element('-IO-LAYOUT-').Update(visible=True) window.find_element('-CALIBRATE-LAYOUT-').Update(visible=True) window.find_element('-REJECT-LAYOUT-').Update(visible=True) window.find_element('-ADMIN-BOX1-TEXT-').Update(visible=False) # When bark thresh mode button is pressed if event == '-BARK-MODE-': program_state.set_thresh(True) # turn on box thresh mode # turn thresh button on window.find_element('-BARK-MODE-').Update(button_color=('black', 'yellow')) window.find_element('-CAM-THRESH-LAYOUT-').Update(visible=True) window.find_element('-IO-LAYOUT-').Update(visible=True) # When position mode button is pressed if event == '-POSITION-MODE-': program_state.set_live(True) # turn on live view mode # turn side 1 button on window.find_element('-POSITION-MODE-').Update(button_color=('black', 'yellow')) window.find_element('-SIDE1-POSITION-LAYOUT-').Update(visible=True) window.find_element('-SIDE2-POSITION-LAYOUT-').Update(visible=True) window.find_element('-IO-LAYOUT-').Update(visible=True)
def settings_window_close(self): # Stop calibrate mode and start running again program_state.set_calibrate_mode(False) program_state.set_thresh(False) program_state.set_run_mode(True) self.root.settings_win.destroy()