def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Crop Name Changed", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) self.dataSet = None self.selected_obj = None self.name_label = gbl.DLabel(self, text="") self.name_label.pack(pady=gv.BUTTON_SPACE) self.user_input_entry = tk.Entry(self, font=self.controller.title_font, justify='center') self.user_input_entry.pack(pady=gv.BUTTON_SPACE) btn_funcs = { 'save': lambda: (self.save_function()), 'back': lambda: (controller.show_frame("OCRConfig")) } btn_objs = { 'save': gbl.GButton(self, text="Save"), 'back': gbl.GButton(self, text="Go Back"), } for btn in btn_objs: btn_objs[btn].configure(command=btn_funcs[btn]) btn_objs[btn].pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="OCR Setup", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) self.ocr_obj_names = {} self.chosen_obj_key = "" self.chosen_obj_label = gbl.DLabel(self, text='No Cropped Images') self.chosen_obj_label.pack(pady=gv.BUTTON_SPACE) next_func = lambda: (self.choose_next_ocr_obj()) prev_func = lambda: (self.choose_prev_ocr_obj()) confirm_func = lambda: (self.config_chosen()) back_btn_func = lambda: (self.controller.show_frame("OCRSettings")) next_btn = gbl.GButton(self, text="Next Crop", command=next_func) prev_btn = gbl.GButton(self, text="Prev Crop", command=prev_func) confirm_btn = gbl.GButton(self, text="Choose Crop", command=confirm_func) back_btn = gbl.GButton(self, text="Go back", command=back_btn_func) next_btn.pack(pady=gv.BUTTON_SPACE) prev_btn.pack(pady=gv.BUTTON_SPACE) confirm_btn.pack(pady=gv.BUTTON_SPACE) back_btn.pack(pady=gv.BUTTON_SPACE) self.update_obj_names()
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, "Settings", controller.title_font) label.pack(side="top", fill="x", pady=8) self.access_ocr_settings = True self.access_audio_settings = True ocr_settings_func = lambda: ( self.try_access(self.access_ocr_settings, "ocr")) audio_settings_func = lambda: ( self.try_access(self.access_audio_settings, "audio")) finger_settings_func = lambda: ( controller.show_frame("FingerSettings")) back_btn_func = lambda: ( controller.show_frame("MainMenu")) ocr_settings_btn = gbl.GButton(self, "OCR Settings", ocr_settings_func) audio_settings_btn = gbl.GButton(self, "Audio Settings", audio_settings_func) finger_settings_btn = gbl.GButton(self, "Finger Settings", finger_settings_func) back_button_btn = gbl.GButton(self, "Go back", back_btn_func) ocr_settings_btn.pack(pady=gv.BUTTON_SPACE) audio_settings_btn.pack(pady=gv.BUTTON_SPACE) finger_settings_btn.pack(pady=gv.BUTTON_SPACE) back_button_btn.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Sample Setup", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) record_func = lambda: (audio.recordRef(), ) playback_func = lambda: ( audio.playReference(), # controller.show_frame("AudioSettings") ) back_func = lambda: (controller.show_frame("AudioSettings")) record_btn = gbl.GButton(self, text="Record Reference", command=record_func) playback_btn = gbl.GButton(self, text="Play Sample", command=playback_func) back_btn = gbl.GButton(self, text="Go back", command=back_func) record_btn.pack(pady=gv.BUTTON_SPACE) playback_btn.pack(pady=gv.BUTTON_SPACE) back_btn.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Audio Settings", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) btn1_fnc = lambda: (controller.show_frame("SampleSetup")) btn2_fnc = lambda: (controller.show_frame("AudioModeSetup")) # btn3_fnc = lambda: ( # controller.set_return_frame("AudioSettings"), # controller.show_frame("AudioMenu")) back_btn_func = lambda: (controller.show_frame("Settings")) btn1 = gbl.GButton(self, text="Reference Setup", command=btn1_fnc) btn2 = gbl.GButton(self, text="Run Mode", command=btn2_fnc) # btn3 = gbl.GButton(self, text="Test Run", # command=btn3_fnc) back_btn = gbl.GButton(self, text="Go back", command=back_btn_func) btn1.pack(pady=gv.BUTTON_SPACE) btn2.pack(pady=gv.BUTTON_SPACE) # btn3.pack(pady=gv.BUTTON_SPACE) back_btn.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, "Main Menu", controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) ocr_btn_func = lambda: ( controller.set_return_frame("MainMenu"), controller.show_frame("OCRMenu")) audio_btn_func = lambda: ( controller.set_return_frame("MainMenu"), controller.show_frame("AudioMenu")) settings_btn_func = lambda: ( controller.show_frame("Settings")) reset_btn_func = lambda: ( reset_all_running_flags(self.controller), reset_all_reset_mode(self.controller), settings.fullReset(), fbFuncs.postFirebase(settings.loadSettings("OCRSettings.json")['fb_data_url'], {'ocr_data': settings.loadSettings("OCRData.json")['dataset']}, self.controller.firebase_database), fbFuncs.postFirebase(settings.loadSettings("audioSettings.json")['fb_data_url'], {'audio_detected': settings.loadSettings("audioSettings.json")['detected']}, self.controller.firebase_database), self.controller.frames['OCRSetup'].update_obj_names() ) quit_btn_func = lambda: ( controller.destroy()) self.start_stop_ocr_btn = gbl.GButton(self, "OCR", ocr_btn_func) start_stop_audio_btn = gbl.GButton(self, "Audio", audio_btn_func) settings_btn = gbl.GButton(self, "Settings", settings_btn_func) reset_btn = gbl.GButton(self, "Reset Files", reset_btn_func) quit_btn = gbl.GButton(self, "Quit", quit_btn_func) self.start_stop_ocr_btn.pack(pady=gv.BUTTON_SPACE) start_stop_audio_btn.pack(pady=gv.BUTTON_SPACE) settings_btn.pack(pady=gv.BUTTON_SPACE) reset_btn.pack(pady=gv.BUTTON_SPACE) quit_btn.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="OCR Status", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) self.no_data_label = gbl.DLabel(self, text="No Data") self.no_data_label.pack(pady=gv.BUTTON_SPACE) self.orc_data_labels = {} back_btn_func = lambda: (controller.show_frame("OCRMenu")) self.back_button = gbl.GButton(self, text="Go back", command=back_btn_func) self.back_button.pack(pady=gv.BUTTON_SPACE) self.update_status(settings.loadSettings('OCRData.json')['dataset'])
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Audio Status", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) status_label_text = util.reformatTime( settings.loadSettings("audioSettings.json")['detected']) self.label_status = gbl.DLabel(self, text="Time detected: %s" % status_label_text) self.label_status.pack(pady=gv.BUTTON_SPACE) back_btn_func = lambda: (controller.show_frame("AudioMenu")) back_button = gbl.GButton(self, text="Go back", command=back_btn_func) back_button.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="OCR Config", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) self.dataSet = None self.selected_obj = None change_name_func = lambda: ( controller.frames["CropNameChange"].chosen_selected_obj( self.selected_obj, self.dataSet), controller.show_frame("CropNameChange"), controller.frames[ "CropNameChange"].focus_entry()) change_psm_func = lambda: (controller.frames["CropSettingConfig"] .chosen_selected_obj( self.selected_obj, self.dataSet, "psm"), controller.show_frame("CropSettingConfig")) change_lang_func = lambda: ( controller.frames["CropSettingConfig"].chosen_selected_obj( self.selected_obj, self.dataSet, "lang"), controller.show_frame("CropSettingConfig")) back_func = lambda: (controller.frames['OCRStatus'].update_status( settings.loadSettings('OCRData.json')['dataset']), controller.show_frame("OCRSetup")) change_name_btn = gbl.GButton(self, text="Change Name", command=change_name_func) change_psm_btn = gbl.GButton(self, text="Change psm", command=change_psm_func) change_lang_btn = gbl.GButton(self, text="Change Language", command=change_lang_func) back_btn = gbl.GButton(self, text="Go back", command=back_func) change_name_btn.pack(pady=gv.BUTTON_SPACE) change_psm_btn.pack(pady=gv.BUTTON_SPACE) change_lang_btn.pack(pady=gv.BUTTON_SPACE) back_btn.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="OCR Mode Setup", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) self.current_mode = settings.loadSettings( "OCRSettings.json")['loopMode'] self.mode_label = gbl.DLabel(self, text="mode: " + self.current_mode) self.mode_label.pack(pady=gv.BUTTON_SPACE) btn_funcs = { 'next mode': lambda: (self.change_current_mode_display( ocrBtns.next_mode(self.current_mode))), 'save': lambda: (settings.changeSetting(settings.loadSettings("OCRSettings.json"), 'loopMode', self.current_mode), fbFuncs.postFirebase( settings.loadSettings("OCRSettings.json")['fb_status_url'], {'run_mode': self.current_mode}, controller.firebase_database ), self.controller.frames['OCRMenu'].change_mode_label( self.current_mode), controller.show_frame("OCRSettings")), 'cancel': lambda: (controller.show_frame("OCRSettings")) } btn_objs = { 'next mode': gbl.GButton(self, text="Next Mode"), 'save': gbl.GButton(self, text="Save"), 'cancel': gbl.GButton(self, text="Cancel"), } for btn in btn_objs: btn_objs[btn].configure(command=btn_funcs[btn]) btn_objs[btn].pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Crop Setting Config", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) self.dataSet = None self.selected_obj = None self.current_setting = None self.setting_value = None self.current_setting_val_label = gbl.DLabel(self, text="None") self.current_setting_val_label.pack(pady=gv.BUTTON_SPACE) btn_funcs = { 'next mode': lambda: (self.cycle_current_setting()), 'save': lambda: (settings.changeSetting(settings.loadSettings("OCRData.json"), 'dataset', self.dataSet), fbFuncs.postFirebase( settings.loadSettings("OCRSettings.json")['fb_data_url'], self .dataSet, controller.firebase_database), controller.show_frame("OCRConfig")), 'cancel': lambda: (controller.show_frame("OCRConfig")) } btn_objs = { 'next mode': gbl.GButton(self, text="Next Mode"), 'save': gbl.GButton(self, text="Save"), 'cancel': gbl.GButton(self, text="Cancel"), } for btn in btn_objs: btn_objs[btn].configure(command=btn_funcs[btn]) btn_objs[btn].pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Finger Settings", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) press_finger_func = lambda :( self.press_finger() ) back_btn_func = lambda: ( controller.show_frame("Settings") ) pressfinger_btn = gbl.GButton(self, text="Press Finger", command=press_finger_func) back_btn = gbl.GButton(self, text="Go back", command=back_btn_func) pressfinger_btn.pack(pady=gv.BUTTON_SPACE) back_btn.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="OCR/Video Settings", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) btn_funcs = { 'crop_setup': lambda: ( # make sure all the settings for OCR are loaded settings.loadSettings('OCRSettings.json'), settings.loadSettings('OCRData.json'), settings.loadSettings('coordFile.json'), controller.frames["CropSetup"].update(), controller.show_frame("CropSetup")), 'mode': lambda: ( # , controller.show_frame("OCRModeSetup")), 'ocr_setup': lambda: (controller.show_frame("OCRSetup")), 'back': lambda: ( # , controller.show_frame("Settings")), } btn_objs = { 'crop_setup': gbl.GButton(self, text="Crop Setup"), 'ocr_setup': gbl.GButton(self, text="OCR Setup"), 'mode': gbl.GButton(self, text="Run Mode"), 'back': gbl.GButton(self, text="Go back"), } for btn in btn_objs: btn_objs[btn].configure(command=btn_funcs[btn]) btn_objs[btn].pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Audio Mode Setup", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) self.current_mode = settings.loadSettings( 'audioSettings.json')['loopMode'] self.mode_label = gbl.DLabel(self, text="mode: " + self.current_mode) self.mode_label.pack(pady=gv.BUTTON_SPACE) next_mode_func = lambda: (self.change_current_mode_display( audioBtns.next_mode(self.current_mode))) save_func = lambda: ( settings.changeSetting(settings.loadSettings("audioSettings.json"), 'loopMode', self.current_mode), fbFuncs.postFirebase( settings.loadSettings("audioSettings.json")['fb_status_url'], {'run_mode': self.current_mode}, controller.firebase_database), self.controller.frames['AudioMenu'].change_mode_label( self.current_mode), controller.show_frame("AudioSettings")) cancel_func = lambda: (self.change_current_mode_display( settings.loadSettings("audioSettings.json")['loopMode']), controller.show_frame("AudioSettings")) next_mode_btn = gbl.GButton(self, text="Next Mode", command=next_mode_func) save_btn = gbl.GButton(self, text="Save", command=save_func) cancel_btn = gbl.GButton(self, text="Cancel", command=cancel_func) next_mode_btn.pack(pady=gv.BUTTON_SPACE) save_btn.pack(pady=gv.BUTTON_SPACE) cancel_btn.pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Crop Setup", font=controller.title_font) label.pack(side="top", fill="x", pady=gv.TITLE_PADY) btn_funcs = { 'add': lambda: (ocrBtns.cropSetup_add(), ), 'remove': lambda: (ocrBtns.cropSetup_remove(), ), 'show': lambda: (ocrBtns.cropSetup_show()), 'back': lambda: (controller.frames['OCRSetup'].update_obj_names(), controller.show_frame("OCRSettings"), controller.frames[ 'OCRStatus'].update_status( settings.loadSettings('OCRData.json')['dataset']), fbFuncs.postFirebase( settings.loadSettings("OCRSettings.json")['fb_status_url'], { "ocr_data": settings.loadSettings("OCRData.json")[ 'dataset'] }, self.controller.firebase_database)) } btn_objs = { 'add': gbl.GButton(self, text="Add Crop Area"), 'remove': gbl.GButton(self, text="Remove Last"), 'show': gbl.GButton(self, text="Show Current"), 'back': gbl.GButton(self, text="Go back"), } for btn in btn_objs: btn_objs[btn].configure(command=btn_funcs[btn]) btn_objs[btn].pack(pady=gv.BUTTON_SPACE)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="OCR Menu", font=controller.title_font) # label.pack(side="top", fill="x", pady=10) label.grid(row=0, column=0, pady=gv.TITLE_PADY, columnspan=3, sticky='nsew') # flag for looping OCR self.will_update = False # changed by both button input and internal conditions self.button_off = False # even if will_update loop is set to true, a botton off will always stop the loop self.user_setup = False holder_frame = gbl.DFrame(self) holder_frame.grid(row=1, column=0, columnspan=3, pady=gv.LABEL_PADY) mySet = settings.loadSettings('OCRSettings.json') self.running_display_label = tk.Label(holder_frame, text='Running: ' + mySet['running']) self.running_display_label.configure(background=gv.LABEL_COLOR, font=tkfont.Font(size=26), fg=gv.LABEL_FONT_COLOR, justify='left') self.running_display_label.pack(side='left', pady=gv.LABEL_PADY, padx=gv.LABEL_PADX) # self.running_display_label.grid(column=0, pady=gv.LABEL_PADY, padx=gv.LABEL_PADX) x_padding_label = tk.Label(holder_frame) x_padding_label.configure(background=gv.LABEL_COLOR) x_padding_label.pack(side='left', padx=gv.LABEL_PADX * 3) # self.x_padding_label.grid(column=1, pady=gv.LABEL_PADY, padx=gv.LABEL_PADX) self.mode_display_label = tk.Label(holder_frame, text='Run mode: ' + mySet['loopMode']) self.mode_display_label.configure(background=gv.LABEL_COLOR, font=tkfont.Font(size=26), fg=gv.LABEL_FONT_COLOR, justify='right') # self.mode_display_label.grid(column=2, pady=gv.LABEL_PADY, padx=gv.LABEL_PADX) self.mode_display_label.pack(side='left', pady=gv.LABEL_PADY, padx=gv.LABEL_PADX) # List functions called in order on button press btn_funcs = { 'toggle': lambda: (self.ocr_on_off()), 'show': lambda: ( # , controller.show_frame("OCRStatus")), 'back': lambda: ( # , controller.show_frame(controller.return_frame)) } btn_objs = { 'toggle': gbl.GButton(self, text="Start/Stop"), 'show': gbl.GButton(self, text="Show Status"), 'back': gbl.GButton(self, text="Go back") } count = 2 for btn in btn_objs: btn_objs[btn].configure(command=btn_funcs[btn]) # btn_objs[btn].pack(pady=gv.BUTTON_SPACE) btn_objs[btn].grid(row=count, column=1, pady=gv.BUTTON_SPACE) count += 1 self.grid_columnconfigure(0, weight=1) self.grid_columnconfigure(2, weight=1) self.count = 0
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg=gv.BACKGROUND_COLOR) self.controller = controller label = gbl.GLabel(self, text="Audio Menu", font=controller.title_font) label.grid(row=0, column=0, pady=gv.TITLE_PADY, columnspan=3, sticky='nsew') self.will_update = False # changed by both button input and internal conditions self.button_off = False # even if will_update loop is set to true, a botton off will always stop the loop self.user_setup = False holder_frame = gbl.DFrame(self) holder_frame.grid(row=1, column=0, columnspan=3, pady=gv.LABEL_PADY) mySet = settings.loadSettings('audioSettings.json') self.running_display_label = tk.Label(holder_frame, text='Running: ' + mySet['running']) self.running_display_label.configure(background=gv.LABEL_COLOR, font=tkfont.Font(size=26), fg=gv.LABEL_FONT_COLOR, justify='left') self.running_display_label.pack(side='left', pady=gv.LABEL_PADY, padx=gv.LABEL_PADX) x_padding_label = tk.Label(holder_frame) x_padding_label.configure(background=gv.LABEL_COLOR) x_padding_label.pack(side='left', padx=gv.LABEL_PADX * 3) self.mode_display_label = tk.Label(holder_frame, text='Run mode: ' + mySet['loopMode']) self.mode_display_label.configure(background=gv.LABEL_COLOR, font=tkfont.Font(size=26), fg=gv.LABEL_FONT_COLOR, justify='right') self.mode_display_label.pack(side='left', pady=gv.LABEL_PADY, padx=gv.LABEL_PADX) btn1_fnc = lambda: (self.audio_on_off()) btn2_fnc = lambda: (controller.show_frame("AudioStatus")) back_btn_func = lambda: (controller.show_frame(controller.return_frame) ) btn1 = gbl.GButton(self, text="Start/Stop", command=btn1_fnc) btn2 = gbl.GButton(self, text="Show Status", command=btn2_fnc) back_btn = gbl.GButton(self, text="Go back", command=back_btn_func) self.grid_columnconfigure(0, weight=1) self.grid_columnconfigure(2, weight=1) # btn1.pack(pady=gv.BUTTON_SPACE) # btn2.pack(pady=gv.BUTTON_SPACE) # back_btn.pack(pady=gv.BUTTON_SPACE) btn1.grid(row=2, column=1, pady=gv.BUTTON_SPACE) btn2.grid(row=3, column=1, pady=gv.BUTTON_SPACE) back_btn.grid(row=4, column=1, pady=gv.BUTTON_SPACE)