예제 #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
파일: builtin.py 프로젝트: Jeglet/pcbot
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
파일: builtin.py 프로젝트: PcBoy111/PCBOT
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
파일: builtin.py 프로젝트: PcBoy111/PCBOT
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
파일: builtin.py 프로젝트: xZwop/PCBOT
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
파일: builtin.py 프로젝트: Jeglet/pcbot
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
파일: builtin.py 프로젝트: xZwop/PCBOT
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
파일: builtin.py 프로젝트: Jeglet/pcbot
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
파일: basic.py 프로젝트: PcBoy111/PCBOT
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
파일: kinski.py 프로젝트: ajm/herzog
    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
파일: builtin.py 프로젝트: xZwop/PCBOT
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
파일: network.py 프로젝트: adajw/PyTide
	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
파일: builtin.py 프로젝트: Jeglet/pcbot
 def __call___(item):
     """ Backwards compatibility for old plugin(name) method. """
     return plugins.get_plugin(item)
예제 #17
0
파일: builtin.py 프로젝트: Jeglet/pcbot
 def __getattr__(self, item):
     return plugins.get_plugin(item)