當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。