diff --git a/src/create-menu-item-actions.cc b/src/create-menu-item-actions.cc index 3c7ac8f27..e84661519 100644 --- a/src/create-menu-item-actions.cc +++ b/src/create-menu-item-actions.cc @@ -495,6 +495,8 @@ fetch_map_from_emdb_action(G_GNUC_UNUSED GSimpleAction *simple_action, } +#include "curl-utils.hh" + void fetch_pdbe_ligand_description_action(G_GNUC_UNUSED GSimpleAction *simple_action, G_GNUC_UNUSED GVariant *parameter, @@ -506,14 +508,19 @@ fetch_pdbe_ligand_description_action(G_GNUC_UNUSED GSimpleAction *simple_action, coot::residue_spec_t res_spec(pp.second.second); const auto &m = graphics_info_t::molecules[imol]; std::string comp_id = m.get_residue_name(res_spec); - // python-function: coot_utils.get_SMILES_for_comp_id_from_pdbe arg: comp_id - std::cout << "run python function coot_utils.get_SMILES_for_comp_id_from_pdbe " << comp_id << std::endl; - short int lang = coot::STATE_PYTHON; - std::vector args = { coot::command_arg_t(comp_id) }; - std::string sc = g.state_command("coot_utils", "get_SMILES_for_comp_id_from_pdbe", args, lang); - std::cout << ":::::::::::::::::::::: python command: " << sc << std::endl; - safe_python_command("import coot_utils"); // Hack. This has already happened, but python has forgotten. - safe_python_command(sc); + + // 20240706-PE old python function was get_SMILES_for_comp_id_from_pdbe() + // and that calls get_pdbe_cif_for_comp_id() + xdg_t xdg; + std::string file_name = comp_id + ".cif"; + std::filesystem::path data_home = xdg.get_data_home(); + std::filesystem::path file_path = data_home / file_name; + // maybe check that the file exists first? + std::string url = std::string("https://www.ebi.ac.uk/pdbe/static/files/pdbechem_v2/") + file_name; + int status = coot_get_url(url, file_path.string()); + if (status == 0) { + read_cif_dictionary(file_name.c_str()); // remove above include and put this function into cc-interface.hh + } } }