From c967e898771711498964016a93f2530ba0e0dbe9 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 19 Feb 2021 11:29:08 +0100 Subject: GUI: Don't re-scan streams so often It only makes sense to re-scan if there is a job running, but this also adds a manual re-scan button for rare exceptions. --- src/gui_project.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/gui_project.c') diff --git a/src/gui_project.c b/src/gui_project.c index abc80276..29d4ceb3 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -1230,17 +1230,12 @@ struct gui_merge_result *find_merge_result_by_name(struct crystfelproject *proj, } -static void update_result_index(struct gui_indexing_result *result) +void update_result_index(struct gui_indexing_result *result) { int i; - for ( i=0; in_streams; i++ ) { - - /* FIXME: Skip if already up to date */ - stream_index_free(result->indices[i]); result->indices[i] = stream_make_index(result->streams[i]); - } } @@ -1259,10 +1254,17 @@ struct gui_indexing_result *find_indexing_result_by_name(struct crystfelproject } +static int ever_scanned(struct gui_indexing_result *result) +{ + return ( result->indices[0] != NULL ); +} + + struct image *find_indexed_image(struct crystfelproject *proj, const char *results_name, const char *filename, - const char *event) + const char *event, + int permit_rescan) { Stream *st; int i; @@ -1284,7 +1286,8 @@ struct image *find_indexed_image(struct crystfelproject *proj, } } - if ( !found ) { + if ( !found && (permit_rescan || !ever_scanned(result)) ) { + /* Re-scan and try again */ update_result_index(result); for ( i=0; in_streams; i++ ) { if ( stream_select_chunk(NULL, -- cgit v1.2.3