Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
pemsley committed Jan 7, 2025
2 parents 10f9720 + 95ff4bf commit bd24979
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 7 deletions.
40 changes: 38 additions & 2 deletions src/c-interface-ligands-gui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1364,8 +1364,44 @@ PyObject *get_ligand_distortion_summary_info_py(int imol, PyObject *residue_spec
void
show_acedrg_link_interface_overlay() {

GtkWidget *w = widget_from_builder("acedrg_link_interface_frame");
gtk_widget_set_visible(w, TRUE);
GtkWidget *w = widget_from_builder("acedrg_link_interface_frame");
gtk_widget_set_visible(w, TRUE);

// what is the residue at the centre of the screen?
// Fill the comboboxes dependent on that

std::pair<bool, std::pair<int, coot::atom_spec_t> > pp = active_atom_spec();
if (pp.first) {
int imol = pp.second.first;
const auto &atom_spec = pp.second.second;
auto res_spec = coot::residue_spec_t(atom_spec);
std::string rn = graphics_info_t::molecules[imol].get_residue_name(res_spec);
if (graphics_info_t::Geom_p()) {
if (! rn.empty()) {
std::pair<bool, coot::dictionary_residue_restraints_t> p =
graphics_info_t::Geom_p()->get_monomer_restraints(rn, imol);
if (p.first) {
GtkWidget *entry = widget_from_builder("acedrg_link_first_residue_name_entry");
GtkWidget *combobox = widget_from_builder("acedrg_link_first_atom_name_chooser_combobox");
if (entry) {
if (combobox) {
std::cout << "add " << rn << " to " << entry << std::endl;
gtk_editable_set_text(GTK_EDITABLE(entry), rn.c_str());
const auto &rest = p.second;
const std::vector<coot::dict_atom> &atoms = rest.atom_info;
gtk_cell_layout_clear(GTK_CELL_LAYOUT(combobox));
for(const auto &atom : atoms) {
const std::string &atom_name = atom.atom_id_4c;
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), atom_name.c_str());
}
}
}
}
}
} else {
std::cout << "ERROR:: Geom_p() is null" << std::endl;
}
}

}

44 changes: 40 additions & 4 deletions src/glade-callbacks-main-window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,46 @@ void
on_acedrg_link_ok_button_clicked(GtkButton *button,
gpointer user_data) {

std::cout << "OK - now do something" << std::endl;
GtkWidget *w = widget_from_builder("acedrg_link_interface_frame");
gtk_widget_set_visible(w, FALSE);

std::cout << "OK - now do something" << std::endl;
GtkWidget *w = widget_from_builder("acedrg_link_interface_frame");
gtk_widget_set_visible(w, FALSE);

GtkWidget *entry_first = widget_from_builder("acedrg_link_first_residue_name_entry");
GtkWidget *atom_name_combobox_first = widget_from_builder("acedrg_link_first_atom_name_chooser_combobox");
GtkWidget *delete_atom_checkbutton_first = widget_from_builder("acedrg_link_first_delete_atom_checkbutton");
GtkWidget *delete_atom_combobox_first = widget_from_builder("acedrg_link_first_delete_atom_chooser_combobox");
GtkWidget *change_bond_order_checkbutton_first = widget_from_builder("acedrg_link_first_change_bond_order_checkbutton");
GtkWidget *change_bond_order_combobox_first = widget_from_builder("acedrg_link_first_change_bond_order_combobox");

GtkWidget *entry_second = widget_from_builder("acedrg_link_second_residue_name_entry");
GtkWidget *atom_name_combobox_second = widget_from_builder("acedrg_link_second_atom_name_chooser_combobox");
GtkWidget *delete_atom_checkbutton_second = widget_from_builder("acedrg_link_second_delete_atom_checkbutton");
GtkWidget *delete_atom_combobox_second = widget_from_builder("acedrg_link_second_delete_atom_chooser_combobox");
GtkWidget *change_bond_order_checkbutton_second = widget_from_builder("acedrg_link_second_change_bond_order_checkbutton");
GtkWidget *change_bond_order_combobox_second = widget_from_builder("acedrg_link_second_change_bond_order_combobox");

if (entry_first && atom_name_combobox_first && delete_atom_combobox_first && delete_atom_checkbutton_first) {
if (change_bond_order_combobox_first && change_bond_order_checkbutton_first) {
if (entry_second && atom_name_combobox_second && delete_atom_combobox_second && delete_atom_checkbutton_second) {
if (change_bond_order_combobox_second && change_bond_order_checkbutton_second) {
bool change_bond_order_first = false;
bool change_bond_order_second = false;
if (gtk_check_button_get_active(GTK_CHECK_BUTTON(change_bond_order_checkbutton_first))) change_bond_order_first = true;
if (gtk_check_button_get_active(GTK_CHECK_BUTTON(change_bond_order_checkbutton_second))) change_bond_order_second = true;
bool delete_atom_first = false;
bool delete_atom_second = false;
if (gtk_check_button_get_active(GTK_CHECK_BUTTON(delete_atom_checkbutton_first))) change_bond_order_first = true;
if (gtk_check_button_get_active(GTK_CHECK_BUTTON(delete_atom_checkbutton_second))) change_bond_order_second = true;
std::string residue_name_first = gtk_editable_get_text(GTK_EDITABLE(entry_first));
std::string residue_name_second = gtk_editable_get_text(GTK_EDITABLE(entry_second));
char *da_first = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(delete_atom_combobox_first);
char *da_second = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(delete_atom_combobox_second);
char *cbo_first = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(change_bond_order_first);
char *cbo_second = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(change_bond_order_second);
}
}
}
}
}

extern "C" G_MODULE_EXPORT
Expand Down
4 changes: 3 additions & 1 deletion src/new-startup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ new_startup_application_activate(GtkApplication *application,
};

graphics_info_t graphics_info;
graphics_info.init(); // added 20241231

// use this to look up things - and it is used to attach the lidia
// application window
Expand All @@ -837,7 +838,8 @@ new_startup_application_activate(GtkApplication *application,
// but let's do it once at least!

// this is done in the python startup now.
// std::cout << "#################### new_startup_application_activate() calling graphics_info.init() " << std::endl;
// std::cout << "#################### new_startup_application_activate() calling graphics_info.init() "
// << std::endl;
// graphics_info.init();

GtkBuilder *builder = gtk_builder_new();
Expand Down

0 comments on commit bd24979

Please sign in to comment.