def choose_bl(*event):
    path = cf_scripts.ls_from_str_tuple(var_str_bl.get())[0]
    if path:
        initial_dir = cf_scripts.dir_from_str_path(path)
    else:
        initial_dir = None
    f_bl = tkinter.filedialog.askopenfilenames(filetypes=ext_bl,
                                               initialdir=initial_dir)
    if f_bl:
        var_str_bl.set(f_bl)
    if f_bl and not var_str_result.get():
        var_str_result.set(
            cf_scripts.dir_from_str_path(
                cf_scripts.ls_from_str_tuple(var_str_bl.get())[0]) + '/' +
            fn_result)
def choose_bl(*event):
    path = cf_scripts.ls_from_str_tuple(var_str_bl.get())[0]
    if path:
        initial_dir = cf_scripts.dir_from_str_path(path)
    else:
        initial_dir = None
    f_bl = tkinter.filedialog.askopenfilenames(
        filetypes=ext_bl, initialdir=initial_dir)
    if f_bl:
        var_str_bl.set(f_bl)
    if f_bl and not var_str_result.get():
        var_str_result.set(
            cf_scripts.dir_from_str_path(
                cf_scripts.ls_from_str_tuple(var_str_bl.get())[0])
                + '/' + fn_result)
def turn_off_export():
    if var_saved_result.get():
        var_str_result.set(var_saved_result.get())
    elif not var_saved_result.get() and var_str_bl.get():
        path_1 = cf_scripts.ls_from_str_tuple(var_str_bl.get())[0]
        var_str_result.set(
            cf_scripts.dir_from_str_path(path_1) + '/' + fn_result)
    else:
        var_str_result.set('')
    btn_result['state'] = 'normal'
def turn_off_export():
    if var_saved_result.get():
        var_str_result.set(var_saved_result.get())
    elif not var_saved_result.get() and var_str_bl.get():
        path_1 = cf_scripts.ls_from_str_tuple(var_str_bl.get())[0]
        var_str_result.set(
            cf_scripts.dir_from_str_path(path_1) + '/' + fn_result)
    else:
        var_str_result.set('')
    btn_result['state'] = 'normal'
def choose_result(*event):
    if btn_result['state'] == 'disabled':
        return
    path = var_str_result.get()
    if path:
        initial_dir = cf_scripts.dir_from_str_path(path)
    else:
        initial_dir = cf_scripts.dir_from_str_path(
            cf_scripts.ls_from_str_tuple(var_str_bl.get()))
    f_result = tkinter.filedialog.asksaveasfilename(filetypes=ext_result,
                                                    initialdir=initial_dir,
                                                    initialfile=fn_result)
    if f_result:
        var_str_result.set(f_result)
def choose_terms(*event):
    path = cf_scripts.ls_from_str_tuple(var_str_terms.get())[0]
    if path:
        initial_dir = cf_scripts.dir_from_str_path(path)
    else:
        initial_dir = None
    if var_bool_function.get():
        extensions = ext_function
    else:
        extensions = ext_terms
    f_terms = tkinter.filedialog.askopenfilenames(filetypes=extensions,
                                                  initialdir=initial_dir)
    if f_terms:
        var_str_terms.set(f_terms)
def choose_result(*event):
    if btn_result['state'] == 'disabled':
        return
    path = var_str_result.get()
    if path:
        initial_dir = cf_scripts.dir_from_str_path(path)
    else:
        initial_dir = cf_scripts.dir_from_str_path(
            cf_scripts.ls_from_str_tuple(var_str_bl.get()))
    f_result = tkinter.filedialog.asksaveasfilename(
        filetypes=ext_result, initialdir=initial_dir,
        initialfile=fn_result)
    if f_result:
        var_str_result.set(f_result)
def choose_terms(*event):
    path = cf_scripts.ls_from_str_tuple(var_str_terms.get())[0]
    if path:
        initial_dir = cf_scripts.dir_from_str_path(path)
    else:
        initial_dir = None
    if var_bool_function.get():
        extensions = ext_function
    else:
        extensions = ext_terms
    f_terms = tkinter.filedialog.askopenfilenames(
        filetypes=extensions, initialdir=initial_dir)
    if f_terms:
        var_str_terms.set(f_terms)
 def open_xproof(*event):
     if var_str_bl.get():
         path_list = cf_scripts.ls_from_str_tuple(var_str_bl.get())
         path_dir = cf_scripts.dir_from_str_path(path_list[0])
         byte_path_dir = path_dir.encode()
     else:
         byte_path_dir = ''
     print('-' * 70)
     print('Calling XProof...')
     print(
         'Check Forbidden will be disabled while the process is running.'
     )
     try:
         to_run = '"' + '" "'.join([path_xproof + 'XProofCmd.exe'] +
                                   path_list) + '"'
         cf_scripts.subprocess.run(to_run)
     except:
         cf_scripts.subprocess.Popen(
             ['clip'], stdin=cf_scripts.subprocess.PIPE).communicate(
                 byte_path_dir)
         cf_scripts.subprocess.run(path_xproof + 'XProof.exe')
     finally:
         print('Exited from XProof.')