<commit_before>from qtpy.QtWidgets import QFileDialog
import os

import addie.utilities.specify_plots_style as ps
from addie.calculate_gr.event_handler import  check_in_fixed_dir_structure

def do_load_bragg_file(main_window):
    """
    Load Bragg files including GSAS, NeXus, 3-column ASCii.
    """
    # get file
    ext = 'GSAS (*.gsa *.gda *.gss);;Processed Nexus (*.nxs);;dat (*.dat);;All (*.*)'

    # get default dir
    if main_window._currDataDir is None:
        default_dir = os.getcwd()
    else:
        default_dir = main_window.getDefaultDir(sub_dir='GSAS')

    bragg_file_names = QFileDialog.getOpenFileNames(main_window, 'Choose Bragg File', default_dir, ext)
    if isinstance(bragg_file_names, tuple):
        bragg_file_names = bragg_file_names[0]
    if bragg_file_names is None or bragg_file_names == '' or len(bragg_file_names) == 0:
        return
    bragg_file_names = [str(bragg_file_name) for bragg_file_name in bragg_file_names]

    # update stored data directory
    try:
        main_window._currDataDir = os.path.split(os.path.abspath(bragg_file_names[0]))[0]
    except IndexError as index_err:
        err_message = 'Unable to get absolute path of {0} due to {1}'.format(bragg_file_names, index_err)
        print(err_message)

    check_in_fixed_dir_structure(main_window, sub_dir='GSAS')

    # load file
    try:
        gss_ws_names = list()
        for bragg_file_name in bragg_file_names:
            gss_ws_name, bank_angles = main_window._myController.load_bragg_file(bragg_file_name)
            gss_ws_names.append(gss_ws_name)
            banks_list = list()
            for i, angle in enumerate(bank_angles):
                banks_list.append('Bank {} - {}'.format(i + 1, angle))

            # add to tree
            main_window.rietveld_ui.treeWidget_braggWSList.add_bragg_ws_group(gss_ws_name, banks_list)

        # get plot mode<commit_msg>Fixed another missing file call<commit_after>from qtpy.QtWidgets import QFileDialog
import os

import addie.utilities.specify_plots_style as ps
from addie.calculate_gr.event_handler import  check_in_fixed_dir_structure, getDefaultDir

def do_load_bragg_file(main_window):
    """
    Load Bragg files including GSAS, NeXus, 3-column ASCii.
    """
    # get file
    ext = 'GSAS (*.gsa *.gda *.gss);;Processed Nexus (*.nxs);;dat (*.dat);;All (*.*)'

    # get default dir
    if main_window._currDataDir is None:
        default_dir = os.getcwd()
    else:
        default_dir = getDefaultDir(main_window, sub_dir='GSAS')

    bragg_file_names = QFileDialog.getOpenFileNames(main_window, 'Choose Bragg File', default_dir, ext)
    if isinstance(bragg_file_names, tuple):
        bragg_file_names = bragg_file_names[0]
    if bragg_file_names is None or bragg_file_names == '' or len(bragg_file_names) == 0:
        return
    bragg_file_names = [str(bragg_file_name) for bragg_file_name in bragg_file_names]

    # update stored data directory
    try:
        main_window._currDataDir = os.path.split(os.path.abspath(bragg_file_names[0]))[0]
    except IndexError as index_err:
        err_message = 'Unable to get absolute path of {0} due to {1}'.format(bragg_file_names, index_err)
        print(err_message)

    check_in_fixed_dir_structure(main_window, sub_dir='GSAS')

    # load file
    try:
        gss_ws_names = list()
        for bragg_file_name in bragg_file_names:
            gss_ws_name, bank_angles = main_window._myController.load_bragg_file(bragg_file_name)
            gss_ws_names.append(gss_ws_name)
            banks_list = list()
            for i, angle in enumerate(bank_angles):
                banks_list.append('Bank {} - {}'.format(i + 1, angle))

            # add to tree
            main_window.rietveld_ui.treeWidget_braggWSList.add_bragg_ws_group(gss_ws_name, banks_list)

        # get plot mode
{'fraction_non_alphanumeric': 0.09321148825065274, 'fraction_numerical': 0.004177545691906005, 'mean_word_length': 3.333710407239819, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5425871', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1304, 'n_words': 269}