本文整理汇总了Python中quodlibet.util.is_osx函数的典型用法代码示例。如果您正苦于以下问题:Python is_osx函数的具体用法?Python is_osx怎么用?Python is_osx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_osx函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_constrains
def test_constrains(self):
if is_py2exe():
self.assertEqual(is_py2exe_console(), not is_py2exe_window())
self.assertTrue(is_windows())
if is_windows():
self.assertFalse(is_osx())
if is_osx():
self.assertFalse(is_windows())
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:test_util_environment.py
示例2: get_user_dir
def get_user_dir():
"""Place where QL saves its state, database, config etc."""
if os.name == "nt":
USERDIR = os.path.join(windows.get_appdata_dir(), "Quod Libet")
elif is_osx():
USERDIR = os.path.join(os.path.expanduser("~"), ".quodlibet")
else:
USERDIR = os.path.join(xdg_get_config_home(), "quodlibet")
if not os.path.exists(USERDIR):
tmp = os.path.join(os.path.expanduser("~"), ".quodlibet")
if os.path.exists(tmp):
USERDIR = tmp
if 'QUODLIBET_USERDIR' in environ:
USERDIR = environ['QUODLIBET_USERDIR']
if build.BUILD_TYPE == u"windows-portable":
USERDIR = os.path.normpath(os.path.join(
os.path.dirname(path2fsn(sys.executable)), "..", "..", "config"))
# XXX: users shouldn't assume the dir is there, but we currently do in
# some places
mkdir(USERDIR, 0o750)
return USERDIR
开发者ID:zsau,项目名称:quodlibet,代码行数:27,代码来源:_main.py
示例3: _init_python
def _init_python():
if PY2 or is_release():
MinVersions.PYTHON2.check(sys.version_info)
else:
# for non release builds we allow Python3
MinVersions.PYTHON3.check(sys.version_info)
if is_osx():
# We build our own openssl on OSX and need to make sure that
# our own ca file is used in all cases as the non-system openssl
# doesn't use the system certs
install_urllib2_ca_file()
if is_windows():
# Not really needed on Windows as pygi-aio seems to work fine, but
# wine doesn't have certs which we use for testing.
install_urllib2_ca_file()
if is_windows() and os.sep != "\\":
# In the MSYS2 console MSYSTEM is set, which breaks os.sep/os.path.sep
# If you hit this do a "setup.py clean -all" to get rid of the
# bytecode cache then start things with "MSYSTEM= ..."
raise AssertionError("MSYSTEM is set (%r)" % environ.get("MSYSTEM"))
if is_windows():
# gdbm is broken under msys2, this makes shelve use another backend
sys.modules["gdbm"] = None
sys.modules["_gdbm"] = None
logging.getLogger().addHandler(PrintHandler())
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:30,代码来源:_init.py
示例4: test_all
def test_all(self):
self.assertTrue(isinstance(is_unity(), bool))
self.assertTrue(isinstance(is_windows(), bool))
self.assertTrue(isinstance(is_osx(), bool))
self.assertTrue(isinstance(is_py2exe(), bool))
self.assertTrue(isinstance(is_py2exe_console(), bool))
self.assertTrue(isinstance(is_py2exe_window(), bool))
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:test_util_environment.py
示例5: enabled
def enabled(self):
impl = get_indicator_impl()
self._tray = impl()
self._tray.set_song(app.player.song)
self._tray.set_info_song(app.player.info)
self._tray.set_paused(app.player.paused)
if not is_osx() and not pconfig.getboolean("window_visible"):
Window.prevent_inital_show(True)
开发者ID:urielz,项目名称:quodlibet,代码行数:9,代码来源:__init__.py
示例6: _show_files_finder
def _show_files_finder(dirname, *args):
if not is_osx():
raise BrowseError("OS X only")
try:
if subprocess.call(["open", "-R", dirname]) != 0:
raise EnvironmentError("open error return status")
except EnvironmentError as e:
raise BrowseError(e)
开发者ID:Muges,项目名称:quodlibet,代码行数:9,代码来源:showfiles.py
示例7: has_locale
def has_locale(loc):
if is_osx():
return False
try:
with set_locale(loc):
pass
except locale.Error:
return False
else:
return True
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:11,代码来源:test_util_i18n.py
示例8: test_gio
def test_gio(self):
if is_osx():
return
for url in self.GOOD:
client = Gio.SocketClient.new()
client.set_tls(True)
client.connect_to_uri(url, 443, None).close()
for url in self.BAD:
with self.assertRaises(GLib.GError):
client = Gio.SocketClient.new()
client.set_tls(True)
client.connect_to_uri(url, 443, None).close()
开发者ID:gbtami,项目名称:quodlibet,代码行数:14,代码来源:test_https.py
示例9: test_soup
def test_soup(self):
if is_osx():
return
for url in self.GOOD:
session = Soup.Session.new()
request = session.request_http("get", url)
request.send(None).close()
for url in self.BAD:
with self.assertRaises(GLib.GError):
session = Soup.Session.new()
request = session.request_http("get", url)
request.send(None).close()
开发者ID:gbtami,项目名称:quodlibet,代码行数:14,代码来源:test_https.py
示例10: init_devices
def init_devices():
global devices
load_pyc = util.is_windows() or util.is_osx()
modules = load_dir_modules(dirname(__file__),
package=__package__,
load_compiled=load_pyc)
for mod in modules:
try:
devices.extend(mod.devices)
except AttributeError:
print_w("%r doesn't contain any devices." % mod.__name__)
devices.sort()
开发者ID:virtuald,项目名称:quodlibet,代码行数:15,代码来源:__init__.py
示例11: init
def init():
"""Import all browsers from this package and from the user directory.
After this is called the global `browers` list will contain all
classes sorted by priority.
Can be called multiple times.
"""
global browsers, default
# ignore double init (for the test suite)
if browsers:
return
this_dir = os.path.dirname(__file__)
load_pyc = util.is_windows() or util.is_osx()
modules = load_dir_modules(this_dir,
package=__package__,
load_compiled=load_pyc)
user_dir = os.path.join(quodlibet.get_user_dir(), "browsers")
if os.path.isdir(user_dir):
modules += load_dir_modules(user_dir,
package="quodlibet.fake.browsers",
load_compiled=load_pyc)
for browser in modules:
try:
browsers.extend(browser.browsers)
except AttributeError:
print_w("%r doesn't contain any browsers." % browser.__name__)
def is_browser(Kind):
return isinstance(Kind, type) and issubclass(Kind, Browser)
browsers = filter(is_browser, browsers)
if not browsers:
raise SystemExit("No browsers found!")
browsers.sort(key=lambda Kind: Kind.priority)
try:
default = get("SearchBar")
except ValueError:
raise SystemExit("Default browser not found!")
开发者ID:Tjorriemorrie,项目名称:quodlibet,代码行数:46,代码来源:__init__.py
示例12: init
def init():
"""Load/Import all formats.
Before this is called loading a file and unpickling will not work.
"""
global mimes, loaders, types
MinVersions.MUTAGEN.check(mutagen.version)
base = util.get_module_dir()
load_pyc = util.is_windows() or util.is_osx()
formats = load_dir_modules(base,
package=__package__,
load_compiled=load_pyc)
module_names = []
for format in formats:
name = format.__name__
for ext in format.extensions:
loaders[ext] = format.loader
types.update(format.types)
if format.extensions:
for type_ in format.types:
mimes.update(type_.mimes)
module_names.append(name.split(".")[-1])
# Migrate pre-0.16 library, which was using an undocumented "feature".
sys.modules[name.replace(".", "/")] = format
# Migrate old layout
if name.startswith("quodlibet."):
sys.modules[name.split(".", 1)[1]] = format
# This can be used for the quodlibet.desktop file
desktop_mime_types = "MimeType=" + \
";".join(sorted({m.split(";")[0] for m in mimes})) + ";"
print_d(desktop_mime_types)
s = ", ".join(sorted(module_names))
print_d("Supported formats: %s" % s)
if not loaders:
raise SystemExit("No formats found!")
开发者ID:LudoBike,项目名称:quodlibet,代码行数:46,代码来源:_misc.py
示例13: _init_python
def _init_python():
if PY2 or is_release():
MinVersions.PYTHON2.check(sys.version_info)
else:
# for non release builds we allow Python3
MinVersions.PYTHON3.check(sys.version_info)
if is_osx():
# We build our own openssl on OSX and need to make sure that
# our own ca file is used in all cases as the non-system openssl
# doesn't use the system certs
util.install_urllib2_ca_file()
if is_windows():
# Not really needed on Windows as pygi-aio seems to work fine, but
# wine doesn't have certs which we use for testing.
util.install_urllib2_ca_file()
开发者ID:gbtami,项目名称:quodlibet,代码行数:17,代码来源:__init__.py
示例14: show_uri
def show_uri(label, uri):
"""Shows a uri. The uri can be anything handled by GIO or a quodlibet
specific one.
Currently handled quodlibet uris:
- quodlibet:///prefs/plugins/<plugin id>
Args:
label (str)
uri (str) the uri to show
Returns:
True on success, False on error
"""
parsed = urlparse(uri)
if parsed.scheme == "quodlibet":
if parsed.netloc != "":
print_w("Unknown QuodLibet URL format (%s)" % uri)
return False
else:
return __show_quodlibet_uri(parsed)
elif parsed.scheme == "file" and (is_windows() or is_osx()):
# Gio on non-Linux can't handle file URIs for some reason,
# fall back to our own implementation for now
from quodlibet.qltk.showfiles import show_files
try:
filepath = uri2fsn(uri)
except ValueError:
return False
else:
return show_files(filepath, [])
else:
# Gtk.show_uri_on_window exists since 3.22
try:
if hasattr(Gtk, "show_uri_on_window"):
from quodlibet.qltk import get_top_parent
return Gtk.show_uri_on_window(get_top_parent(label), uri, 0)
else:
return Gtk.show_uri(None, uri, 0)
except GLib.Error:
return False
开发者ID:LudoBike,项目名称:quodlibet,代码行数:42,代码来源:__init__.py
示例15: show_files
def show_files(dirname, entries=[]):
"""Shows the directory in the default file browser and if passed
a list of directory entries will highlight those.
Depending on the system/platform this might highlight all files passed,
or only one of them, or none at all.
Args:
dirname (fsnative): Path to the directory
entries (List[fsnative]): List of (relative) filenames in the directory
entries (List[fsnative]): List of (relative) filenames in the directory
Returns:
bool: if the action was successful or not
"""
assert isinstance(dirname, fsnative)
assert all(isinstance(e, fsnative) and os.path.basename(e) == e
for e in entries)
dirname = os.path.abspath(dirname)
if is_windows():
implementations = [_show_files_win32]
elif is_osx():
implementations = [_show_files_finder]
else:
implementations = [
_show_files_fdo,
_show_files_thunar,
_show_files_xdg_open,
_show_files_gnome_open,
]
for impl in implementations:
try:
impl(dirname, entries)
except BrowseError:
continue
else:
return True
return False
开发者ID:Muges,项目名称:quodlibet,代码行数:41,代码来源:showfiles.py
示例16: import
import threading
from xml.dom import minidom
from urllib.parse import quote
import queue
from quodlibet import _, print_d
from quodlibet.plugins.gui import UserInterfacePlugin
from quodlibet.util import gi_require_versions, is_windows, is_osx
from quodlibet.plugins.events import EventPlugin
from quodlibet.plugins import (PluginImportException, PluginConfig, ConfProp,
BoolConfProp, FloatConfProp, PluginNotSupportedError)
try:
gi_require_versions("WebKit2", ["4.0", "3.0"])
except ValueError as e:
if is_windows() or is_osx():
raise PluginNotSupportedError
raise PluginImportException("GObject Introspection: " + str(e))
from gi.repository import WebKit2, Gtk, GLib
from quodlibet import qltk
from quodlibet.util import escape, cached_property, connect_obj
from quodlibet.qltk import Icons, Align
from quodlibet.qltk.entry import UndoEntry
from quodlibet.pattern import URLFromPattern
from quodlibet.util.urllib import urlopen
# for the mobile version
USER_AGENT = ("Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) "
开发者ID:zsau,项目名称:quodlibet,代码行数:31,代码来源:weblyrics.py
示例17: test_soup
def test_soup(self):
if is_osx():
return
session = Soup.Session.new()
request = session.request_http("get", self.URI)
request.send(None).close()
开发者ID:rshafto,项目名称:quodlibet,代码行数:6,代码来源:test_https.py
示例18: test_gio
def test_gio(self):
if is_osx():
return
client = Gio.SocketClient.new()
client.set_tls(True)
client.connect_to_uri(self.URI, 443, None).close()
开发者ID:rshafto,项目名称:quodlibet,代码行数:6,代码来源:test_https.py
示例19: is_windows
# -*- coding: utf-8 -*-
# Copyright 2016 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
from tests import TestCase, skipUnless
from gi.repository import Gio, Soup
from quodlibet.util import is_osx, is_windows
from quodlibet.compat import urlopen
@skipUnless(is_osx() or is_windows(), "not on linux")
class Thttps(TestCase):
"""For Windows/OSX to check if we can create a TLS connection
using both openssl and whatever backend soup/gio uses.
"""
URI = "https://www.google.com"
def test_urllib(self):
if is_windows():
# FXIME
return
urlopen(self.URI).close()
def test_gio(self):
if is_osx():
开发者ID:rshafto,项目名称:quodlibet,代码行数:31,代码来源:test_https.py
示例20: test_is_accel_primary
def test_is_accel_primary(self):
e = Gdk.Event.new(Gdk.EventType.KEY_PRESS)
e.keyval = Gdk.KEY_Return
e.state = Gdk.ModifierType.CONTROL_MASK
if not util.is_osx():
self.assertTrue(qltk.is_accel(e, "<Primary>Return"))
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:6,代码来源:test_qltk___init__.py
注:本文中的quodlibet.util.is_osx函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论