Re: [Pyobjc-dev] [Pythonmac-SIG] [ANN] PyObjC 5.0
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2018-09-21 11:51:53
|
> On 21 Sep 2018, at 05:59, Glyph <gl...@tw...> wrote: > > On Sep 18, 2018, at 1:22 PM, Ronald Oussoren via Pythonmac-SIG <pyt...@py... <mailto:pyt...@py...>> wrote: >> >> PyObjC 5.0 is out > > Thanks again for your tireless (or at least apparently tireless) maintenance, Ronald! > >> * Added bindings for the “CarbonCore” subframework of the “CoreServices” framework. >> >> Most APIs in this subframework are not available to Python, only those APIs that are not deprecated and seem interesting are exposed. > > One thing I wondered about when I saw "carbon" here is that I wonder if the APIs that could make https://pythonhosted.org/pyobjc/examples/Cocoa/AppKit/HotKeyPython/index.html <https://pythonhosted.org/pyobjc/examples/Cocoa/AppKit/HotKeyPython/index.html> are exposed again? The API used in that example is not exposed through PyObjC at this time (AFAIK it is part of “Carbon.framework”, not the CarbonCore sub framework of “CoreServices.framework”. I’m open to adding bindings to interesting APIs, but note that “RegisterEventHotKey” is not documented on Apple’s website and might not be the right solution for modern code. I don’t know yet what the right solution is though (a number of APIs that are exposed through PyObjC can be used to implement similar functionality). > The cautions that the relevant Carbon APIs require 32-bit mode are inaccurate; https://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html <https://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html> explains that they're still supported in sandboxed Mac App Store apps, so they're just poorly documented, not deprecated. (It seems that there's never been a proper Cocoa replacement for this functionality, just a couple of popular wrappers floating around out there…) > > This is something I have wanted to do in Python many times, but never quite badly enough to figure out all the build gymnastics required to get the bindings for https://github.com/shpakovski/MASShortcut <https://github.com/shpakovski/MASShortcut> built and bundled with my application. I’ll look into exposing this API for PyObjC 5.1, even if that means adding a very limited set of bindings for Carbon.framework. > > -glyph > > P.S.: speaking of build gymnastics, does anyone on this list happen to have a way to use CocoaPods or something similar to pull in open source Cocoa frameworks to a PyObjC application? I haven’t looked into this yet. I guess the hardest part is creating the metadata for constants and pointer arguments. Could you file and issue for this? Ronald |