aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-03-04 13:58:42 +0100
committerThomas White <taw@physics.org>2022-03-04 13:58:42 +0100
commit1deed95e55c5a45d4887bb53a83976e4ead78bcb (patch)
tree98900bf5f5173985f9fc244783651678bf4aa124 /src
parent634ac34f8ffde1d3991751230c57eba70529f005 (diff)
GUI: Fix stream rescan logic
Fixes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/64
Diffstat (limited to 'src')
-rw-r--r--src/crystfel_gui.c15
-rw-r--r--src/gui_project.c10
-rw-r--r--src/gui_project.h2
3 files changed, 18 insertions, 9 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 31f2b4d2..daf9172f 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -180,11 +180,6 @@ static int should_rescan_streams(struct crystfelproject *proj)
if ( !proj->rescan_on_change ) return 0;
- 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;
@@ -1249,13 +1244,21 @@ static gboolean update_info_bar(gpointer data)
frac_complete);
if ( !running && task->running ) {
+
+ int i;
+
/* Task is no longer running */
task->running = 0;
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;
+ /* We don't have an easy way to get the result name from the
+ * task structure, so cheat by marking all of the results as
+ * "possibly out of date" */
+ for ( i=0; i<task->proj->n_results; i++ ) {
+ task->proj->results[i].need_rescan = 1;
+ }
return G_SOURCE_REMOVE;
}
diff --git a/src/gui_project.c b/src/gui_project.c
index 16b8b8fc..59f9852a 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -1207,7 +1207,6 @@ int 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;
@@ -1362,6 +1361,7 @@ int add_indexing_result(struct crystfelproject *proj,
new_results[proj->n_results].name = strdup(name);
new_results[proj->n_results].streams = malloc(n_streams*sizeof(char *));
new_results[proj->n_results].n_streams = n_streams;
+ new_results[proj->n_results].need_rescan = 0;
new_results[proj->n_results].indices = malloc(n_streams*sizeof(StreamIndex *));
for ( i=0; i<n_streams; i++ ) {
@@ -1461,6 +1461,11 @@ struct image *find_indexed_image(struct crystfelproject *proj,
result = find_indexing_result_by_name(proj, results_name);
if ( result == NULL ) return NULL;
+ if ( !ever_scanned(result) ) {
+ update_result_index(result);
+ result->need_rescan = 0;
+ }
+
for ( i=0; i<result->n_streams; i++ ) {
if ( stream_select_chunk(NULL,
result->indices[i],
@@ -1472,9 +1477,10 @@ struct image *find_indexed_image(struct crystfelproject *proj,
}
}
- if ( !found && (permit_rescan || !ever_scanned(result)) ) {
+ if ( !found && (result->need_rescan || permit_rescan) ) {
/* Re-scan and try again */
update_result_index(result);
+ result->need_rescan = 0;
for ( i=0; i<result->n_streams; i++ ) {
if ( stream_select_chunk(NULL,
result->indices[i],
diff --git a/src/gui_project.h b/src/gui_project.h
index f034e125..8ec81ee2 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -149,6 +149,7 @@ struct gui_indexing_result
int n_streams;
char **streams;
StreamIndex **indices;
+ int need_rescan;
};
struct gui_merge_result
@@ -328,7 +329,6 @@ struct crystfelproject {
int n_backends;
GSList *tasks;
- int scanned_since_last_job_finished;
struct gui_indexing_result *results;
int n_results;