Example #1
0
def _pluginUnloaded(*args):

    if len(args) > 1:
        # 2009 API callback, the args are
        # ( [ pluginName, pathToPlugin ], clientData )  OR
        # ( [ pathToPlugin ], clientData )
        pluginName = args[0][0]
    else:
        pluginName = args[0]

    _logger.debug("Plugin unloaded: %s" % pluginName)
    
    try:
        data = _pluginData.pop(pluginName)
    except KeyError:
        pass
    else:
        # Commands
        commands = data.pop('commands', [])
        if commands:
            _logger.debug("Removing commands: %s", ', '.join( commands ))
            for command in commands:
                try:
                    _pmcmds.removeWrappedCmd(command)
                    _module.__dict__.pop(command)
                except KeyError:
                    _logger.warn( "Failed to remove %s from module %s" % (command, _module.__name__) )

        # Nodes
        nodes = data.pop('dependNodes', [])
        if nodes:
            _logger.debug("Removing nodes: %s" % ', '.join( nodes ))
            for node in nodes:
                _factories.removePyNode( nodetypes, node )
Example #2
0
def _removePluginCommand(pluginName, command):
    global _pluginData

    commands = _pluginData.get(pluginName, {}).get('commands', [])
    if command in commands:
        commands.remove(command)
    try:
        _pmcmds.removeWrappedCmd(command)
        _module.__dict__.pop(command, None)
    except KeyError:
        _logger.warn( "Failed to remove %s from module %s" % (command, _module.__name__) )
Example #3
0
def _removePluginCommand(pluginName, command):
    global _pluginData

    commands = _pluginData.get(pluginName, {}).get('commands', [])
    if command in commands:
        commands.remove(command)
    try:
        _pmcmds.removeWrappedCmd(command)
        _module.__dict__.pop(command, None)
    except KeyError:
        _logger.warn("Failed to remove %s from module %s" % (command, _module.__name__))