pyobjc

PyObjc vs RubyCocoa for Mac development: Which is more mature?

纵饮孤独 提交于 2019-11-30 15:21:15
问题 I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming. So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa). I know that ideally to get the best learning experience I would learn each techonology independently but I don't have the time. :) So my question is which is a more mature platform, PyObc or RubyCocoa, main

PyObjc vs RubyCocoa for Mac development: Which is more mature?

。_饼干妹妹 提交于 2019-11-30 13:46:21
I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming. So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa). I know that ideally to get the best learning experience I would learn each techonology independently but I don't have the time. :) So my question is which is a more mature platform, PyObc or RubyCocoa, main things I am looking for: Documentation of API Tutorials Tools Supportive Community Completness of Cocoa

How can I create a status bar item with Cocoa and Python (PyObjC)?

為{幸葍}努か 提交于 2019-11-30 13:44:00
I have created a brand new project in XCode and have the following in my AppDelegate.py file: from Foundation import * from AppKit import * class MyApplicationAppDelegate(NSObject): def applicationDidFinishLaunching_(self, sender): NSLog("Application did finish launching.") statusItem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength) statusItem.setTitle_(u"12%") statusItem.setHighlightMode_(TRUE) statusItem.setEnabled_(TRUE) However, when I launch the application no status bar item shows up. All the other code in main.py and main.m is default. I had to do this

Working with Mountain Lion's Notification Center using PyObjC

倾然丶 夕夏残阳落幕 提交于 2019-11-30 05:17:51
I'm trying to send notifications to Mountain Lion from my python script and react to clicks on the notifications. Sending the notifications works perfectly find by now. But yet I was not able to get Lion to call back my script upon a click. Here is what I do. I implemented a Notification class. The only purpose of an instance of that class is to provide notifications by invoking notify() . In the same method I set the object the app's delegate. import Foundation import objc import AppKit class MountainLionNotification(Foundation.NSObject, Notification): def notify(self, title, subtitle, text,

Create (sane/safe) filename from any (unsafe) string

故事扮演 提交于 2019-11-30 03:06:51
I want to create a sane/safe filename (i.e. somewhat readable, no "strange" characters, etc.) from some random Unicode string (mich might contain just anything). (It doesn't matter for me wether the function is Cocoa, ObjC, Python, etc.) Of course, there might be infinite many characters which might be strange. Thus, it is not really a solution to have a blacklist and to add more and more to that list over the time. I could have a whitelist. However, I don't really know how to define it. [a-zA-Z0-9 .] is a start but I also want to accept unicode chars which can be displayed in a normal way.

PyObjC and returning 'out' parameters (i.e. NSError **)

蓝咒 提交于 2019-11-29 15:30:02
I'm implementing an ObjC protocol as a mix-in for a PyObjC class. This protocol defines an 'out' parameter. I am unable to find any good documentation on how a Python class which implements an ObjC protocol defining this is to behave. I've found this mailing list thread but the suggestion in there does not work. They say to return a Python list with the method's return value as the first item and the out parameter as the second. I've tried this and all I get is an exception when calling from ObjC ( <type 'exceptions.ValueError'>: depythonifying 'char', got 'tuple' ). It seems PyObjC strictly

Working with Mountain Lion's Notification Center using PyObjC

被刻印的时光 ゝ 提交于 2019-11-29 03:14:20
问题 I'm trying to send notifications to Mountain Lion from my python script and react to clicks on the notifications. Sending the notifications works perfectly find by now. But yet I was not able to get Lion to call back my script upon a click. Here is what I do. I implemented a Notification class. The only purpose of an instance of that class is to provide notifications by invoking notify() . In the same method I set the object the app's delegate. import Foundation import objc import AppKit

How to stop an NSInvocationOperation?

和自甴很熟 提交于 2019-11-29 02:08:14
I have an NSInvocationOperation that would download and parse a series of NSXMLDocuments in the background to my UI responsive. My attempt at stopping the Invocation operation is to call my NSOperationQueue's cancellAllOperations. But it seems that this won't stop the invocation's execution. Any ideas on how would I go about this problem? It's up to the implementation of your NSOperation object to actually stop what it's doing, clean up, and exit when it gets notified that it's been cancelled. Messaging that you want to cancel all operations on the queue will cause the queue to stop dequeueing

Why is the PyObjC documentation so bad? [closed]

[亡魂溺海] 提交于 2019-11-29 01:23:42
For example, http://developer.apple.com/cocoa/pyobjc.html is still for OS X 10.4 Tiger, not 10.5 Leopard.. And that's the official Apple documentation for it.. The official PyObjC page is equally bad, http://pyobjc.sourceforge.net/ It's so bad it's baffling.. I'm considering learning Ruby primarily because the RubyCocoa stuff is so much better documented, and there's lots of decent tutorials ( http://www.rubycocoa.com/ for example), and because of the Shoes GUI toolkit.. Even this badly-auto-translated Japanese tutorial is more useful than the rest of the documentation I could find.. All I

Create (sane/safe) filename from any (unsafe) string

℡╲_俬逩灬. 提交于 2019-11-28 23:36:38
问题 I want to create a sane/safe filename (i.e. somewhat readable, no "strange" characters, etc.) from some random Unicode string (mich might contain just anything). (It doesn't matter for me wether the function is Cocoa, ObjC, Python, etc.) Of course, there might be infinite many characters which might be strange. Thus, it is not really a solution to have a blacklist and to add more and more to that list over the time. I could have a whitelist. However, I don't really know how to define it. [a