diff options
author | Thomas White <taw@physics.org> | 2021-05-11 11:14:54 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-05-11 11:14:54 +0200 |
commit | 1d362a2b6455049d8f593094265492097e530c8d (patch) | |
tree | 7a581a8eff55dbc84282dd0daed4f45367707f3b /src | |
parent | d22d7a79c3cded54dd9203622ee0071bdcea8527 (diff) |
GUI: Ensure that streams get re-scanned after job termination
Previously, they would not get scanned because no job was running. We
need one more scan after a job exits to make sure everything is up to
date.
Diffstat (limited to 'src')
-rw-r--r-- | src/crystfel_gui.c | 17 | ||||
-rw-r--r-- | src/gui_project.c | 1 | ||||
-rw-r--r-- | src/gui_project.h | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index aef5cd1a..1246924b 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -169,14 +169,19 @@ const char *selected_result(struct crystfelproject *proj) } -/* Return non-zero if there are any jobs running. - * If not, it makes no sense to re-scan any result streams. +/* Return non-zero if it makes sense to re-scan the streams for results. + * e.g. if there are any jobs running, or one finished since the last scan. * Possible future improvement: exclude jobs which don't produce streams * (i.e. merging) */ -static int have_running_jobs(struct crystfelproject *proj) +static int should_rescan_streams(struct crystfelproject *proj) { GSList *item = proj->tasks; + if ( !proj->scanned_since_last_job_finished ) { + proj->scanned_since_last_job_finished = 1; + return 1; + } + while ( item != NULL ) { struct gui_task *task = item->data; if ( task->running ) return 1; @@ -251,7 +256,7 @@ void update_imageview(struct crystfelproject *proj) results_name, proj->filenames[proj->cur_frame], proj->events[proj->cur_frame], - have_running_jobs(proj)); + should_rescan_streams(proj)); if ( res_im != NULL ) { swap_data_arrays(image, res_im); image_free(proj->cur_image); @@ -1046,6 +1051,9 @@ static gboolean update_info_bar(gpointer data) gtk_widget_destroy(task->cancel_button); gtk_info_bar_set_show_close_button(GTK_INFO_BAR(task->info_bar), TRUE); + + task->proj->scanned_since_last_job_finished = 0; + return G_SOURCE_REMOVE; } @@ -1068,6 +1076,7 @@ void add_running_task(struct crystfelproject *proj, task->job_priv = job_priv; task->backend = backend; task->running = 1; + task->proj = proj; proj->tasks = g_slist_append(proj->tasks, task); /* Progress info bar */ diff --git a/src/gui_project.c b/src/gui_project.c index d0bf66db..7229cbcd 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -1105,6 +1105,7 @@ void default_project(struct crystfelproject *proj) proj->merging_opts = NULL; proj->ambi_opts = NULL; proj->tasks = NULL; + proj->scanned_since_last_job_finished = 0; proj->indexing_new_job_title = NULL; proj->merging_new_job_title = NULL; proj->ambi_new_job_title = NULL; diff --git a/src/gui_project.h b/src/gui_project.h index d698e720..c75f36e2 100644 --- a/src/gui_project.h +++ b/src/gui_project.h @@ -244,6 +244,7 @@ struct gui_task GtkWidget *progress_bar; int running; struct crystfel_backend *backend; + struct crystfelproject *proj; void *job_priv; }; @@ -312,6 +313,7 @@ struct crystfelproject { int n_backends; GSList *tasks; + int scanned_since_last_job_finished; struct gui_indexing_result *results; int n_results; |