예제 #1
0
def initialize(pmgapp=-1):
    '''
    Searches for plugins and registers them.

    pmgapp == -2: No Autoloading
    pmgapp == -1: Autoloading but no legacyinit
    else:         Autoloading and legacyinit
    '''

    # check for obsolete development version of pymolplugins
    if 'pymolplugins' in sys.modules:
        from .legacysupport import tkMessageBox
        tkMessageBox.showwarning(
            'WARNING',
            '"pymolplugins" now integrated into PyMOL as "pymol.plugins"! '
            'Please remove the old pymolplugins module and delete ~/.pymolrc_plugins.py'
        )

    if os.path.exists(PYMOLPLUGINSRC):
        from pymol import parsing
        try:
            parsing.run_file(PYMOLPLUGINSRC, {'__script__': PYMOLPLUGINSRC},
                             {})
        except SyntaxError as e:
            colorprinting.warning(str(e))

    autoload = (pmgapp != -2)
    for parent in [startup]:
        modules = findPlugins(parent.__path__)

        for name, filename in modules.items():
            mod_name = parent.__name__ + '.' + name
            info = PluginInfo(name, filename, mod_name)
            if autoload and info.autoload:
                info.load(pmgapp)
예제 #2
0
def initialize(pmgapp=-1):
    '''
    Searches for plugins and registers them.

    pmgapp == -2: No Autoloading
    pmgapp == -1: Autoloading but no legacyinit
    else:         Autoloading and legacyinit
    '''

    # check for obsolete development version of pymolplugins
    if 'pymolplugins' in sys.modules:
        from .legacysupport import tkMessageBox
        tkMessageBox.showwarning('WARNING',
                '"pymolplugins" now integrated into PyMOL as "pymol.plugins"! '
                'Please remove the old pymolplugins module and delete ~/.pymolrc_plugins.py')

    if os.path.exists(PYMOLPLUGINSRC):
        from pymol import parsing
        parsing.run_file(PYMOLPLUGINSRC, {'__script__': PYMOLPLUGINSRC}, {})

    autoload = (pmgapp != -2)
    for parent in [startup]:
        modules = findPlugins(parent.__path__)

        for name, filename in modules.items():
            mod_name = parent.__name__ + '.' + name
            info = PluginInfo(name, filename, mod_name)
            if autoload and info.autoload:
                info.load(pmgapp)
예제 #3
0
def initialize(pmgapp=-1):
    '''
    Searches for plugins and registers them.

    pmgapp == -2: No Autoloading
    pmgapp == -1: Autoloading but no legacyinit
    else:         Autoloading and legacyinit
    '''
    if os.path.exists(PYMOLPLUGINSRC):
        from pymol import parsing
        try:
            parsing.run_file(PYMOLPLUGINSRC, {'__script__': PYMOLPLUGINSRC},
                             {})
        except SyntaxError as e:
            colorprinting.warning(str(e))

    autoload = (pmgapp != -2)
    for parent in [startup]:
        modules = findPlugins(parent.__path__)

        for name, filename in modules.items():
            mod_name = parent.__name__ + '.' + name
            info = PluginInfo(name, filename, mod_name)
            if autoload and info.autoload:
                info.load(pmgapp)