diff options
author | Thomas White <taw@physics.org> | 2021-04-30 16:19:59 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-04-30 16:19:59 +0200 |
commit | 5ae8201dbefdbd69741a2009704443655f98045a (patch) | |
tree | 7073bff0dc0786f1200fa6b174b1363d89c50522 /src/crystfel_gui.c | |
parent | 7d4eff3ab922d7f4929a244b373f77e0a795745b (diff) |
GUI: Take optional stream on command line
Closes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/12
Diffstat (limited to 'src/crystfel_gui.c')
-rw-r--r-- | src/crystfel_gui.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index 8bd2abed..aef5cd1a 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -63,7 +63,7 @@ static void show_help(const char *s) { - printf("Syntax: %s\n\n", s); + printf("Syntax: %s [data.stream]\n\n", s); printf( "CrystFEL graphical user interface.\n" "\n" @@ -724,6 +724,7 @@ int main(int argc, char *argv[]) GtkWidget *button; GtkWidget *label; GtkWidget *w; + int load_result; /* Long options */ const struct option longopts[] = { @@ -904,8 +905,15 @@ int main(int argc, char *argv[]) /* Send messages to report region */ set_log_message_func(add_gui_message, &proj); - /* Load state from disk */ - if ( load_project(&proj) == 0 ) { + if ( optind < argc ) { + /* Create view of stream - probably temporary */ + load_result = load_stream(&proj, argv[optind++]); + } else { + /* Try to load state from disk */ + load_result = load_project(&proj); + } + + if ( load_result == 0 ) { DataTemplate *dtempl; GtkAction *w; proj.cur_frame = 0; |