当前位置: 首页>>代码示例>>Python>>正文


Python objc.pathForFramework方法代码示例

本文整理汇总了Python中objc.pathForFramework方法的典型用法代码示例。如果您正苦于以下问题:Python objc.pathForFramework方法的具体用法?Python objc.pathForFramework怎么用?Python objc.pathForFramework使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在objc的用法示例。


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

示例1: fact

# 需要导入模块: import objc [as 别名]
# 或者: from objc import pathForFramework [as 别名]
def fact():
    """Returns the current bluetooth sharing"""

    result = "None"

    objc.loadBundle(
        "IOBluetooth",
        globals(),
        bundle_path=objc.pathForFramework(
            u"/System/Library/Frameworks/IOBluetooth.framework"
        ),
    )
    btprefs = IOBluetoothPreferences.alloc().init()
    result = bool(btprefs.fileTransferServicesEnabled())

    return {factoid: result} 
开发者ID:chilcote,项目名称:unearth,代码行数:18,代码来源:bluetooth_sharing.py

示例2: WMEnable

# 需要导入模块: import objc [as 别名]
# 或者: from objc import pathForFramework [as 别名]
def WMEnable(name='Python'):
    if isinstance(name, unicode):
        name = name.encode('utf8')
    mainBundle = NSBundle.mainBundle()
    bPath = os.path.split(os.path.split(os.path.split(sys.executable)[0])[0])[0]
    if mainBundle.bundlePath() == bPath:
        return True
    bndl = NSBundle.bundleWithPath_(objc.pathForFramework('/System/Library/Frameworks/ApplicationServices.framework'))
    if bndl is None:
        print('ApplicationServices missing', file=sys.stderr)
        return False
    d = {}
    objc.loadBundleFunctions(bndl, d, FUNCTIONS)
    for (fn, sig) in FUNCTIONS:
        if fn not in d:
            print('Missing', fn, file=sys.stderr)
            return False
    err, psn = d['GetCurrentProcess']()
    if err:
        print('GetCurrentProcess', (err, psn), file=sys.stderr)
        return False
    err = d['CPSSetProcessName'](psn, name)
    if err:
        print('CPSSetProcessName', (err, psn), file=sys.stderr)
        return False
    err = d['CPSEnableForegroundOperation'](psn)
    if err:
        #print >>sys.stderr, 'CPSEnableForegroundOperation', (err, psn)
        return False
    err = d['SetFrontProcess'](psn)
    if err:
        print('SetFrontProcess', (err, psn), file=sys.stderr)
        return False
    return True 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:36,代码来源:backend_cocoaagg.py

示例3: WMEnable

# 需要导入模块: import objc [as 别名]
# 或者: from objc import pathForFramework [as 别名]
def WMEnable(name='Python'):
    if isinstance(name, six.text_type):
        name = name.encode('utf8')
    mainBundle = NSBundle.mainBundle()
    bPath = os.path.split(os.path.split(os.path.split(sys.executable)[0])[0])[0]
    if mainBundle.bundlePath() == bPath:
        return True
    bndl = NSBundle.bundleWithPath_(objc.pathForFramework('/System/Library/Frameworks/ApplicationServices.framework'))
    if bndl is None:
        print('ApplicationServices missing', file=sys.stderr)
        return False
    d = {}
    objc.loadBundleFunctions(bndl, d, FUNCTIONS)
    for (fn, sig) in FUNCTIONS:
        if fn not in d:
            print('Missing', fn, file=sys.stderr)
            return False
    err, psn = d['GetCurrentProcess']()
    if err:
        print('GetCurrentProcess', (err, psn), file=sys.stderr)
        return False
    err = d['CPSSetProcessName'](psn, name)
    if err:
        print('CPSSetProcessName', (err, psn), file=sys.stderr)
        return False
    err = d['CPSEnableForegroundOperation'](psn)
    if err:
        #print >>sys.stderr, 'CPSEnableForegroundOperation', (err, psn)
        return False
    err = d['SetFrontProcess'](psn)
    if err:
        print('SetFrontProcess', (err, psn), file=sys.stderr)
        return False
    return True 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:36,代码来源:backend_cocoaagg.py


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