コード例 #1
0
ファイル: firsttimedialog.py プロジェクト: kmshi/miro
 def next_clicked(widget):
     os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
     app.config.set(
         prefs.LANGUAGE,
         str(lang_options[lang_option_menu.get_selected()][0]))
     gtcache.init()
     self.next_page(rebuild=True)
コード例 #2
0
ファイル: subprocessmanager.py プロジェクト: kfatehi/miro
def _subprocess_setup(stdin, stdout):
    """Does initial setup for a subprocess.

    Returns a SubprocessHandler to use for the subprocess

    raises the same exceptions that _load_obj does, namely:

    :raises IOError: low-level error while reading from the pipe
    :raises LoadError: data read was corrupted
    """
    # disable warnings so we don't get too much junk on stderr
    warnings.filterwarnings("ignore")
    # setup MessageHandler for messages going to the main process
    msg_handler = PipeMessageProxy(stdout)
    SubprocessResponse.install_handler(msg_handler)
    # load startup info
    msg = _load_obj(stdin)
    if not isinstance(msg, StartupInfo):
        raise LoadError("first message must a StartupInfo obj")
    # setup some basic modules like config and gtcache
    initialize_locale()
    config.load(config.ManualConfig())
    app.config.set_dictionary(msg.config_dict)
    gtcache.init()
    # setup our handler
    msg = _load_obj(stdin)
    if not isinstance(msg, HandlerInfo):
        raise LoadError("second message must a HandlerInfo obj")
    try:
        return msg.handler_class(*msg.handler_args)
    except StandardError, e:
        # log this exception for easier debugging.
        _send_subprocess_error_for_exception()
        raise LoadError("Exception while constructing handler: %s" % e)
コード例 #3
0
ファイル: subprocessmanager.py プロジェクト: paulmaki/miro
def _subprocess_setup(stdin, stdout):
    """Does initial setup for a subprocess.

    Returns a SubprocessHandler to use for the subprocess

    raises the same exceptions that _load_obj does, namely:

    :raises IOError: low-level error while reading from the pipe
    :raises LoadError: data read was corrupted
    """
    # disable warnings so we don't get too much junk on stderr
    warnings.filterwarnings("ignore")
    # setup MessageHandler for messages going to the main process
    msg_handler = PipeMessageProxy(stdout)
    SubprocessResponse.install_handler(msg_handler)
    # load startup info
    msg = _load_obj(stdin)
    if not isinstance(msg, StartupInfo):
        raise LoadError("first message must a StartupInfo obj")
    # setup some basic modules like config and gtcache
    initialize_locale()
    config.load(config.ManualConfig())
    app.config.set_dictionary(msg.config_dict)
    gtcache.init()
    # setup our handler
    msg = _load_obj(stdin)
    if not isinstance(msg, HandlerInfo):
        raise LoadError("second message must a HandlerInfo obj")
    try:
        return msg.handler_class(*msg.handler_args)
    except StandardError, e:
        # log this exception for easier debugging.
        _send_subprocess_error_for_exception()
        raise LoadError("Exception while constructing handler: %s" % e)
コード例 #4
0
ファイル: bootstrap.py プロジェクト: CodeforEvolution/miro
def bootstrap():
    """Run this as soon as possible when starting up miro.

    This method sets up gtcache and the app.config object.  Later on, we will
    replace this app.config with one that's theme aware.
    """
    config.load()
    gtcache.init()
    eventloop.setup_config_watcher()
コード例 #5
0
ファイル: bootstrap.py プロジェクト: youprofit/miro
def bootstrap():
    """Run this as soon as possible when starting up miro.

    This method sets up gtcache and the app.config object.  Later on, we will
    replace this app.config with one that's theme aware.
    """
    config.load()
    gtcache.init()
    eventloop.setup_config_watcher()
コード例 #6
0
ファイル: firsttimedialog.py プロジェクト: kmshi/miro
        def update_language(widget, index):
            os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
            app.config.set(prefs.LANGUAGE, str(lang_options[index][0]))
            gtcache.init()

            # FIXME - this is totally awful and may break at some
            # point.  what happens is that widgetconst translates at
            # import time, so if someone changes the language, then
            # the translations have already happened.  we reload the
            # module to force them to happen again.  bug 17515
            if "miro.frontends.widgets.widgetconst" in sys.modules:
                reload(sys.modules["miro.frontends.widgets.widgetconst"])
            self.this_page(rebuild=True)
コード例 #7
0
ファイル: gtcachetest.py プロジェクト: zjmmjzzjm/miro
 def test_gettext_lazy(self):
     ok = gtcache.gettext_lazy("OK")
     channels = gtcache.gettext_lazy("Channels")
     self.assertEqual(ok, u'Valider')
     self.assertEqual(u'%s' % ok, u'Valider')
     self.assertEqual(channels, u'Cha\xeenes')
     self.assertEqual(u'%s' % channels, u'Cha\xeenes')
     gtcache.init(languages=['en'],
                  localedir=resources.path("testdata/locale"))
     self.assertEqual(ok, u'OK')
     self.assertEqual(u'%s' % ok, u'OK')
     self.assertEqual(channels, u'Channels')
     self.assertEqual(u'%s' % channels, u'Channels')
コード例 #8
0
ファイル: gtcachetest.py プロジェクト: CodeforEvolution/miro
 def test_gettext_lazy(self):
     ok = gtcache.gettext_lazy("OK")
     channels = gtcache.gettext_lazy("Channels")
     self.assertEqual(ok, u'Valider')
     self.assertEqual(u'%s' % ok, u'Valider')
     self.assertEqual(channels, u'Cha\xeenes')
     self.assertEqual(u'%s' % channels, u'Cha\xeenes')
     gtcache.init(languages=['en'],
                  localedir=resources.path("testdata/locale"))
     self.assertEqual(ok, u'OK')
     self.assertEqual(u'%s' % ok, u'OK')
     self.assertEqual(channels, u'Channels')
     self.assertEqual(u'%s' % channels, u'Channels')
コード例 #9
0
ファイル: firsttimedialog.py プロジェクト: codito/miro
        def update_language(widget, index):
            os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
            app.config.set(prefs.LANGUAGE,
                       str(lang_options[index][0]))
            gtcache.init()

            # FIXME - this is totally awful and may break at some
            # point.  what happens is that widgetconst translates at
            # import time, so if someone changes the language, then
            # the translations have already happened.  we reload the
            # module to force them to happen again.  bug 17515
            if "miro.frontends.widgets.widgetconst" in sys.modules:
                reload(sys.modules["miro.frontends.widgets.widgetconst"])
            self.this_page(rebuild=True)
コード例 #10
0
ファイル: MiroDownloader.py プロジェクト: codito/miro
def finish_startup_after_config():
    """Finish startup tasks once we have config setup.

    Called from command.InitialConfigCommand.
    """

    from miro import gtcache
    gtcache.init()

    from miro import httpclient
    from miro.dl_daemon import download
    download.startup()
    httpclient.init_libcurl()

    logging.info("Daemon ready")
コード例 #11
0
def finish_startup_after_config():
    """Finish startup tasks once we have config setup.

    Called from command.InitialConfigCommand.
    """

    from miro import gtcache
    gtcache.init()

    from miro import httpclient
    from miro.dl_daemon import download
    download.startup()
    httpclient.init_libcurl()

    logging.info("Daemon ready")
コード例 #12
0
ファイル: firsttimedialog.py プロジェクト: cool-RR/Miro
 def next_clicked(widget):
     os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
     app.config.set(prefs.LANGUAGE,
                str(lang_options[lang_option_menu.get_selected()][0]))
     gtcache.init()
     self.next_page(rebuild=True)
コード例 #13
0
ファイル: gtcachetest.py プロジェクト: kmshi/miro
 def _make_french(*args, **kwargs):
     gtcache.init(languages=['fr'],
                  localedir=resources.path("testdata/locale"))
     f(*args, **kwargs)
コード例 #14
0
ファイル: gtcachetest.py プロジェクト: codito/miro
 def _make_french(*args, **kwargs):
     gtcache.init(languages=['fr'],
             localedir=resources.path("testdata/locale"))
     f(*args, **kwargs)