aboutsummaryrefslogtreecommitdiff
path: root/src/crystfel_gui.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-03-03 14:03:07 +0100
committerThomas White <taw@physics.org>2020-07-29 18:42:24 +0200
commitb9cc588d4bbec303859c68ed7c2caa1f7f2fa0e4 (patch)
tree9a5e2c7ed979e5f108af440b2781c73734cf967e /src/crystfel_gui.c
parent0cc363a630b80f44fa1367cb50fcd9f2f1669e2d (diff)
Add "Find data" dialogue box
Diffstat (limited to 'src/crystfel_gui.c')
-rw-r--r--src/crystfel_gui.c79
1 files changed, 78 insertions, 1 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 10070e38..0b86ab5d 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -92,6 +92,83 @@ static void add_ui_sig(GtkUIManager *ui, GtkWidget *widget,
}
+static void finddata_response_sig(GtkWidget *dialog, gint resp,
+ struct crystfelproject *proj)
+{
+ if ( (resp==GTK_RESPONSE_DELETE_EVENT) || (resp==GTK_RESPONSE_CANCEL) ) {
+ gtk_widget_destroy(dialog);
+ return;
+ }
+}
+
+
+static gint finddata_sig(GtkWidget *widget, struct crystfelproject *proj)
+{
+ GtkWidget *dialog;
+ GtkWidget *content_area;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkWidget *chooser;
+ GtkWidget *combo;
+
+ dialog = gtk_dialog_new_with_buttons("Find data files",
+ GTK_WINDOW(proj->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ "Cancel", GTK_RESPONSE_CANCEL,
+ "Find data", GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ vbox = gtk_vbox_new(FALSE, 0.0);
+ content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+ gtk_container_add(GTK_CONTAINER(content_area), vbox);
+
+ hbox = gtk_hbox_new(FALSE, 0.0);
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 8.0);
+ label = gtk_label_new("Find data in folder:");
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 2.0);
+ chooser = gtk_file_chooser_button_new("Select a folder",
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(chooser), TRUE, TRUE, 2.0);
+
+ hbox = gtk_hbox_new(FALSE, 0.0);
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 8.0);
+ label = gtk_label_new("Search pattern:");
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 2.0);
+ combo = gtk_combo_box_text_new();
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(combo), TRUE, TRUE, 2.0);
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "everything",
+ "All files in folder and subfolders");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "lcls-cheetah-hdf5",
+ "LCLS, individual files from Cheetah ('LCLS*.h5')");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "lcls-cheetah-cxi",
+ "Multi-event CXI files from Cheetah ('*.cxi')");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "cbf",
+ "Individual CBF files ('*.cbf')");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "cbfgz",
+ "Individual gzipped CBF files ('*.cbf.gz')");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+
+ hbox = gtk_hbox_new(FALSE, 0.0);
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 8.0);
+ label = gtk_label_new("Geometry file:");
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 2.0);
+ chooser = gtk_file_chooser_button_new("Select geometry file",
+ GTK_FILE_CHOOSER_ACTION_OPEN);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(chooser), TRUE, TRUE, 2.0);
+
+ g_signal_connect(dialog, "response",
+ G_CALLBACK(finddata_response_sig), proj);
+
+ gtk_window_set_default_size(GTK_WINDOW(dialog), 512, 0);
+ gtk_widget_show_all(dialog);
+ return FALSE;
+}
+
+
static gint quit_sig(GtkWidget *widget, struct crystfelproject *proj)
{
gtk_main_quit();
@@ -288,7 +365,7 @@ static void add_button(GtkWidget *vbox, const char *label, const char *imagen,
static void add_task_buttons(GtkWidget *vbox, struct crystfelproject *proj)
{
add_button(vbox, "Find data", "folder-pictures",
- G_CALLBACK(NULL), proj);
+ G_CALLBACK(finddata_sig), proj);
add_button(vbox, "Peak detection", "edit-find",
G_CALLBACK(NULL), proj);
add_button(vbox, "Determine unit cell", "document-page-setup",