Пример #1
0
    def load_plugins(self):
        with open('plugins.txt') as file:
            txt = file.read()

        for line in txt.splitlines():
            if line and not line.startswith('//'):
                self.add_plugin(line, plugins.get_plugin(line)())
Пример #2
0
async def reload(message: discord.Message, *names: str.lower):
    """ Reloads all plugins or the specified plugin. """
    if names:
        reloaded = []
        for name in names:
            if not plugins.get_plugin(name):
                await client.say(message, "`{}` is not a plugin.".format(name))
                continue

            # The plugin entered is valid so we reload it
            await plugins.save_plugin(name)
            await plugins.call_reload(name)
            reloaded.append(name)

        if reloaded:
            await client.say(message, "Reloaded plugin{} `{}`.".format(
                "s" if len(reloaded) > 1 else "", ", ".join(reloaded)))
    else:
        # Reload all plugins
        await plugins.save_plugins()

        for plugin_name in plugins.all_keys():
            await plugins.call_reload(plugin_name)

        await client.say(message, "All plugins reloaded.")
Пример #3
0
async def reload(message: discord.Message, *names: str.lower):
    """ Reloads all plugins or the specified plugin. """
    if names:
        reloaded = []
        for name in names:
            if not plugins.get_plugin(name):
                await client.say(message, "`{}` is not a plugin.".format(name))
                continue

            # The plugin entered is valid so we reload it
            await plugins.save_plugin(name)
            plugins.reload_plugin(name)
            reloaded.append(name)

        if reloaded:
            await client.say(message, "Reloaded plugin{} `{}`.".format(
                "s" if len(reloaded) > 1 else "", ", ".join(reloaded)))
    else:
        # Reload all plugins
        await plugins.save_plugins()

        for plugin_name in plugins.all_keys():
            plugins.reload_plugin(plugin_name)

        await client.say(message, "All plugins reloaded.")
Пример #4
0
async def unload(message: discord.Message, name: str.lower):
    """ Unloads a plugin. """
    assert plugins.get_plugin(name), "`{}` is not a loaded plugin.".format(name)

    # The plugin is loaded so we unload it
    await plugins.save_plugin(name)
    plugins.unload_plugin(name)
    await client.say(message, "Plugin `{}` unloaded.".format(name))
Пример #5
0
def unload(client: discord.Client, message: discord.Message, name: str.lower):
    """ Unloads a plugin. """
    assert plugins.get_plugin(name), "`{}` is not a loaded plugin.".format(name)

    # The plugin is loaded so we unload it
    yield from plugins.save_plugin(name)
    plugins.unload_plugin(name)
    yield from client.say(message, "Plugin `{}` unloaded.".format(name))
Пример #6
0
async def unload(message: discord.Message, name: str.lower):
    """ Unloads a plugin. """
    assert plugins.get_plugin(name), "`{}` is not a loaded plugin.".format(name)

    # The plugin is loaded so we unload it
    await plugins.save_plugin(name)
    plugins.unload_plugin(name)
    await client.say(message, "Plugin `{}` unloaded.".format(name))
Пример #7
0
def load(client: discord.Client, message: discord.Message, name: str.lower):
    """ Loads a plugin. """
    assert not plugins.get_plugin(name), "Plugin `{}` is already loaded.".format(name)

    # The plugin isn't loaded so we'll try to load it
    assert plugins.load_plugin(name), "Plugin `{}` could not be loaded.".format(name)

    # The plugin was loaded successfully
    yield from client.say(message, "Plugin `{}` loaded.".format(name))
Пример #8
0
async def load(message: discord.Message, name: str.lower):
    """ Loads a plugin. """
    assert not plugins.get_plugin(name), "Plugin `{}` is already loaded.".format(name)

    # The plugin isn't loaded so we'll try to load it
    assert plugins.load_plugin(name), "Plugin `{}` could not be loaded.".format(name)

    # The plugin was loaded successfully
    await client.say(message, "Plugin `{}` loaded.".format(name))
Пример #9
0
def plugin_in_req(plugin: str):
    """ Function for checking that the plugin exists and initializes the req.
    Returns the plugin name. """
    plugin = plugin.lower()

    if not plugins.get_plugin(plugin):
        return None

    if plugin not in feature_reqs.data:
        feature_reqs.data[plugin] = []

    return plugin
Пример #10
0
def plugin_in_req(plugin: str):
    """ Function for checking that the plugin exists and initializes the req.
    Returns the plugin name. """
    plugin = plugin.lower()

    if not plugins.get_plugin(plugin):
        return None

    if plugin not in feature_reqs.data:
        feature_reqs.data[plugin] = []

    return plugin
Пример #11
0
    def fragment_start(self, path, program, project) :
        try :
            p = plugins.get_plugin(program)

            p.inspect_input_files(path)
            p.inspect_system(self.resource)

            f = Fragment(path, program, p, project)

            self.__startfragment(f)

        except plugins.PluginError, pe :
            return (False, str(pe))
Пример #12
0
def start():
    import namb.gui as gui
    global m
    m = gui.MainWindow()
    import plugins
    #plugins.load_plugin("jazzradio_com")
    global g
    g = plugins.get_plugin("jazzradio_com")
    g.init()
    g.display(m.p.frame)
    import namb.userinput
    namb.userinput.set_receiver(g.menu_frame.tabs)
    g.menu_frame.tabs.focus_receive()
    m.p.frame.after(1, lambda: m.bar.menu_vanish())
    ui_loop()
Пример #13
0
def reload(client: discord.Client, message: discord.Message, name: str.lower=None):
    """ Reloads all plugins or the specified plugin. """
    if name:
        assert plugins.get_plugin(name), "`{}` is not a plugin".format(name)

        # The plugin entered is valid so we reload it
        yield from plugins.save_plugin(name)
        plugins.reload_plugin(name)
        yield from client.say(message, "Reloaded plugin `{}`.".format(name))
    else:
        # Reload all plugins
        yield from plugins.save_plugins()

        for plugin_name in plugins.all_keys():
            plugins.reload_plugin(plugin_name)

        yield from client.say(message, "All plugins reloaded.")
Пример #14
0
def start():
    import namb.gui as gui
    global m
    m=gui.MainWindow()
    import extensions
    extensions.load()
    extensions.load_extension("vlc")
    import plugins
    plugins.load()
    plugins.install_plugin("radionpo")
    plugins.load_plugin("radionpo")
    #plugins.load_plugin("jazzradio_com")
    global g
    g=plugins.get_plugin("radionpo")
    g.init()
    g.display(m.p.frame)
    import namb.userinput
    namb.userinput.set_receiver(g.menu)
    g.menu.focus_receive()
    m.p.frame.after(1, lambda: m.bar.menu_vanish())
    ui_loop()
Пример #15
0
	def connect(self, username, password):
		print "Network connecting to %s" % username
		domain = username.split('@')[1]
		print 'About to get connection from plugins.'
		connection = plugins.get_plugin(domain)
		print 'Got connection from plugins.'
		if connection:
			try:
				self.status("Connecting to %s" % domain)
				self.connection = connect(connection,
                                                          username=username,
                                                          password=password,
                                                          domain=domain)
				self.status("Connected")
				self.loginWindow.hide()
				self.registry.newWaveList()
				self.saveLogin(username, password,)
				return True
			except NetworkTools.ConnectionFailure, e:
				self.status("Connection Failed - Your internet may be down or your login data incorrect")
				return False
Пример #16
0
 def __call___(item):
     """ Backwards compatibility for old plugin(name) method. """
     return plugins.get_plugin(item)
Пример #17
0
 def __getattr__(self, item):
     return plugins.get_plugin(item)