Example #1
0
 def load_templates(self, gas_dir: GasDir):
     if self.templates is None:
         self.templates = {}
     for gas_file in gas_dir.get_gas_files().values():
         sections = gas_file.get_gas().items
         for section in sections:
             self.load_templates_rec(section)  # recurse into sub-sections
     # recurse into subdirs
     for name, subdir in gas_dir.get_subdirs().items():
         self.load_templates(subdir)
Example #2
0
def untranslate_file(lang_dir: GasDir, lang_file_name: str):
    print(lang_file_name)
    lang_file = lang_dir.get_gas_files().get(lang_file_name)
    lang_file_gas: Gas = lang_file.get_gas()
    text_section: Section = lang_file_gas.items[0]
    for translation_section in text_section.get_sections():
        if translation_section.get_attr(
                'from') and translation_section.get_attr('to'):
            translation_section.set_attr_value(
                'to', translation_section.get_attr_value('from'))
    lang_file.save()
Example #3
0
 def load_node_mesh_guids_recursive(cls, gas_dir: GasDir,
                                    node_mesh_guids: dict):
     for gas_file in gas_dir.get_gas_files().values():
         mesh_file_sections = gas_file.get_gas().find_sections_recursive(
             'mesh_file*')
         for mesh_file_section in mesh_file_sections:
             filename = mesh_file_section.get_attr_value('filename')
             guid = mesh_file_section.get_attr_value('guid')
             node_mesh_guids[guid] = filename
     for subdir in gas_dir.get_subdirs().values():
         cls.load_node_mesh_guids_recursive(subdir, node_mesh_guids)