> On Sep 21, 2018, at 4:50 AM, Ronald Oussoren <ronaldousso...@mac.com> wrote:
> 
> 
> 
>> On 21 Sep 2018, at 05:59, Glyph <gl...@twistedmatrix.com 
>> <mailto:gl...@twistedmatrix.com>> wrote:
>> 
>> On Sep 18, 2018, at 1:22 PM, Ronald Oussoren via Pythonmac-SIG 
>> <pythonmac-sig@python.org <mailto:pythonmac-sig@python.org>> 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).

If there were a more modern solution I'd gladly use it rather than asking you 
to expose gross and ancient Carbon APIs :).  Which APIs that are already 
exposed can do this?

>> 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.

Thanks!

>> -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? 

Sure, sometime this weekend I'll try to write it up.

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to