From 5ae8201dbefdbd69741a2009704443655f98045a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 30 Apr 2021 16:19:59 +0200 Subject: GUI: Take optional stream on command line Closes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/12 --- src/crystfel_gui.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/crystfel_gui.c') 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; -- cgit v1.2.3