Ejemplo n.º 1
0
def load():
    global open_command_impl
    # Import platform specific implementation class
    # This imports enso.contrib.open.platform.<platform_name>.OpenCommandImpl class.
    open_command_impl = enso.contrib.platform.get_command_platform_impl("open")()

    # Register commands
    try:
        CommandManager.get().registerCommand(
            OpenCommandFactory.NAME,
            OpenCommandFactory()
            )
        CommandManager.get().registerCommand(
            OpenWithCommandFactory.NAME,
            OpenWithCommandFactory()
            )
        CommandManager.get().registerCommand(
            LearnAsOpenCommandFactory.NAME,
            LearnAsOpenCommandFactory()
            )
        CommandManager.get().registerCommand(
            UnlearnOpenCommandFactory.NAME,
            UnlearnOpenCommandFactory()
            )
        CommandManager.get().registerCommand(
            UndoUnlearnOpenCommand.NAME,
            UndoUnlearnOpenCommand()
            )
    except Exception, e:
        logger.critical(repr(e))
Ejemplo n.º 2
0
def load():
    cmd = GoogleCommandFactory()
    cmd.setDescription(
        "Performs a Google web search on the selected or typed text"
    )
    CommandManager.get().registerCommand(
        GoogleCommandFactory.NAME,
        cmd
        )
Ejemplo n.º 3
0
def load():
    cmd = GoogleCommandFactory()
    cmd.setDescription(
        "Performs a Google web search on the selected or typed text."
    )
    CommandManager.get().registerCommand(
        GoogleCommandFactory.NAME,
        cmd
        )
Ejemplo n.º 4
0
def load():
    # Register commands
    try:
        CommandManager.get().registerCommand(CalculateCommandFactory.NAME,
                                             CalculateCommandFactory())
        CommandManager.get().registerCommand(
            SetHomeCurrencyCommandFactory.NAME,
            SetHomeCurrencyCommandFactory())
    except Exception, e:
        logging.error(e)
Ejemplo n.º 5
0
def load():
    import sys
    from enso.contrib.scriptotron.ensoapi import EnsoApi
    sys.path.append(EnsoApi().get_enso_commands_folder())

    ScriptTracker.install( EventManager.get(),
                           CommandManager.get() )
Ejemplo n.º 6
0
def load():
    cmdMan = CommandManager.get()
    cmdMan.registerCommand(HelpCommand.NAME,
                           HelpCommand(DefaultHtmlHelp(cmdMan)))


# vim:set tabstop=4 shiftwidth=4 expandtab:
Ejemplo n.º 7
0
def load():
    cmdMan = CommandManager.get()
    cmdMan.registerCommand(
        HelpCommand.NAME,
        HelpCommand( DefaultHtmlHelp(cmdMan) )
        )

# vim:set tabstop=4 shiftwidth=4 expandtab:
def load():
    cmdMan = CommandManager.get()
    cmdMan.registerCommand(HideMiniMessagesCommand.NAME,
                           HideMiniMessagesCommand())
    cmdMan.registerCommand(ShowMiniMessageFactory.NAME,
                           ShowMiniMessageFactory())
    cmdMan.registerCommand(ShowRecentMessageCommand.NAME,
                           ShowRecentMessageCommand())
def load():
    PLUGIN_CONFIG_PREFIX = "PLUGIN_WEBSEARCH"
    RE_PLUGIN_CONFIG = re.compile(r"^%s_([a-zA-Z0-9]+)" % PLUGIN_CONFIG_PREFIX)
    for plugin_name in (RE_PLUGIN_CONFIG.sub(r"\1", e) for e in dir(enso.config) if RE_PLUGIN_CONFIG.match(e)):
        config_key = "%s_%s" % (PLUGIN_CONFIG_PREFIX, plugin_name)
        try:
            conf = getattr(enso.config, config_key)
            command = ConfigurableSearchCommandFactory(
                command_name=conf["name"],
                command_prefix=conf["prefix"],
                help_text=conf["argument"],
                base_url=conf["base_url"],
                suggest=conf["suggest"],
                suggestions_url=conf["suggestions_url"],
                parser=conf["result_parser"],
                is_json=conf["is_json"],
                minimum_chars=conf.get(
                    "minimum_chars", 1),
                polling_interval=conf.get(
                    "polling_interval", SUGGESTIONS_POLLING_INTERVAL),
            )
            CommandManager.get().registerCommand(
                command.NAME,
                command
            )
            if not conf["suggest"]:
                logging.info(
                    "%s command search-suggestions are turned off. "
                    "To turn it on, modify 'suggest' parameter of %s entry "
                    "in your .ensorc configuration file." %
                    (conf["name"], config_key)
                )
        except Exception as e:
            logging.error(
                "Error parsing/registering websearch command from enso.config: %s; %s",
                config_key, e
            )
Ejemplo n.º 10
0
def load():
    cmdMan = CommandManager.get()
    cmdMan.registerCommand(HelpCommand.NAME,
                           HelpCommand(DefaultHtmlHelp(cmdMan)))
Ejemplo n.º 11
0
def load():
    global open_command_impl, recent_command_impl
    # Import platform specific implementation class
    # This imports enso.contrib.open.platform.<platform_name>.OpenCommandImpl class.
    open_command_impl = enso.contrib.platform.get_command_platform_impl(
        "open")()
    try:
        recent_command_impl = enso.contrib.platform.get_command_platform_impl(
            "open", "RecentCommandImpl")()
    except Exception as e:
        logging.error(
            "Error importing platform specific 'open' command class: %s",
            str(e))
        recent_command_impl = None

    # Register commands
    try:
        CommandManager.get().registerCommand(OpenCommandFactory.NAME,
                                             OpenCommandFactory())
    except Exception as e:
        logger.critical(repr(e))
    try:
        CommandManager.get().registerCommand(OpenWithCommandFactory.NAME,
                                             OpenWithCommandFactory())
    except Exception as e:
        logger.critical(repr(e))
    try:
        CommandManager.get().registerCommand(LearnAsOpenCommandFactory.NAME,
                                             LearnAsOpenCommandFactory())
    except Exception as e:
        logger.critical(repr(e))
    try:
        CommandManager.get().registerCommand(UnlearnOpenCommandFactory.NAME,
                                             UnlearnOpenCommandFactory())
    except Exception as e:
        logger.critical(repr(e))
    try:
        CommandManager.get().registerCommand(UndoUnlearnOpenCommand.NAME,
                                             UndoUnlearnOpenCommand())
    except Exception as e:
        logger.critical(repr(e))
    try:
        CommandManager.get().registerCommand(WhichCommandFactory.NAME,
                                             WhichCommandFactory())
    except Exception as e:
        logger.critical(repr(e))
    try:
        if recent_command_impl:
            CommandManager.get().registerCommand(RecentCommandFactory.NAME,
                                                 RecentCommandFactory())
    except Exception as e:
        logger.critical(repr(e))
Ejemplo n.º 12
0
def load():
    CommandManager.get().registerCommand(GoogleCommandFactory.NAME,
                                         GoogleCommandFactory())
Ejemplo n.º 13
0
def load():
    ScriptTracker.install(EventManager.get(), CommandManager.get())
Ejemplo n.º 14
0
def load():
    CommandManager.get().registerCommand(
        GoogleCommandFactory.NAME,
        GoogleCommandFactory()
        )
Ejemplo n.º 15
0
def load():
    CommandManager.get().registerCommand(EvalCommand.NAME, EvalCommand())
Ejemplo n.º 16
0
def load():
    ScriptTracker.install( EventManager.get(),
                           CommandManager.get() )
Ejemplo n.º 17
0
    def install( cls, eventManager ):
        from enso.commands import CommandManager

        cls.__instance = cls( eventManager, CommandManager.get() )
Ejemplo n.º 18
0
def load():
    CommandManager.get().registerCommand(UndoCommandFactory.NAME,
                                         UndoCommandFactory())
Ejemplo n.º 19
0
def load():
    cmdMan = CommandManager.get()
    cmdMan.registerCommand(
        HelpCommand.NAME,
        HelpCommand( DefaultHtmlHelp(cmdMan) )
        )
Ejemplo n.º 20
0
                if append_result:
                    selection.set({ "text" : expression.strip() + " = " + unicode(result) })
                else:
                    selection.set({ "text" : unicode(result) })
            else:
                displayMessage(u"<p>%s</p><caption>%s</caption>" % (result, expression))

        except Exception, e:
            logging.info(e)
            ensoapi.display_message("Invalid syntax", "Error")
    else:
        ensoapi.display_message("Invalid expression", "Error")


from enso.commands import CommandManager
paste_command = CommandManager.get().getCommand("paste")
if paste_command:
    print dir(paste_command)

def cmd_calculation_paste(ensoapi):
    """ Paste the results of the last calculation """
    global last_calculation

    #paste_command = CommandManager.get().getCommand("paste")
    #if paste_command:
    #    print dir(paste_command)
    #    paste_command.valid_args

    selection.set({ "text": unicode(last_calculation) })

# vim:set tabstop=4 shiftwidth=4 expandtab:
Ejemplo n.º 21
0
def load():
    CommandManager.get().registerCommand(
        UndoCommandFactory.NAME,
        UndoCommandFactory()
        )
Ejemplo n.º 22
0
def load():
    import sys
    from enso.contrib.scriptotron.ensoapi import EnsoApi
    sys.path.append(EnsoApi().get_enso_commands_folder())

    ScriptTracker.install(EventManager.get(), CommandManager.get())
def load():
    cmdMan = CommandManager.get()
    cmdMan.registerCommand(PutCommand.NAME, PutCommand())


# vim:set ff=unix tabstop=4 shiftwidth=4 expandtab:
Ejemplo n.º 24
0
    def install(cls, eventManager):
        from enso.commands import CommandManager

        cls.__instance = cls(eventManager, CommandManager.get())
Ejemplo n.º 25
0
def load():
    CommandManager.get().registerCommand(CloseCommand.NAME, CloseCommand())
    CommandManager.get().registerCommand(QuitCommand.NAME, QuitCommand())
Ejemplo n.º 26
0
                if append_result:
                    pasted = selection.set({ "text" : expression.strip() + " = " + unicode(result) })
                else:
                    pasted = selection.set({ "text" : unicode(result) })
            
            if not pasted:
                displayMessage(u"<p>%s</p><caption>%s</caption>" % (result, expression))
        except Exception, e:
            logging.info(e)
            ensoapi.display_message("Invalid syntax", "Error")
    else:
        ensoapi.display_message("Invalid expression", "Error")


from enso.commands import CommandManager
paste_command = CommandManager.get().getCommand("paste")
if paste_command:
    print dir(paste_command)

def cmd_calculation_paste(ensoapi):
    """ Paste the results of the last calculation """
    global last_calculation
    
    #paste_command = CommandManager.get().getCommand("paste")
    #if paste_command:
    #    print dir(paste_command)
    #    paste_command.valid_args

    selection.set({ "text": unicode(last_calculation) })

# vim:set tabstop=4 shiftwidth=4 expandtab:
Ejemplo n.º 27
0
def load():
    sys.path.append(EnsoApi().get_enso_commands_folder())

    ScriptTracker.install(EventManager.get(), CommandManager.get())
Ejemplo n.º 28
0
def load():
    CommandManager.get().registerCommand(
        EvalCommand.NAME,
        EvalCommand()
        )
Ejemplo n.º 29
0
def load():
    sys.path.append(EnsoApi().get_enso_commands_folder())

    ScriptTracker.install( EventManager.get(),
                           CommandManager.get() )