Exemplo n.º 1
0
def render_header_item_nml(header_item):
    template = templates[header_item + ".pynml"]
    result = utils.unescape_chameleon_output(
        template(
            registered_industries=registered_industries,
            registered_cargos=registered_cargos,
            economies=registered_economies,
            incompatible_grfs=incompatible_grfs,
            global_constants=global_constants,
            graphics_temp_storage=global_constants.
            graphics_temp_storage,  # convenience measure
            makefile_args=makefile_args,
            utils=utils,
            sys=sys,
            git_info=git_info,
        ))
    # write the nml per vehicle to disk, it aids debugging
    # ! clunky split to get rid of the extension - temporary artefact of migrating away from CPP
    header_item_name = header_item.split(".")[0]
    nml_file = os.path.join(generated_nml_path, header_item_name + ".nml")
    nml = codecs.open(nml_file, "w", "utf8")
    nml.write(result)
    nml.close()
    # also return the nml directly for writing to the concatenated nml, don't faff around opening the generated nml files from disk
    return result
Exemplo n.º 2
0
def render_header_item_nml(header_item, consists):
    template = templates[header_item + '.pynml']
    return utils.unescape_chameleon_output(template(consists=consists,
                                                    global_constants=global_constants,
                                                    utils=utils,
                                                    registered_rosters=registered_rosters,
                                                    makefile_args=makefile_args))
Exemplo n.º 3
0
def render_consist_nml(consist):
    result = utils.unescape_chameleon_output(consist.render())
    # write the nml per vehicle to disk, it aids debugging
    consist_nml = codecs.open(os.path.join(generated_files_path, 'nml', consist.id + '.nml'),'w','utf8')
    consist_nml.write(result)
    consist_nml.close()
    # also return the nml directly for writing to the concatenated nml, don't faff around opening the generated nml files from disk
    return result
Exemplo n.º 4
0
def render_item_nml(item):
    result = utils.unescape_chameleon_output(item.render(templates))
    # write the nml per item to disk, it aids debugging
    item_nml = codecs.open(
        os.path.join(generated_files_path, "nml", item.id + ".nml"), "w", "utf8"
    )
    item_nml.write(result)
    item_nml.close()
    # also return the nml directly for writing to the concatenated nml, don't faff around opening the generated nml files from disk
    return result
Exemplo n.º 5
0
def main():
    ships = fish.get_ships_in_buy_menu_order()

    grf_nml = codecs.open(os.path.join('fish.nml'), 'w', 'utf8')
    header_items = ['header', 'cargo_table', 'disable_default_ships']
    for header_item in header_items:
        template = templates[header_item + '.pynml']
        grf_nml.write(
            utils.unescape_chameleon_output(
                template(ships=ships,
                         global_constants=global_constants,
                         registered_rosters=registered_rosters,
                         utils=utils,
                         sys=sys,
                         repo_vars=repo_vars)))

    for ship in set(ships):
        grf_nml.write(utils.unescape_chameleon_output(ship.render()))

    grf_nml.close()
Exemplo n.º 6
0
def render_header_item_nml(header_item, consists):
    template = templates[header_item + '.pynml']
    return utils.unescape_chameleon_output(
        template(consists=consists,
                 global_constants=global_constants,
                 utils=utils,
                 active_rosters=iron_horse.get_active_rosters(),
                 intermodal_containers=iron_horse.intermodal_containers,
                 haulage_bonus_engine_id_tree=iron_horse.
                 get_haulage_bonus_engine_id_tree(),
                 makefile_args=makefile_args))
Exemplo n.º 7
0
def render_header_item_nml(header_item, consists):
    template = templates[header_item + ".pynml"]
    return utils.unescape_chameleon_output(
        template(
            consists=consists,
            global_constants=global_constants,
            temp_storage_ids=global_constants.temp_storage_ids,  # convenience measure
            utils=utils,
            active_rosters=iron_horse.get_active_rosters(),
            graphics_path=global_constants.graphics_path,
            haulage_bonus_engine_id_tree=iron_horse.get_haulage_bonus_engine_id_tree(),
            pax_car_ids=iron_horse.get_pax_car_ids(),
            restaurant_car_ids=iron_horse.get_restaurant_car_ids(),
            livery_2_engine_ids=iron_horse.get_livery_2_engine_ids(),
            cargo_sprinter_ids=iron_horse.get_cargo_sprinter_ids(),
            makefile_args=makefile_args,
            git_info=git_info,
        )
    )