Exemple #1
0
def run():
    """
    Initializes and runs Enso.
    """

    from enso.events import EventManager
    from enso.quasimode import Quasimode
    from enso import plugins, webui
    from enso.quasimode import layout

    # Set color theme before quasimode is loaded to capture font styles
    layout.setColorTheme(config.COLOR_THEME)

    eventManager = EventManager.get()
    Quasimode.install( eventManager )
    plugins.install( eventManager )
    def initEnso():
        msgXml = config.OPENING_MSG_XML
        if msgXml != None:
            messages.displayMessage( msgXml )

        run_tasks()

    if config.ENABLE_WEB_UI:
        webui.start(eventManager)

    eventManager.registerResponder( initEnso, "init" )
    eventManager.run()
Exemple #2
0
def run():
    """
    Initializes and runs Enso.
    """
    import logging
    import sys
    from enso.events import EventManager
    from enso.quasimode import Quasimode
    from enso import events, plugins, config, messages, quasimode, webui

    def except_hook(type, value, tback):
        # manage unhandled exception here
        logging.error(value)
        tback.print_exc()
        sys.__excepthook__(type, value, tback)  # then call the default handler

    sys.excepthook = except_hook

    eventManager = EventManager.get()
    Quasimode.install(eventManager)
    plugins.install(eventManager)

    webui_server = webui.start(eventManager)

    if enso.config.SHOW_SPLASH and config.OPENING_MSG_XML:
        eventManager.registerResponder(
            lambda: messages.displayMessage(config.OPENING_MSG_XML), 
            "init")

    try:
        eventManager.run()
    except SystemError as e:
        logging.error(e)
        import traceback
        traceback.print_exc()
        webui_server.stop()
    except SystemExit as e:
        logging.error(e)
        import traceback
        traceback.print_exc()
        webui_server.stop()
    except KeyboardInterrupt:
        webui_server.stop()
    except Exception as e:
        logging.error(e)
        import traceback
        traceback.print_exc()
        webui_server.stop()
    except:
        import traceback
        traceback.print_exc()
        webui_server.stop()
Exemple #3
0
def run():
    """
    Initializes and runs Enso.
    """

    from enso.events import EventManager
    from enso.quasimode import Quasimode
    from enso import events, plugins, config, quasimode

    eventManager = EventManager.get()
    Quasimode.install(eventManager)
    plugins.install(eventManager)

    def showWelcomeMessage():
        msgXml = config.OPENING_MSG_XML
        if msgXml != None:
            messages.displayMessage(msgXml)

    eventManager.registerResponder(showWelcomeMessage, "init")
    eventManager.run()
Exemple #4
0
def run():
    """
    Initializes and runs Enso.
    """

    from enso.events import EventManager
    from enso.quasimode import Quasimode
    from enso import events, plugins, config, quasimode

    eventManager = EventManager.get()
    Quasimode.install( eventManager )
    plugins.install( eventManager )

    def showWelcomeMessage():
        msgXml = config.OPENING_MSG_XML
        if msgXml != None:
            messages.displayMessage( msgXml )

    eventManager.registerResponder( showWelcomeMessage, "init" )
    eventManager.run()
Exemple #5
0
def run():
    """
    Initializes and runs Enso.
    """
    if not started:
        messages.displayMessage("<p>Starting <command>Enso</command>...</p>")

        from enso.events import EventManager
        from enso.quasimode import Quasimode as quasimode
        from enso import events, plugins, config, webui
        global started, webuiServer, eventManager
 
        eventManager = EventManager.get()
        quasimode.install( eventManager )
        plugins.install( eventManager )

        eventManager.registerResponder( showWelcomeMessage, "init" )
        webuiServer = webui.start(eventManager)
        started = True
        try:
            eventManager.run()
        except KeyboardInterrupt, e:
            pass
Exemple #6
0
def run():
    """
    Initializes and runs Enso.
    """
    if not started:
        messages.displayMessage("<p>Starting <command>Enso</command>...</p>")

        from enso.events import EventManager
        from enso.quasimode import Quasimode as quasimode
        from enso import events, plugins, config, webui
        global started, webuiServer, eventManager

        eventManager = EventManager.get()
        quasimode.install(eventManager)
        plugins.install(eventManager)

        eventManager.registerResponder(showWelcomeMessage, "init")
        webuiServer = webui.start(eventManager)
        started = True
        try:
            eventManager.run()
        except KeyboardInterrupt, e:
            pass
Exemple #7
0
}


class Globals(object):
    __slots__ = (
        '__dict__',
        '__weakref__',
        'INI_FILE',
        'HOME_CURRENCY',
    )
    # FIXME: This needs to work on all platforms
    INI_FILE = os.path.expanduser(u"~/.config/enso/cmd_calculate.ini")
    HOME_CURRENCY = None


quasimode = Quasimode.get()

#==============================================================================
# Classes & Functions
#==============================================================================

# FIXME: This needs to work on all platforms
CACHE_DIR = os.path.expanduser(u"~/.cache/enso/cmd_calculate")
if not os.path.isdir(CACHE_DIR):
    os.makedirs(CACHE_DIR)
RATES_FILENAME = os.path.join(CACHE_DIR, "rates.csv")

_dir_monitor = None
_file_changed_event_handler = None