how to add methods to this class in this case?
Burak Nehbit <[email protected]> Sat, 9 Nov 2013 14:27:26 -0500
| Newsgroups | gmane.comp.python.pyobjc.devel |
|---|---|
| Message-ID | <[email protected]> |
(Sorry for the double post, my mail client glitched—this is the full one.)
Hi there,
I am building a Qt application called Aether (www.getaether.net).
For its Mac version, I have run into the problem of Qt not being able to detect and raise events to Mac’s dock icon clicks. This is an essential and widely used feature on OS X that is completely ignored by Qt, and I want to provide my users this functionality.
I have found a way to do this on C++ here:
http://aksenkin.blogspot.com/2012/02/how-to-handle-click-on-app-icon-in-mac.html
I am using Python, so I need to accomplish it using PyObjC. I have written the following piece of code so far:
@objc.signature('B@:')
def applicationShouldHandleReopen_hasVisibleWindows_(self, sender):
print('hello!')
app.onClickOnDock()
return True
cls = objc.lookUpClass('NSApplication')
appInstance = cls.sharedApplication # I'm doing some real crazy runtime shit there.
#print(cls, appInstance)
delegate = appInstance.definingClass.delegate
delClass = delegate.definingClass
objc.classAddMethods(cls, [applicationShouldHandleReopen_hasVisibleWindows_])
But this has no effect. No method gets triggered, nothing happens. I have little to no C++ knowledge, so I am probably missing a nuance in the translation. Can anyone point me in the right direction?
Regards,
Burak
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Pyobjc-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyobjc-dev