Python objc.pathForFramework() Examples
The following are 5
code examples of objc.pathForFramework().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
objc
, or try the search function
.
Example #1
Source File: bluetooth_sharing.py From unearth with Apache License 2.0 | 6 votes |
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}
Example #2
Source File: backend_cocoaagg.py From Computable with MIT License | 5 votes |
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
Example #3
Source File: backend_cocoaagg.py From matplotlib-4-abaqus with MIT License | 5 votes |
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
Example #4
Source File: backend_cocoaagg.py From neural-network-animation with MIT License | 5 votes |
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
Example #5
Source File: backend_cocoaagg.py From ImageFusion with MIT License | 5 votes |
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