Esempio n. 1
0
def check_VMD_TEMP(all_settings):
    ltxt = io.open_read(all_settings['vmd_temp']).strip('\n').split('\n')
    for i, line in enumerate(ltxt):
        if 'render' in line.lower() and 'tachyon' in line.lower():
            break
    ltxt = ltxt[:i + 1]
    ltxt.append(consts.end_of_vmd_file)
    io.open_write(all_settings['vmd_temp'], '\n'.join(ltxt))
Esempio n. 2
0
def init_all_settings_other(all_settings):
    all_settings['any_extra_raw_tcl_code'] = ''
    all_settings['clean_settings_dict'] = settings_file.final_orig_settings
    all_settings['settings_file'] = settings_file.settings_file
    all_settings['orig_settings'] = io.open_read(all_settings['settings_file'])
    all_settings['defaults'] = dft.defaults
    # Misc required step data
    all_settings['mols_plotted'] = ''
    all_settings['verbose_output'] = typ.translate_to_bool(
        all_settings['verbose_output'], 'verbose_output')
    all_settings['restart_vis'] = typ.translate_to_bool(
        all_settings['restart_vis'], 'restart_vis')
    all_settings['do_transition_state'] = typ.translate_to_bool(
        all_settings['do_transition_state'], 'do_transition_state')
    init_missing_pos_step_vars(all_settings)
Esempio n. 3
0
    def __init__(self,
                 templateFilePath,
                 replacers,
                 defaults,
                 getPathOnly=False):

        self.filePath = templateFilePath
        self.replacers = replacers
        self.defaults = defaults
        self.params = defaults.params

        self._getTitle()
        self._determineSavePath(static_folder)

        if getPathOnly is not True:
            self.fileTxt = io.open_read(templateFilePath)
            self.replacers['*topnavStyle*'] = ' '
            self.fileTxt = self._replaceVars(self.fileTxt, self.replacers)
Esempio n. 4
0
    def __init__(self,
                 templateFilePath,
                 sectionParams,
                 title,
                 replacers,
                 getPathOnly=False):

        self.filePath = templateFilePath  # The template HTML of the table
        self.title = title  # What the section is called
        self.params = sectionParams  # All the parameters in the table

        # Borrowed from Parent (HTMLFile)
        self._determineSavePath(tables_folder)  # Sets the self.savePath

        if getPathOnly is not True:
            self.fileTxt = io.open_read(self.filePath)  # Text in table file
            self._create_table()

            repl = {i: replacers[i] for i in replacers}
            repl['*table_data*'] = self.tableTxt
            repl['*table_name*'] = self.title.title()
            repl['*topnavStyle*'] = 'style="margin-left: 205px; width:100%;"'
            self.fileTxt = self._replaceVars(self.fileTxt, repl)
Esempio n. 5
0
    def __init__(self, filePath):
        self.fPath = filePath
        self.params = OrderedDict()
        self.fTxt = io.open_read(filePath)

        # Ignore the docstring at the top and get only the defaults dictionary
        defaultsTxt = self._getDefaultsDict()
        self._separateSections(defaultsTxt)  # Get sections in defaults dict

        # Parse each line
        remKeys = []
        for section in self.params:
            if section.strip():
                for line in self.params[section]['ltxt']:
                    setting, params = self._parseLine(line)
                    if setting:
                        self.params[section][setting] = params
                self.params[section].pop('ltxt')
            else:
                remKeys.append(section)

        # Remove redundant keys
        for key in remKeys:
            self.params.pop(key)
Esempio n. 6
0
#import sympy as sp  # Use this to print things prettyily eventually (maybe to simplify certain bits too)
import sys
#import os


class Transform(object):
    def __init__(self, equation_in):
        steps_taken = ""
        begin_eq = "\n"
        end_eq = "\n"
        math_objs = MO.MATH_OBJECTS(equation_in, steps_taken, begin_eq, end_eq)
        print(math_objs.latex())


transform_path = io.folder_correct("./To_Transform")
transform_txt = io.open_read(transform_path)
transform_txt = txt_lib.clean_eq(transform_txt)

if not len(transform_txt):
    print("Can't find any text")
    sys.exit()

Transform("\sum{_k \delta_{jk}}")

#tex_folderpath = io.folder_correct('./steps')
#tex_filepath = tex_folderpath + "steps.tex"
#
#io.open_write(tex_filepath, MO.steps_taken)
#latex_cmd = "pdflatex --output-directory='%s'"%tex_folderpath
#os.system("%s %s"%(latex_cmd, tex_filepath))
#
Esempio n. 7
0
        # Don't handle the path variable as it hasn't got a default
        if not path_done and dfl.SequenceMatcher(None, setting, 'path').ratio() > 0.8:
            path_done = True
            all_settings['path'] = clean_settings_dict[setting]
            final_orig_settings_dict['path'] = orig_settings_dict[setting]
            continue

        actual_setting = get_act_setting(setting, all_setting_names)
        if type(orig_settings_dict[setting][0]) == str:
            final_orig_settings_dict[actual_setting] = ["'%s'"%orig_settings_dict[setting][0], orig_settings_dict[setting][1]]
        else:
            final_orig_settings_dict[actual_setting] = orig_settings_dict[setting]
    return final_orig_settings_dict

settings_file = io.folder_correct(consts.settings_filepath)
orig_settings_ltxt = io.open_read(settings_file).split('\n')
settings_ltxt = remove_bad_lines(orig_settings_ltxt)
clean_settings_dict = create_clean_settings(settings_ltxt)
orig_settings_dict = create_orig_settings(orig_settings_ltxt)
all_settings = grab_defaults(clean_settings_dict)
final_orig_settings = find_final_orig_settings(orig_settings_dict, all_settings)
io.write_cleaned_orig_settings(final_orig_settings, settings_file)
if 'path' not in all_settings:
    raise SystemExit("""Sorry I can't find the path variable.... Are you sure you set this?

Use path='...' in the settings.inp file.
""")

if not io.path_leads_somewhere(all_settings['path']):
   raise SystemExit("\nThe specified path doesn't lead anywhere:\n%s\n\n\t Where is my data?! "%all_settings['path'])
Esempio n. 8
0
    template_filepaths = {}
    for f in os.listdir(templates_folder):
        fName = f.replace('.html', '')
        template_filepaths[fName] = templates_folder + f

    # The default settings filepath
    defaults_filepath = io.folder_correct('./Templates/') + 'defaults.py'

    defaults = ParseDefaults(defaults_filepath)
    # A dictionary of things to find in the HTML files and replace
    replacers = {
        "*doc_img_folder*": io.folder_correct(docs_folder + "Perm_img"),
        "*docs_folder*": docs_folder,
        "*vendor_folder_path*": io.folder_correct(docs_folder + "vendor"),
        "*css_folder_path*": io.folder_correct(docs_folder + "css"),
        "*quick_start*": io.open_read(templates_folder + "QuickStart.html"),
        "*intro_text*": io.open_read(templates_folder + "Intro.html"),
        "*Misc*": io.open_read(templates_folder + 'IntroMisc.html'),
        "*Pagetitle*": "Movie Maker Documentation",
        "*header_text*": io.open_read(templates_folder + 'HeaderTxt.html'),
        "*top_nav*": io.open_read(templates_folder + 'TopNav.html'),
    }

    # Handle the Sidebar
    SideBar(defaults, replacers, tables_folder)

    # Handle the docstrings on top of the python files
    dstr = docstr.Docstr_Parsing('.')

    replacers['*Mov_Mak_Edit*'] = dstr.docstrTxt