本文整理汇总了Python中miro.plat.resources.app_root函数的典型用法代码示例。如果您正苦于以下问题:Python app_root函数的具体用法?Python app_root怎么用?Python app_root使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了app_root函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
示例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)
示例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()
示例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
示例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)
示例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()
示例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)
示例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.
示例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)
示例10: get_ffmpeg2theora_executable_path
def get_ffmpeg2theora_executable_path():
return os.path.join(resources.app_root(), "ffmpeg2theora.exe")
示例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())
示例12: get_enmfp_executable_info
def get_enmfp_executable_info():
return {
'path': os.path.join(resources.app_root(), "codegen.windows.exe")
}
示例13: get_segmenter_executable_path
def get_segmenter_executable_path():
return os.path.join(resources.app_root(), "miro-segmenter.exe")
示例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()
示例15: setup_ffmpeg_presets
def setup_ffmpeg_presets():
os.environ['FFMPEG_DATADIR'] = resources.app_root()