Creating and Starting the App

Two functions defined at the end of the gui module are called to initialize and start the GUI.

make_app

Instantiate the top level widget, load data from the data files.

Parameters:
  • args –

    command line arguments (including names of data files)

Returns:
  • –

    a PeakViewerApp object

Source code in src/xo/gui.py
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
def make_app(args):
    """
    Instantiate the top level widget, load data from the data files.

    Arguments:
      args: command line arguments (including names of data files)

    Returns:
        a PeakViewerApp object
    """
    c = Config()

    app = PeakViewerApp(
        title='NCO Explorer', 
        sidebar_width=c.sidebar_width,
    )
    app.load_data(args)
    if args.log != 'quiet':
        logging.getLogger('bokeh').setLevel(logging.ERROR)
    return app

start_app

Main entry point, called from the top level xo script.

Initialize the Panel library, instantiate the app, and pass the app to the server.

Source code in src/xo/gui.py
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
def start_app(args):
    """
    Main entry point, called from the top level `xo` script.

    Initialize the Panel library, instantiate the app, and pass
    the app to the server.
    """
    pn.extension(design='native')
    pn.config.throttled = True
    try:
        app = make_app(args)
        pn.serve( 
            app,
            port = args.port,
            verbose = True,
            autoreload = True,
            websocket_origin= '*',
        )
    except Exception as err:
        logging.exception(err)