from blissoda.bliss_globals import setup_globals

from .itest_bm02 import bm02_demo_1d
from .itest_bm02 import bm02_demo_1d_with_cell_subtraction
from .itest_bm02 import bm02_demo_2d
from .itest_bm08 import bm08_demo
from .itest_ewoks_macros import ewoks_macro_demo
from .itest_exafs import exafs_demo
from .itest_exafs_bm08 import bm08_exafs_demo
from .itest_fluo import fluo_demo
from .itest_id01 import id01_cdi_demo
from .itest_id09 import id09_demo
from .itest_id11 import id11_demo
from .itest_id12 import id12_demo
from .itest_id14 import id14_demo
from .itest_id22 import id22_stscan_demo
from .itest_id32 import id32_specgen_demo
from .itest_stop_scan import stop_scan_demo
from .itest_stop_scan_xrpd_id31 import stop_scan_pyfai_demo
from .itest_streamline import streamline_demo
from .itest_streamline_id31 import id31_streamline_demo
from .itest_template import template_demo
from .itest_xrpd import xrpd_demo_1d
from .itest_xrpd import xrpd_demo_2d
from .itest_xrpd_id22 import id22_xrpd_demo
from .itest_xrpd_id31 import id31_xrpd_demo


def all_demo():
    print()
    print("===================")
    template_demo()

    print()
    print("===================")
    setup_globals.newcollection("xrpd_1d_collection")
    xrpd_demo_1d()

    print()
    print("===================")
    setup_globals.newcollection("xrpd_2d_collection")
    xrpd_demo_2d()

    print()
    print("===================")
    setup_globals.newcollection("streamline_collection")
    streamline_demo()

    print()
    print("===================")
    setup_globals.newcollection("streamline_id31_collection")
    id31_streamline_demo()

    print()
    print("===================")
    setup_globals.newcollection("bm02_collection")
    bm02_demo_1d()
    bm02_demo_1d_with_cell_subtraction()
    bm02_demo_2d()

    print()
    print("===================")
    setup_globals.newcollection("id22_stscan_collection")
    id22_stscan_demo()

    print()
    print("===================")
    setup_globals.newcollection("id22_xrpd_collection")
    id22_xrpd_demo()

    print()
    print("===================")
    setup_globals.newcollection("id11_collection")
    id11_demo()

    print()
    print("===================")
    setup_globals.newcollection("macro_collection")
    ewoks_macro_demo()

    print()
    print("===================")
    setup_globals.newcollection("id14_collection")
    id14_demo()

    print()
    print("===================")
    setup_globals.newcollection("id12_collection")
    id12_demo()

    print()
    print("===================")
    setup_globals.newcollection("bm08_collection")
    bm08_demo()

    print()
    print("===================")
    setup_globals.newcollection("fluo_collection")
    fluo_demo()

    print()
    print("===================")
    setup_globals.newcollection("id09_collection")
    id09_demo()

    print()
    print("===================")
    setup_globals.newcollection("id31_collection")
    id31_xrpd_demo()

    print()
    print("===================")
    setup_globals.newcollection("id01_collection")
    id01_cdi_demo()

    print()
    print("===================")
    setup_globals.newcollection("id32_collection")
    id32_specgen_demo()

    # TODO: ewoksxrpd needs to be imported before xraylarch?
    #       Cannot load backend 'Qt5Agg' which requires the 'qt' interactive framework, as 'headless' is currently running
    print()
    print("===================")
    setup_globals.newcollection("exafs_collection")
    exafs_demo()

    print()
    print("===================")
    setup_globals.newcollection("bm08_exafs_collection")
    bm08_exafs_demo()

    print()
    print("===================")
    setup_globals.newcollection("stop_scan_pyfai_collection")
    stop_scan_pyfai_demo()

    print()
    print("===================")
    setup_globals.newcollection("stop_scan_collection")
    stop_scan_demo()

    print()
    print("===================")
    setup_globals.newcollection("done_collection")

    print()
    print("SUCCESS: all demos can be executed")
