本文整理匯總了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}
示例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
示例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