• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python resources.app_root函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中miro.plat.resources.app_root函数的典型用法代码示例。如果您正苦于以下问题:Python app_root函数的具体用法?Python app_root怎么用?Python app_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了app_root函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self):
        plugin_dir = os.path.join(resources.app_root(), 'vlc-plugins')
        self.exc = VLCException()

        # Note: if you need vlc output to stdout, remove the --quiet
        # from the list of arguments.  Also, you can add -vvv.
        vlc_args = [
            "vlc", '--quiet',
            '--nostats', '--intf', 'dummy', '--volume=0',
            '--no-video-title-show', '--plugin-path', plugin_dir
        ]
        self.vlc = libvlc.libvlc_new(
            len(vlc_args), make_string_list(vlc_args), self.exc.ref())
        self.exc.check()
        self.media_player = libvlc.libvlc_media_player_new(
            self.vlc, self.exc.ref())
        self.exc.check()
        self._callback_ref = VLC_EVENT_CALLBACK(self.event_callback)
        self._filename = None
        self.media_playing = None
        self.callback_info = None

        self._hidden_window = gtk.gdk.Window(
            None, x=0, y=0, width=1, height=1,
            window_type=gtk.gdk.WINDOW_TOPLEVEL,
            wclass=gtk.gdk.INPUT_OUTPUT, event_mask=0)
        libvlc.libvlc_media_player_set_hwnd(
            self.media_player, self._hidden_window.handle, self.exc.ref())
        self.exc.check()
开发者ID:kmshi,项目名称:miro,代码行数:29,代码来源:vlc.py


示例2: launch_download_daemon

def launch_download_daemon(oldpid, env):
    kill_process(oldpid)

    # FIXME - wtf is going on here between os.environ, env and
    # environ?
    for key, value in env.items():
        os.environ[key] = value

    environ = os.environ.copy()
    environ['DEMOCRACY_DOWNLOADER_LOG'] = app.config.get(
        prefs.DOWNLOADER_LOG_PATHNAME)
    environ['MIRO_APP_VERSION'] = app.config.get(prefs.APP_VERSION)
    if hasattr(app, 'in_unit_tests'):
        environ['MIRO_IN_UNIT_TESTS'] = '1'
    environ.update(env)

    # start the downloader.  We use the subprocess module to turn off
    # the console.  One slightly awkward thing is that the current
    # process might not have a valid stdin/stdout/stderr, so we create
    # a pipe to it that we never actually use.

    # note that we use "Miro" instead of the app name here, so custom
    # versions will work

    downloader_path = (os.path.join(resources.app_root(),
                                   "Miro_Downloader.exe"),) 
    return Popen(downloader_path, stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE,
                 stdin=subprocess.PIPE,
                 env=environ)
开发者ID:ShriramK,项目名称:miro,代码行数:30,代码来源:utils.py


示例3: startup

def startup(argv):
    # Before importing gstreamer, fix os.environ so gstreamer finds its
    # plugins.  Do this early before any code is run to prevent any import
    # of gst missing this!
    from miro.plat import resources
    GST_PLUGIN_PATH = os.path.join(resources.app_root(), 'gstreamer-0.10')
    os.environ["GST_PLUGIN_PATH"] = GST_PLUGIN_PATH
    os.environ["GST_PLUGIN_SYSTEM_PATH"] = GST_PLUGIN_PATH

    theme = None
    # Should have code to figure out the theme.

    from miro.plat import pipeipc
    try:
        pipe_server = pipeipc.Server()
    except pipeipc.PipeExists:
        pipeipc.send_command_line_args()
        return
    pipe_server.start_process()

    from miro.plat import prelogger
    prelogger.install()

    from miro.plat.utils import initialize_locale
    initialize_locale()

    from miro import bootstrap
    bootstrap.bootstrap()

    from miro.plat import commandline
    args = commandline.get_command_line()[1:]

    if '--theme' in args:
        index = args.index('--theme')
        theme = args[index+1]
        del args[index:index+1]

    if '--debug' in args:
        index = args.index('--debug')
        del args[index]
        from miro import app
        app.debugmode = True

    from miro import startup
    startup.initialize(theme)

    from miro.plat import migrateappname
    migrateappname.migrateSupport('Democracy', 'Miro')

    from miro import commandline
    commandline.set_command_line_args(args)

    # Kick off the application
    from miro.plat.frontends.widgets.application import WindowsApplication
    WindowsApplication().run()
    pipe_server.quit()
开发者ID:kfatehi,项目名称:miro,代码行数:56,代码来源:Miro.py


示例4: _get_icon_location

 def _get_icon_location(self):
     # we set the icon first (if available) so that it doesn't flash
     # on when the window is realized in Application.build_window()
     icopath = os.path.join(resources.app_root(), "Miro.ico")
     if app.config.get(prefs.THEME_NAME) and app.config.get(options.WINDOWS_ICON):
         themeIcoPath = resources.theme_path(app.config.get(prefs.THEME_NAME),
                                             app.config.get(options.WINDOWS_ICON))
         if os.path.exists(themeIcoPath):
             icopath = themeIcoPath
     gtk.window_set_default_icon_from_file(icopath)
     return icopath
开发者ID:CodeforEvolution,项目名称:miro,代码行数:11,代码来源:application.py


示例5: launch_download_daemon

def launch_download_daemon(oldpid, env):
    kill_process(oldpid)

    # FIXME - wtf is going on here between os.environ, env and
    # environ?
    for key, value in env.items():
        os.environ[key] = value

    environ = os.environ.copy()
    environ['DEMOCRACY_DOWNLOADER_LOG'] = app.config.get(
        prefs.DOWNLOADER_LOG_PATHNAME)
    environ['MIRO_APP_VERSION'] = app.config.get(prefs.APP_VERSION)
    if hasattr(app, 'in_unit_tests'):
        environ['MIRO_IN_UNIT_TESTS'] = '1'
    environ.update(env)

    # on windows, subprocess can ONLY accept strings (no unicode) in
    # environment values.  at present this affects FFMPEG_DATADIR
    # which doesn't matter in the downloader, so we remove it.
    del environ["FFMPEG_DATADIR"]
    del environ["GST_PLUGIN_PATH"]
    del environ["GST_PLUGIN_SYSTEM_PATH"]

    # start the downloader.  We use the subprocess module to turn off
    # the console.  One slightly awkward thing is that the current
    # process might not have a valid stdin/stdout/stderr, so we create
    # a pipe to it that we never actually use.

    # note that we use "Miro" instead of the app name here, so custom
    # versions will work

    # note that the application filename has to be in double-quotes
    # otherwise it kicks up "%1 is not a valid Win32 application"
    # errors on some Windows machines.  Why it only happens on some is
    # a mystery of the universe.  Bug #9274.
    downloader_path = '"%s"' % os.path.join(resources.app_root(),
                                           "Miro_Downloader.exe")
    startupinfo = subprocess.STARTUPINFO()
    # TEMPORARY: the STARTF_USESHOWWINDOW has been moved into
    # subprocess._subprocess in Python 2.6.6 and beyond.
    try:
        startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    except AttributeError:
        startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW

    subprocess.Popen(downloader_path, stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     stdin=subprocess.PIPE,
                     startupinfo=startupinfo,
                     env=environ)
开发者ID:geoffl,项目名称:miro,代码行数:50,代码来源:utils.py


示例6: test_startup

def test_startup(argv):
    import sys
    import logging
    logging.basicConfig(level=logging.CRITICAL)

    from miro import app
    app.debugmode = True

    from miro.plat import utils
    utils.initialize_locale()

    from miro import bootstrap
    bootstrap.bootstrap()

    from miro import test
    from miro.plat import resources

    sys.path.append(resources.app_root())
    test.run_tests()
开发者ID:codito,项目名称:miro,代码行数:19,代码来源:Miro.py


示例7: launch_download_daemon

def launch_download_daemon(oldpid, env):
    kill_process(oldpid)

    # FIXME - wtf is going on here between os.environ, env and
    # environ?
    for key, value in env.items():
        os.environ[key] = value

    environ = os.environ.copy()
    environ['DEMOCRACY_DOWNLOADER_LOG'] = app.config.get(
        prefs.DOWNLOADER_LOG_PATHNAME)
    environ['MIRO_APP_VERSION'] = app.config.get(prefs.APP_VERSION)
    if hasattr(app, 'in_unit_tests'):
        environ['MIRO_IN_UNIT_TESTS'] = '1'
    environ.update(env)

    # note that we use "Miro" instead of the app name here, so custom
    # versions will work

    downloader_path = (os.path.join(resources.app_root(),
                                   "Aurora_Downloader.exe"),) 
    return Popen(downloader_path, close_fds=True, env=environ)
开发者ID:mdargan,项目名称:miro,代码行数:22,代码来源:utils.py


示例8: file

# permission to link the code of portions of this program with the OpenSSL
# library.
#
# You must obey the GNU General Public License in all respects for all of
# the code used other than OpenSSL. If you modify file(s) with this
# exception, you may extend this exception to your version of the file(s),
# but you are not obligated to do so. If you do not wish to do so, delete
# this exception statement from your version. If you delete this exception
# statement from all source files in the program, then also delete it here.

"""gstreamerrenderer.py -- Windows gstreamer renderer """

# Before importing gstreamer, fix os.environ so gstreamer finds it's plugins
import os
from miro.plat import resources
GST_PLUGIN_PATH = os.path.join(resources.app_root(), 'gstreamer-0.10')
os.environ["GST_PLUGIN_PATH"] = GST_PLUGIN_PATH
os.environ["GST_PLUGIN_SYSTEM_PATH"] = GST_PLUGIN_PATH

import pygst
pygst.require('0.10')
import gst

from miro import app
from miro.frontends.widgets.gst import renderer

# We need to define get_item_type().  Use the version from sniffer.
from miro.frontends.widgets.gst.sniffer import get_item_type

class WindowsSinkFactory(renderer.SinkFactory):
    """Windows class to create gstreamer audio/video sinks.
开发者ID:geoffl,项目名称:miro,代码行数:31,代码来源:gstreamerrenderer.py


示例9: miro_helper_program_info

def miro_helper_program_info():
    cmd_line = (os.path.join(resources.app_root(), 'Miro_Helper.exe'),)
    env = None
    return (cmd_line, env)
开发者ID:ShriramK,项目名称:miro,代码行数:4,代码来源:utils.py


示例10: get_ffmpeg2theora_executable_path

def get_ffmpeg2theora_executable_path():
    return os.path.join(resources.app_root(), "ffmpeg2theora.exe")
开发者ID:ShriramK,项目名称:miro,代码行数:2,代码来源:utils.py


示例11: setup_ffmpeg_presets

def setup_ffmpeg_presets():
    from miro.plat.specialfolders import get_short_path_name
    os.environ['AVCONV_DATADIR'] = get_short_path_name(
        resources.app_root())
开发者ID:ShriramK,项目名称:miro,代码行数:4,代码来源:utils.py


示例12: get_enmfp_executable_info

def get_enmfp_executable_info():
    return {
        'path': os.path.join(resources.app_root(), "codegen.windows.exe")
    }
开发者ID:ShriramK,项目名称:miro,代码行数:4,代码来源:utils.py


示例13: get_segmenter_executable_path

def get_segmenter_executable_path():
    return os.path.join(resources.app_root(), "miro-segmenter.exe")
开发者ID:ShriramK,项目名称:miro,代码行数:2,代码来源:utils.py


示例14: startup

def startup(argv):
    # Rewrite the stdout and stderr to catch cases debug being printed via
    # a print or via a write to stderr.  Normally we would use shortAppName
    # but at this point nothing has been bootstrapped yet.  We only want to
    # catch it though if py2exe has fiddled with our file descriptors.
    #
    # The stdout/stderr are redirected again in the Windows-specific
    # setup_logging(). 
    #
    # See bz17793
    redirected = sys.stdout != sys.__stdout__
    if redirected:
        try:
            logfile = os.path.join(tempfile.gettempdir(), 'Miro_console.log')
            sys.stderr = sys.stdout = open(logfile, 'w')
        except EnvironmentError:
            # too bad ... let's silence rather than spew stuff to stop it 
            # writing to a file that it might not have permissions to.  
            # Hopefully, this does not happen often.
            sys.stderr = sys.stdout = open(os.devnull, 'w')

    # Before importing gstreamer, fix os.environ so gstreamer finds its
    # plugins.  Do this early before any code is run to prevent any import
    # of gst missing this!
    from miro.plat import resources
    from miro.plat import config
    GST_PLUGIN_PATH = os.path.join(resources.app_root(), 'gstreamer-0.10')
    os.environ["GST_PLUGIN_PATH"] = GST_PLUGIN_PATH
    os.environ["GST_PLUGIN_SYSTEM_PATH"] = GST_PLUGIN_PATH
    # normally we'd use app.config to get this, but we're starting up
    os.environ["GST_REGISTRY"] = os.path.join(config._get_support_directory(),
                                              'gst_registry.bin')

    theme = None
    # Should have code to figure out the theme.

    from miro.plat import pipeipc
    try:
        pipe_server = pipeipc.Server()
    except pipeipc.PipeExists:
        pipeipc.send_command_line_args()
        return
    pipe_server.start_process()

    from miro.plat import prelogger
    prelogger.install()

    from miro.plat.utils import initialize_locale
    initialize_locale()

    from miro import bootstrap
    bootstrap.bootstrap()

    from miro.plat import commandline
    args = commandline.get_command_line()[1:]

    if '--theme' in args:
        index = args.index('--theme')
        theme = args[index+1]
        del args[index:index+1]

    if '--debug' in args:
        index = args.index('--debug')
        del args[index]
        from miro import app
        app.debugmode = True

    from miro import startup
    startup.initialize(theme)

    from miro.plat import migrateappname
    migrateappname.migrateSupport('Democracy', 'Miro')

    from miro import commandline
    commandline.set_command_line_args(args)

    # Kick off the application
    startfrontend.run_application('widgets', {}, None)
    pipe_server.quit()
开发者ID:dankamongmen,项目名称:miro,代码行数:79,代码来源:Miro.py


示例15: setup_ffmpeg_presets

def setup_ffmpeg_presets():
    os.environ['FFMPEG_DATADIR'] = resources.app_root()
开发者ID:kfatehi,项目名称:miro,代码行数:2,代码来源:utils.py


示例16: movie_data_program_info

def movie_data_program_info(movie_path, thumbnail_path):
    exe_path = os.path.join(resources.app_root(), 'Miro_MovieData.exe')
    cmd_line = (exe_path, movie_path, thumbnail_path)
    env = None
    return (cmd_line, env)
开发者ID:codito,项目名称:miro,代码行数:5,代码来源:utils.py



注:本文中的miro.plat.resources.app_root函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python resources.path函数代码示例发布时间:2022-05-27
下一篇:
Python wrappermap.wrapper函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap