Esempio n. 1
0
            'ItckOutDiag': diags_device,
            'ItckOutDisable': diags_device,
            'Landau': diags_device,
            'ManualTuning': loops_device,
            'Ramping': loops_device,
            'RampingDiag': loops_device,
            'Start': [loops_device, diags_device],
            'TuningDiag': loops_device,
            'Vcxo': loops_device,
            'PolarDiag': loops_device,
            'FIM': diags_device,
        }
    return models_dict


def create_panels():
    """Create panels and set application name."""
    for widget in models_dict:
        name = '{0}'.format(widget)
        globals()[name] = PanelDescription(
            name,
            classname=name,
            modulename='llrfgui.widgets.' + name.lower(),
            model=models_dict[name]
        )
# :todo: fix this and set it in a __main__ or add all
#       this functions in another library, and don't include it in the doc.
loops, diags = get_model()
models_dict = get_models_dict(loops, diags)
create_panels()
Esempio n. 2
0
def run(period=PERIOD):
    """Run LLRF expert GUI."""
    import taurus.core.util.argparse as argparse
    parser = argparse.get_taurus_parser()
    parser.set_usage("%prog [-e, --expert]")
    description_message = "Graphical User Interface to control a LLRF system."
    parser.set_description(description_message)
    parser.add_option('-e', '--expert', action='store_true',
                      help="Launch the GUI in expert mode")

    parser.add_option('-r', '--rf_room', type=str,
                      help="""RF Room to be controlled.
                              \nAvailable options:
                              \n  RF-ROOM-1,RF-ROOM-2,RF-ROOM-3, R1, RF-LAB
                           """)

    parser, options, args = argparse.init_taurus_args(parser=parser)

    # set_polling_period(period)

    import taurus
    taurus.Manager().changeDefaultPollingPeriod(period)
    configure_pythonpath()

    if options.expert:
        models = get_model(options.expert, options.rf_room)
        section, loops, diags, rftrans1, rftrans2 = models
        llrf = None
        llrfdiags = None
    else:
        models = get_model(options.expert, options.rf_room)
        section, loops, diags, llrf, llrfdiags, rftrans1, rftrans2 = models

    app_name = create_app_name(section, options.expert)
    app, gui = create_application(app_name, parser=parser)

    splashLogo = os.path.join(os.path.dirname(__file__),
                              'images/maxivlogo.png')
    splashscreen = Qt.QSplashScreen(Qt.QPixmap(splashLogo))
    splashscreen.show()
    app.processEvents()

    hide_toolbars(gui)

    splashscreen.showMessage('Creating panels')
    create_panels(
        splashscreen=splashscreen,
        gui=gui,
        section=section,
        loops_device=loops,
        diags_device=diags,
        is_expert=options.expert,
        transmitter1=rftrans1,
        transmitter2=rftrans2,
        llrf_device=llrf,
        llrfdiags_device=llrfdiags)
    splashscreen.showMessage('Loading settings')
    load_settings(gui, options.expert)

    gui.show()
    splashscreen.finish(gui)
    sys.exit(app.exec_())