Exemple #1
0
def init_pre_spock(ip, macro_server, door):
    so = IPython.ipstruct.Struct()
    full_door_tg_name, door_tg_name, door_tg_alias = from_name_to_tango(door)
    #macro_server = get_ms_for_door(door_tg_name)
    full_ms_tg_name, ms_tg_name, ms_tg_alias = from_name_to_tango(macro_server)
    ip.user_ns['MACRO_SERVER_NAME'] = full_ms_tg_name
    ip.user_ns['MACRO_SERVER_ALIAS'] = ms_tg_alias or ms_tg_name
    ip.user_ns['DOOR_NAME'] = full_door_tg_name
    ip.user_ns['DOOR_ALIAS'] = door_tg_alias or door_tg_name
    ip.user_ns['DOOR_STATE'] = ""
    ip.user_ns['spock_options'] = so

    if ip.IP.alias_table.has_key('mv'):
        del ip.IP.alias_table['mv']

    v = release.version
    alias = ip.user_ns['DOOR_ALIAS']
    profile = ip.user_ns['PROFILE']

    so.spock_banner = """\
{Blue}Spock's sardana extension %s loaded with profile: %s (linked to door '%s'){Normal}
""" % (v, profile, alias)

    # the CodecFactory is not thread safe. There are two attributes who will
    # request for it in the first event at startup in different threads
    # therefore this small hack: make sure CodecFactory is initialized.
    CodecFactory()

    factory = Factory()

    import sardana.spock.spockms
    macroserver = sardana.spock.spockms

    factory.registerDeviceClass('MacroServer', macroserver.SpockMacroServer)

    mode = get_gui_mode()
    if mode == 'qt':
        factory.registerDeviceClass('Door', macroserver.QSpockDoor)
    else:
        factory.registerDeviceClass('Door', macroserver.SpockDoor)

    door = get_door()
    macro_server = get_macro_server()

    # Initialize the environment
    expose_variable(ENV_NAME, macro_server.getEnvironment())
Exemple #2
0
def init_pre_spock(ip, macro_server, door):
    so = IPython.ipstruct.Struct()
    full_door_tg_name, door_tg_name, door_tg_alias = from_name_to_tango(door)
    #macro_server = get_ms_for_door(door_tg_name)
    full_ms_tg_name, ms_tg_name, ms_tg_alias = from_name_to_tango(macro_server)
    ip.user_ns['MACRO_SERVER_NAME'] = full_ms_tg_name
    ip.user_ns['MACRO_SERVER_ALIAS'] = ms_tg_alias or ms_tg_name
    ip.user_ns['DOOR_NAME'] = full_door_tg_name
    ip.user_ns['DOOR_ALIAS'] = door_tg_alias or door_tg_name
    ip.user_ns['DOOR_STATE'] = ""
    ip.user_ns['spock_options'] = so
    
    if ip.IP.alias_table.has_key('mv'):
        del ip.IP.alias_table['mv']
    
    v = release.version
    alias = ip.user_ns['DOOR_ALIAS']
    profile = ip.user_ns['PROFILE']
    
    so.spock_banner = """\
{Blue}Spock's sardana extension %s loaded with profile: %s (linked to door '%s'){Normal}
""" % (v, profile, alias)

    # the CodecFactory is not thread safe. There are two attributes who will
    # request for it in the first event at startup in different threads
    # therefore this small hack: make sure CodecFactory is initialized.
    CodecFactory()
    
    factory = Factory()

    import sardana.spock.spockms
    macroserver = sardana.spock.spockms

    factory.registerDeviceClass('MacroServer', macroserver.SpockMacroServer)
    
    mode = get_gui_mode()
    if mode == 'qt':
        factory.registerDeviceClass('Door', macroserver.QSpockDoor)
    else:
        factory.registerDeviceClass('Door', macroserver.SpockDoor)
    
    door = get_door()
    macro_server = get_macro_server()
    
    # Initialize the environment
    expose_variable(ENV_NAME, macro_server.getEnvironment())
Exemple #3
0
def init_taurus():
    # the CodecFactory is not thread safe. There are two attributes who will
    # request for it in the first event at startup in different threads
    # therefore this small hack: make sure CodecFactory is initialized.
    CodecFactory()

    factory = Factory()

    import sardana.spock.spockms
    macroserver = sardana.spock.spockms

    factory.registerDeviceClass('MacroServer', macroserver.SpockMacroServer)

    mode = get_gui_mode()
    if mode == 'qt':
        factory.registerDeviceClass('Door', macroserver.QSpockDoor)
    else:
        factory.registerDeviceClass('Door', macroserver.SpockDoor)
Exemple #4
0
def init_taurus():
    # the CodecFactory is not thread safe. There are two attributes who will
    # request for it in the first event at startup in different threads
    # therefore this small hack: make sure CodecFactory is initialized.
    CodecFactory()

    factory = Factory()

    import sardana.spock.spockms
    macroserver = sardana.spock.spockms

    factory.registerDeviceClass('MacroServer', macroserver.SpockMacroServer)

    mode = get_gui_mode()
    if mode == 'qt':
        factory.registerDeviceClass('Door', macroserver.QSpockDoor)
    else:
        factory.registerDeviceClass('Door', macroserver.SpockDoor)