pyobjc-dev Mailing List for PyObjC (Page 201)
Brought to you by:
ronaldoussoren
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(1) |
Feb
(2) |
Mar
(3) |
Apr
(30) |
May
(18) |
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2002 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
(13) |
Aug
|
Sep
(23) |
Oct
(180) |
Nov
(291) |
Dec
(95) |
2003 |
Jan
(338) |
Feb
(352) |
Mar
(97) |
Apr
(46) |
May
(226) |
Jun
(184) |
Jul
(145) |
Aug
(141) |
Sep
(69) |
Oct
(161) |
Nov
(96) |
Dec
(90) |
2004 |
Jan
(66) |
Feb
(87) |
Mar
(98) |
Apr
(132) |
May
(115) |
Jun
(68) |
Jul
(150) |
Aug
(92) |
Sep
(59) |
Oct
(52) |
Nov
(17) |
Dec
(75) |
2005 |
Jan
(84) |
Feb
(191) |
Mar
(133) |
Apr
(114) |
May
(158) |
Jun
(185) |
Jul
(62) |
Aug
(28) |
Sep
(36) |
Oct
(88) |
Nov
(65) |
Dec
(43) |
2006 |
Jan
(85) |
Feb
(62) |
Mar
(92) |
Apr
(75) |
May
(68) |
Jun
(101) |
Jul
(73) |
Aug
(37) |
Sep
(91) |
Oct
(65) |
Nov
(30) |
Dec
(39) |
2007 |
Jan
(24) |
Feb
(28) |
Mar
(10) |
Apr
(2) |
May
(18) |
Jun
(16) |
Jul
(21) |
Aug
(6) |
Sep
(30) |
Oct
(31) |
Nov
(153) |
Dec
(31) |
2008 |
Jan
(63) |
Feb
(70) |
Mar
(47) |
Apr
(24) |
May
(59) |
Jun
(22) |
Jul
(12) |
Aug
(7) |
Sep
(14) |
Oct
(26) |
Nov
(5) |
Dec
(5) |
2009 |
Jan
(10) |
Feb
(41) |
Mar
(70) |
Apr
(88) |
May
(49) |
Jun
(62) |
Jul
(34) |
Aug
(15) |
Sep
(55) |
Oct
(40) |
Nov
(67) |
Dec
(21) |
2010 |
Jan
(60) |
Feb
(17) |
Mar
(26) |
Apr
(26) |
May
(29) |
Jun
(4) |
Jul
(21) |
Aug
(21) |
Sep
(10) |
Oct
(12) |
Nov
(3) |
Dec
(19) |
2011 |
Jan
(3) |
Feb
(13) |
Mar
(8) |
Apr
(8) |
May
(17) |
Jun
(20) |
Jul
(21) |
Aug
(7) |
Sep
|
Oct
|
Nov
(9) |
Dec
(11) |
2012 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
(4) |
Jun
(14) |
Jul
(5) |
Aug
(2) |
Sep
(15) |
Oct
(2) |
Nov
(23) |
Dec
(1) |
2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
(5) |
Jun
(1) |
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(12) |
Nov
(10) |
Dec
(3) |
2014 |
Jan
(7) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(11) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
(8) |
Nov
(1) |
Dec
(2) |
2015 |
Jan
(9) |
Feb
(7) |
Mar
(1) |
Apr
|
May
(7) |
Jun
|
Jul
(5) |
Aug
(6) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2016 |
Jan
(1) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(8) |
Sep
(21) |
Oct
(17) |
Nov
|
Dec
(36) |
2017 |
Jan
(6) |
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(6) |
2018 |
Jan
(2) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(2) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(16) |
Nov
(1) |
Dec
(6) |
2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(2) |
Dec
(1) |
2021 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2025 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Marc-Antoine P. <map...@ac...> - 2004-01-21 17:49:45
|
> The simple fact of the matter is that NSString is the equivalent to > python's unicode. If you unicode('something-with-latin-1') then you > will get an exception. There is no reason whatsoever to put arbitrary > data in a NSString unless you know its encoding. That sentence agrees with my point the second time: What if I _do_ know the encoding, and I want to tell the bridge about it? Your point is that I should convert strings to unicode before the bridge; my point is that I may be calling the bridge in quite a few places, and converting there may not be practical. Whereas if the bridge had a simple API, viz. PyObjC.setStringEncoding(str) PyObjC.getStringEncoding() getting and setting a variable which defaults to the system's default encoding, then it would be easy to still use (single-byte) strings in Python if so desired (again, do realize that one is often dealing with someone else's code, and reengineering it is not always practical.) > If you want/need to exchange arbitrary data you're going to have to > explicitly put it in NSData. That would be valid for arbitrary data; but strings of a _known_ encoding are not arbitrary data. > I would almost vote to *disable* the str<->NSString bridge in PyObjC, > or make it bridge NSData instead, but that would just be terribly > inconvenient for many people. Indeed. Marc-Antoine Parent |
From: Bob I. <bo...@re...> - 2004-01-21 17:41:03
|
On Jan 21, 2004, at 12:38 PM, Ronald Oussoren wrote: > > On 21 jan 2004, at 18:20, Marc-Antoine Parent wrote: > [...] >> So let me then make a plea for an API so that a PyObjC program can >> tell the bridge to use an encoding other than the system default, if >> specified, even if the default behaviour remains identical, i.e. >> throw exceptions upon non-ascii strings. > > I don't like introducing global switches like this, libraries may > modify the switch and change the behaviour of other code. > > Too bad that sitecustomize.py cannot in the same directory as a script > (dirname(sys.argv[0] is added after site.py finishes). BTW. does > anyone know why sys.setdefaultencoding is removed in site.py? E.g. why > is it good that users cannot change the default encoding after the > interpreter has initialized? sys.setdefaultencoding is probably removed in site.py for the same reason you don't like global switches.. someone could sys.setdefaultencoding in a module that you use, for example. -bob |
From: Ronald O. <ous...@ci...> - 2004-01-21 17:38:08
|
On 21 jan 2004, at 18:20, Marc-Antoine Parent wrote: [...] > So let me then make a plea for an API so that a PyObjC program can > tell the bridge to use an encoding other than the system default, if > specified, even if the default behaviour remains identical, i.e. throw > exceptions upon non-ascii strings. I don't like introducing global switches like this, libraries may modify the switch and change the behaviour of other code. Too bad that sitecustomize.py cannot in the same directory as a script (dirname(sys.argv[0] is added after site.py finishes). BTW. does anyone know why sys.setdefaultencoding is removed in site.py? E.g. why is it good that users cannot change the default encoding after the interpreter has initialized? > That way, only a program that knows what it is doing will modify the > behaviour, and no data will be lost by default; but a program that has > good architectural reasons to do so might still use another encoding > internally. Unicode should be good enough for this. The strings used by Cocoa are Unicode strings there's not much you can do about this. Ronald |
From: Bob I. <bo...@re...> - 2004-01-21 17:28:42
|
On Jan 21, 2004, at 12:20 PM, Marc-Antoine Parent wrote: >> We had this (short) discussion before: >> http://sourceforge.net/mailarchive/message.php?msg_id=6595522 > > Thank you for pointing it out; I had not seen it. > >> I've come to the conclusion that if the Python program doesn't handle >> all text as unicode, then it's broken. This is really just PyObjC >> telling you to fix your code. > > I only partially agree. It is true that internally, a Python program > should use unicode all the way; but nobody should force me to use > unicode on the output. The case I am raising is that I have a Python > program with Latin-1 output, which is picked up by another Python > program, which is encoding-agnostic, and transfers it to the bridge. > The two programs are totally disconnected, except through I/O, and > that I/O may use another encoding. > > Now, maybe what you are saying amounts to the suggestion that the > second program should know (or be told) about the encoding of the > first program's output; and that makes sense. However, there may be > cases, such as mine, where it makes sense for the Python program to > use encoded (non-unicode) data internally, and not to care about it, > and (supposing I know the encoding) I should not have to convert to > unicode before calling the bridge at every point. > (Granted, in this case, we could convert to unicode at the interface > between both programs, but that may not always be the case...) > So let me then make a plea for an API so that a PyObjC program can > tell the bridge to use an encoding other than the system default, if > specified, even if the default behaviour remains identical, i.e. throw > exceptions upon non-ascii strings. > That way, only a program that knows what it is doing will modify the > behaviour, and no data will be lost by default; but a program that has > good architectural reasons to do so might still use another encoding > internally. The simple fact of the matter is that NSString is the equivalent to python's unicode. If you unicode('something-with-latin-1') then you will get an exception. There is no reason whatsoever to put arbitrary data in a NSString unless you know its encoding. If you want/need to exchange arbitrary data you're going to have to explicitly put it in NSData. I would almost vote to *disable* the str<->NSString bridge in PyObjC, or make it bridge NSData instead, but that would just be terribly inconvenient for many people. -bob |
From: Marc-Antoine P. <map...@ac...> - 2004-01-21 17:20:08
|
> We had this (short) discussion before: > http://sourceforge.net/mailarchive/message.php?msg_id=6595522 Thank you for pointing it out; I had not seen it. > I've come to the conclusion that if the Python program doesn't handle > all text as unicode, then it's broken. This is really just PyObjC > telling you to fix your code. I only partially agree. It is true that internally, a Python program should use unicode all the way; but nobody should force me to use unicode on the output. The case I am raising is that I have a Python program with Latin-1 output, which is picked up by another Python program, which is encoding-agnostic, and transfers it to the bridge. The two programs are totally disconnected, except through I/O, and that I/O may use another encoding. Now, maybe what you are saying amounts to the suggestion that the second program should know (or be told) about the encoding of the first program's output; and that makes sense. However, there may be cases, such as mine, where it makes sense for the Python program to use encoded (non-unicode) data internally, and not to care about it, and (supposing I know the encoding) I should not have to convert to unicode before calling the bridge at every point. (Granted, in this case, we could convert to unicode at the interface between both programs, but that may not always be the case...) So let me then make a plea for an API so that a PyObjC program can tell the bridge to use an encoding other than the system default, if specified, even if the default behaviour remains identical, i.e. throw exceptions upon non-ascii strings. That way, only a program that knows what it is doing will modify the behaviour, and no data will be lost by default; but a program that has good architectural reasons to do so might still use another encoding internally. Marc-Antoine Parent |
From: Bob I. <bo...@re...> - 2004-01-21 16:49:17
|
On Jan 21, 2004, at 11:24 AM, Marc-Antoine Parent wrote: > I am writing some Python code that has to output Latin-1 text. > Some of that output makes its way through other (python) code to a > text widget through insertText_. The other code does not know about my > encoding choice, as it is not my code, but Glenn Andreas' PyOxide IDE; > it should not know about encoding. So it simply passes along my > Latin-1 strings to the insertText_ method of a text widget, where the > PyObjC bridge tries to make it into a NSString. We had this (short) discussion before: http://sourceforge.net/mailarchive/message.php?msg_id=6595522 I've come to the conclusion that if the Python program doesn't handle all text as unicode, then it's broken. This is really just PyObjC telling you to fix your code. Here's some important snippets that helped me come to this conclusion: [Just van Rossum] Strongly disagree. This leads to silent errors, possibly even data loss. You _have_ to know the encoding, and you _have_ to deal with it. If there's no way you can know the encoding, you have to explicitly tell which encoding or behavior to use. Btw. it's not so much PyObjC's behavior, but Python's default str -> unicode coercion behavior. Perhaps it's "fixable" in the bridge, but I think it's a bad idea to deviate from Python's behavior (in addition to that I find it a bad idea to begin with). [Ronald Oussoren] BTW. You should convert all input to unicode instead of waiting for problems with the implicit conversion to unicode that is performed by PyObjC. You're more likely to know the right encoding while reading the data. -bob |
From: Marc-Antoine P. <map...@ac...> - 2004-01-21 16:24:15
|
Good day, all! I am writing some Python code that has to output Latin-1 text. Some of that output makes its way through other (python) code to a text widget through insertText_. The other code does not know about my encoding choice, as it is not my code, but Glenn Andreas' PyOxide IDE; it should not know about encoding. So it simply passes along my Latin-1 strings to the insertText_ method of a text widget, where the PyObjC bridge tries to make it into a NSString. In objc_support.c, in int depythonify_c_value (const char *type, PyObject *argument, void *datum) We have the following code (currently around line 1300:) as_unicode = PyUnicode_Decode( strval, len, PyUnicode_GetDefaultEncoding(), "strict"); if (as_unicode == NULL) { PyErr_Format(PyExc_UnicodeError, "depythonifying 'id', got " "a string with a non-default " "encoding"); return -1; } Now, it turns out that the DefaultEncoding is ascii, unless specified otherwise in PyUnicode_SetDefaultEncoding.... (from /System/Library/Frameworks/Python.framework/Headers/unicodeobject.h) Now, that means that in many cases, I get the immediately following error and no output at all. It is fairly easy to set the default encoding at startup (thanks to Glenn for pointing this out to me) using sys.setdefaultencoding('iso-8859-1') in a sitecustomize.py. However, this can only be done at Python startup, and I fear many users of the bridge may not know about this limitation. I propose that the PyObjC bridge use a less restrictive encoding than the current (bizarre) platform default, so as to allow Python to output encoded text to Cocoa widgets. (Maybe the bridge should have a hook to set the platforn default when the Python subsystem is started?) I suggest Latin 1, as it is the most common encoding, and the one most likely to be used by most (unix-written) Python code; even if the python code uses another encoding, as Latin-1 lets bytes pass through identically to widgets, if the user sees gibbersih it will be familiar gibberish. But I am sure a case could be made for mac-roman as well. Another solution (Glenn's suggestion) is to at least not decode it 'strict'ly, using 'ignore' or at worst 'replace' to allow some of the text at least to reach the user... Whatever the correct solution, I feel that the current situation (rejecting any encoded non-ascii text) is overly restrictive. Thank you for your attention, Marc-Antoine Parent |
From: Bob I. <bo...@re...> - 2004-01-21 16:22:37
|
I just came across this: http://www.opengroupware.org/ It's a groupware server written for GNUStep. The core frameworks seem to be portable to OS X, however the project itself is not fully portable yet (gnustep-db, etc): http://www.opengroupware.org/en/projects/macosx/index.html Anyways, I'm mentioning this because it'd be a great reason to make PyObjC/GNUStep work well, because it could be used as an extension that makes it easy to add new features for OGo, leverage existing Python libraries, etc. -bob |
From: Neves <Loo...@29...> - 2004-01-19 11:21:38
|
E-mail is the fastest growing marketing tool. We offer E-mail Marketing with quality service and the lowest prices. 1. Targeted E-mail Addresses We can provide targeted e-mail addresses you need, which are compiled only on your order. We will customize your customer e-mail addresses. * We have millions of e-mail addresses in a wide variety of categories. 2. Send out Targeted E-mails for you We can send your e-mail message to your targeted customers! We will customize your email addresses and send your message for you. * We can Bullet-Proof your Web Site. We also offer a wide variety of marketing software. For more details, you can refer to: Http://www.Marketing-Savant.com Looking forward to serving you, and your business needs! Regards! Tony Madu Marketing Support www.Marketing-Savant.com Sa...@Ma... ************************************************************************* To remove your address from list: http://quicktell.net/responder/delist.cgi/q/3/17134747/142960 ************************************************************************* |
From: Ronald O. <ous...@ci...> - 2004-01-17 07:15:35
|
On 17 jan 2004, at 7:29, Bob Ippolito wrote: > Did you forget to check something in, Ronald? Sorry about that. They (there's also a method-imp.m) should be in now. Ronald |
From: Bob I. <bo...@re...> - 2004-01-17 06:27:12
|
Did you forget to check something in, Ronald? [crack:pyobjc/Modules/objc] bob% cvs diff -r 1.52 -r 1.53 pyobjc.h Index: pyobjc.h =================================================================== RCS file: /cvsroot/pyobjc/pyobjc/Modules/objc/pyobjc.h,v retrieving revision 1.52 retrieving revision 1.53 diff -r1.52 -r1.53 45a46 > #include "method-imp.h" There is no method-imp.h :( -bob |
From: b.bum <bb...@ma...> - 2004-01-16 17:32:08
|
On Jan 16, 2004, at 9:03 AM, Jon Israelson wrote: > Let me know if this is not the right forum for posting this type of > question... > > I've got two questions: > > 1. Is the use of Bindings and the associated NSController-based > classes > that were introduced in 10.3 supported by PyObjC? Yes. There is one known bug. > 2. If supported, are there any sample applications that demonstrate > this available? There are quite a number, actually. WebServicesTool w/Twisted & the Controller Layer is probably the most complete example. > I've been trying to build the Currency Converter with Bindings example > app found here > http://developer.apple.com/documentation/Cocoa/Conceptual/ > CocoaBindings/ > index.html#//apple_ref/doc/uid/10000167i, but have been encountering > seg-faults when the app loads. The app ran fine until I established > the > bindings between the NSObjectController and my Model class. Thanks in > advance for your help. If you are seeing an infinite loop, that is the known bug. I believe Ronald has a fix committed. Have you built PyObjC from the CVS repository (a really good idea anyway as many things have been fixed or changed). b.bum |
From: Bob I. <bo...@re...> - 2004-01-16 17:17:48
|
On Jan 16, 2004, at 12:03 PM, Jon Israelson wrote: > Let me know if this is not the right forum for posting this type of > question... > > I've got two questions: > > 1. Is the use of Bindings and the associated NSController-based > classes > that were introduced in 10.3 supported by PyObjC? Yes, but you probably want to use CVS head. > 2. If supported, are there any sample applications that demonstrate > this available? There's a version of WebServicesTool that uses bindings (called controller layer in the example), but it requires Twisted. We should, but don't, have an example that only shows bindings. > I've been trying to build the Currency Converter with Bindings example > app found here > http://developer.apple.com/documentation/Cocoa/Conceptual/ > CocoaBindings/ > index.html#//apple_ref/doc/uid/10000167i, but have been encountering > seg-faults when the app loads. The app ran fine until I established > the > bindings between the NSObjectController and my Model class. Thanks in > advance for your help. How about some code? -bob |
From: Jon I. <JIs...@na...> - 2004-01-16 17:03:57
|
Let me know if this is not the right forum for posting this type of question... I've got two questions: 1. Is the use of Bindings and the associated NSController-based classes that were introduced in 10.3 supported by PyObjC? 2. If supported, are there any sample applications that demonstrate this available? I've been trying to build the Currency Converter with Bindings example app found here http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/ index.html#//apple_ref/doc/uid/10000167i, but have been encountering seg-faults when the app loads. The app ran fine until I established the bindings between the NSObjectController and my Model class. Thanks in advance for your help. Jon |
From: <lp...@fr...> - 2004-01-13 17:48:27
|
未承諾広告※ 関心のない方はお手数ですが削除してください。 (送信者)竹内 友紀 (事業者)リーディング パートナー Co.,Ltd (TEL)0120-40-8689 (所在地)愛知県名古屋市中川区牛立町3−48−5 ※当方からの広告を希望されない方は、お手数ですが『受信拒否』 として拒否対象アドレスも併せてご返信ください。 (返信アドレス)lp...@le... 返信メール受信して1日後、拒否者アドレスは除去いたします。 *在宅(SOHO.パソコン)ワークのスタッフ募集のご案内です。* 〇最近給与カットされ将来に御不安をお持ちの方 〇最近不景気のため、残業したくてもできない方 〇子供が目に届く範囲で仕事をしたい方 〇わずらわしい職場の人間関係などに悩みたくない方 〇地方ということで、なかなか希望の職種に巡り会えない方 〇空いてる時間を利用して趣味や特技で副収入が得られたらという方 〇資格はないけど仕事ができたらという方 会社員の方や主婦の方、現状のお仕事をしながら副収入が得られた らとお考えの方を支援する在宅ワークのご案内です。 在宅でお仕事をしながら、パソコン技能を活かしてお仕事の幅を広 げ、将来の安定性をつかんでいただいてます。 業種は、データ入力、DTP、HP作成、テープ起こし、プログラミング、 ロゴ・キャラクター作成等々幅広くあります。 登録者には、週に1〜2回程メルマガ方式で様々なお仕事情報を配信 しております。 **資格はなくてもやる気のある方でしたらお仕事はできます** 現在20歳以上の主婦・アルバイター・会社員・高齢者の方々が活躍 しています。 ☆★☆★☆〜よく寄せられる質問Q&A〜☆★☆★☆ Q>最近よくTVや周りの人から、この手のものは悪徳業者が多いと 聞きますが? Q>本当に仕事はある? Q>将来的にもパソコン関係の仕事は大丈夫なの? Q>仕事をするとちゃんと報酬は取れますか? Q>仕事をするために資格教材を購入したり、認定試験にパスして から出ないと仕事をさせてもらえないといった条件が多くありま すが? Q>仕事は難しくないのですか? Q>OSやアプリケーションソフトは何が必要でしょうか? Q>入力のみの仕事はあるのですか? このような質問や御不安をお持ちの方、詳しくは下記ホームページで お気軽に資料請求(無料)してください。 (URL)http://www.leading-part.com ※この広告が重複した場合は、決して悪意はございませんので、 ご容赦願います。拒否者の除去には十分注意して参ります。 ※東京に本部があります全国展開事業の為、代理店が数社ありま す。その為、重複いたしましたらご容赦ください。情報交換が 不可能のため、ご迷惑おかけして申し訳ございませんが、受信 拒否希望の方はお手数ですが、各送信先に受信拒否として自動 返信していただくか、着信拒否の設定をお願い申し上げます。 |
From: Ronald O. <ous...@ci...> - 2004-01-13 06:03:57
|
On 13 jan 2004, at 1:18, Bob Ippolito wrote: > It's been three months since we've had a release. There's been a lot > of good things since 1.0, I think we should gear up for a 1.1 release. > > Thoughts? I agree. The most important missing feature for a 1.1 release is the installer package for Panther, and that won't write itself (it's been on my TODO list since before the release of Panther). I have a semi-functional rewrite of Scripts/buildpkg.py lying around, but we should probably just do something crude for the 1.1 release. *After* the 1.1 release we should focus on cleaning up the release scripts. Ronald |
From: Bob I. <bo...@re...> - 2004-01-13 00:16:29
|
It's been three months since we've had a release. There's been a lot of good things since 1.0, I think we should gear up for a 1.1 release. Thoughts? -bob |
From: Jiva D. <ji...@de...> - 2004-01-10 23:33:44
|
I would like to respectfully submit the following clarification/documentation for the docs page on pyobjc.sourceforge.net. (Credit to bbum for the basics, all I am adding is some example code to make it clear.) --------- Instantiating Python Classes from Obj-C First, follow these instructions:http://pyobjc.sourceforge.net/doc/ extending_objc_with_python.php to add python to your PyObjC app. Ok, that's the hard part. From here, everything is easy. Once you have imported your Python class, you can do this: @class MyPythonClass @implementation MyObjCClassCallingMyPythonClass -(void)aMethod { id myPythonObj = [[MyPythonClass alloc] init]; [myPythonObj someMethodInPython]; } @end Assuming you have a "MyPythonClass" defined in a python module in your resources directory. What this means, is basically PyObjC magically does it for you. Nothing else is needed. Now this will all work, and as long as you don't mind warnings when compiling... this is great. But, being obsessive about such things, we probably want to get rid of the compile warnings we're getting. To solve this problem, use an abstract superclass implemented in Objective-C (a class that simply declares all the methods where the implementation is stubbed out) and a concrete subclass implemented in Python. To the abstract superclass-- the objc class-- add a factory method that instantiates and returns the concrete subclass. So in other words to make Obj-C not complain about your undefined methods, you need to create an abstract superclass with a constructor that looks something like this: -(id)init { self = [[MyPythonClass alloc] init]; return self; } Or something along those lines. With this code, you should be able to instantiate your abstract superclass and get everything you need with no warnings! Viola! -- Jiva DeVoe jiva at devoesquared.com http://www.devoesquared.com |
From: saitou <sa...@cl...> - 2004-01-08 00:15:08
|
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ 突然のメール失礼いたします。 私、クリックパートナーの斉藤と申します。 今回貴サイトを拝見させて頂いて大変内容もよく素晴らしいサイトだと感じられましたので 是非とも弊社の広告を掲載して頂きたく思いメールさせて頂きました。 始めたばかりのサイトオーナー様でも気軽に申し込み出来ますので収入UPに最適です。 ※携帯専用の広告ですのでPCサイトオーナー様は登録する事が出来ません御了承ください。 クリックパートナーホームページはこちらです。 ↓ ↓ ↓ http://clickpartner.jp/hp/ ☆★ 特徴 ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ ★ ☆・今、ご登録いただくと登録時に1000円プレゼントさせていただきます ★ ☆・報酬は業界最速の月末締め翌月10日にお支払い。 ★ ☆・最低1クリック20円 最大1クリック25円 ★ (高額の広告単価にだまされていませんか? ☆ クリックパートナーではクリックのごまかしは一切ありません) ★ ☆・5千円からの広告料金のお支払い ★ ☆・大容量・強力サーバーによりストレスのない広告表示 ★ ☆・専用画面で24時間リアルタイムで広告料金チェックできます。 ★ ☆・クリックパートナーではクリック率の低い広告を掲載しません。 ★ (クリック率の低い広告文を自動排除するシステムにより ☆ 安定した高いクリック率を確保しています。) ★ ☆・サイト紹介していただくと1クリック3円のボーナスプレゼント ★ (例えばご紹介いただいた掲載サイト様のクリック総計が月間20万クリックだとすると ☆ あなたに60万円がプレゼントされます。) ★ ☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆ クリックされないバナーを貼ってませんか? 高額のクリック単価に騙されてませんか? 今お使いの広告代理店に疑問や不安を感じているなら是非 http://clickpartner.jp/hp/ =============================================================== 今、もっとも熱いWeb上の広告媒体は『モバイルサイト』です PCサイトの数倍の収益が間違いなく上がります。 サイドビジネス、収入UPを目指すなら、 モバイル広告の出稿を是非お考えください =============================================================== ★☆ 広告掲載申し込みフォーム ☆★☆★☆★☆★☆★☆★☆★☆★ ご登録は↓こちらからどうぞ http://clickpartner.jp/hp/ ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ なお、既にご契約頂いているサイトオーナー様、並びに現在交渉中・解約済・無関係な方へ配信されました場合は、ご迷惑をおかけし、大変申し訳ございません。御不要でしたら御手数ですが削除して頂きます様お願い致します。 ご質問等ございましたら 下記までご遠慮なくお問合せください。 ==================================================== 有限会社DDS クリックパートナー 広告配信事業部 斉藤 HP: http://clickpartner.jp/hp/ E-Mail: sa...@cl... ==================================================== |
From: Dinu G. <gh...@da...> - 2004-01-06 14:32:24
|
Bob Ippolito: >> As Ronald mentioned, it may work on GNUStep. > > I think GNUStep uses a version of Display PostScript, not Display PDF. > I wouldn't be so sure that its NSImage (or whatever pdf2tiff uses) is > any good at loading PDFs. If you want to rasterize PDFs, you should > look into Ghostscript ( http://www.cs.wisc.edu/~ghost/ ) or something > of that nature. Sorry for dropping in so late... If Bastien ia talking about the pdf2tiff I wrote: yes it's using NSImage and NSPDFImageRep. It also says pretty clearly (except on the command line) that it works on OS X only. As far as I remember, on NeXTSTEP there was no support for PDF, and surely it didn't have Display PDF, but I think GNUstep does actually want to mimick the parts of Cocoa which were not avail- able in NS, too, doesn't it? Well, if you find such a statement, please let me know. All I've found is this (searching for GNUstep and NSPDFImageRep): http://mail.gnu.org/archive/html/discuss-gnustep/2003-01/msg00290.html Concerning Ghostscript: whenever I'm trying to use it I get very quickly turned off by its command-line option universe before I get anything done with it... Dinu -- Dinu C. Gherman - http://python.net/~gherman/pdf2tiff.html ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) |
From: Wezzy <we...@ya...> - 2004-01-05 18:01:40
|
Il giorno 05/gen/04, alle 18:20, Bob Ippolito ha scritto: > > Do you mean: > > import objc > objc.loadBundle("WebKit",globals(),bundle_path="/System/Library/ > Frameworks/WebKit.framework") > del objc > ops my error > > You probably want: > > import WebKit > wb = WebKit.WebView.alloc().init() > > It's the same: >>> wb = WebKit.WebView.alloc().init() Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'module' object has no attribute 'WebView' > > You shouldn't be getting that particular error. > What version of PyObjC and OS X are you using? 1.0 on Mac Os X 10.3.2 > I'm using a month old CVS version of PyObjC (Dec 03 2003) on OS X > 10.3.2 (7D24). Now i download the cvs version > Are you sure that you have WebKit installed? Is there *anything* in > the imported WebKit module -- dir(WebKit)? > Yes i'm sure. WebKit module is a file WebKit.py not a package in a directory > -bob Thanks for you quickly response. Wezzy |
From: Bob I. <bo...@re...> - 2004-01-05 17:18:31
|
On Jan 5, 2004, at 12:01 PM, Wezzy wrote: > Hi all, after reading docs about wrapping new framework i've made some > test with my own framework, but i'm not able to import it. So i've > tried with webkit framework (just for testing) but it doesn't work. > > This is my code: > > WebKit.py: > import objc > pyobjc.loadBundle("WebKit",globals(),bundle_path="/System/Library/ > Frameworks/WebKit.framework") > del objc Do you mean: import objc objc.loadBundle("WebKit",globals(),bundle_path="/System/Library/ Frameworks/WebKit.framework") del objc > inside the interpreter: > import WebKit > wb = WebKit.WebView() You probably want: import WebKit wb = WebKit.WebView.alloc().init() because: wb = WebKit.WebView() is going to raise "TypeError: Use class methods to instantiate new Objective-C objects" > now i have an error, WebKit doesn't have WebView attributes. You shouldn't be getting that particular error. What version of PyObjC and OS X are you using? I'm using a month old CVS version of PyObjC (Dec 03 2003) on OS X 10.3.2 (7D24). Are you sure that you have WebKit installed? Is there *anything* in the imported WebKit module -- dir(WebKit)? -bob |
From: Bob I. <bo...@re...> - 2004-01-05 17:02:44
|
On Jan 5, 2004, at 11:45 AM, Ryan Wilcox wrote: > On 1/5/04, at 10:03 AM, PIGEYRE Bastien said: > >> ok, so this application doesn't work for linux anyway? > > As Ronald mentioned, it may work on GNUStep. I think GNUStep uses a version of Display PostScript, not Display PDF. I wouldn't be so sure that its NSImage (or whatever pdf2tiff uses) is any good at loading PDFs. If you want to rasterize PDFs, you should look into Ghostscript ( http://www.cs.wisc.edu/~ghost/ ) or something of that nature. >> is there a solution to adapt this application for linux? > > well, there IS wxPython (http://wxpython.org), probably one of the > better > crossplatform GUI frameworks for Python. That barely has anything to do with the question, PyObjC, or PDFs :) -bob |
From: Wezzy <we...@ya...> - 2004-01-05 17:01:54
|
Hi all, after reading docs about wrapping new framework i've made some test with my own framework, but i'm not able to import it. So i've tried with webkit framework (just for testing) but it doesn't work. This is my code: WebKit.py: import objc pyobjc.loadBundle("WebKit",globals(),bundle_path="/System/Library/ Frameworks/WebKit.framework") del objc inside the interpreter: import WebKit wb = WebKit.WebView() now i have an error, WebKit doesn't have WebView attributes. so i've tried with import inspect inspect.getmembers(WebKit,inspect.isclass) and it returns []. Where is my error ? Thanks a lot Wezzy |
From: Ryan W. <rya...@ma...> - 2004-01-05 16:45:11
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 1/5/04, at 10:03 AM, PIGEYRE Bastien said: >ok, so this application doesn't work for linux anyway? As Ronald mentioned, it may work on GNUStep. >is there a solution to adapt this application for linux? well, there IS wxPython (http://wxpython.org), probably one of the better crossplatform GUI frameworks for Python. Hope this helps, _Ryan Wilcox ================================================================ Wilcox Development Solutions: http://www.wilcoxd.com Toolsmiths for the Internet Age PGP: 0x2F4E9C31 -----BEGIN PGP SIGNATURE----- Version: PGP SDK 3.0.3 iQA/AwUBP/mUh22DtKgvTpwxEQIxwgCgvFy7uusnnU0US4Qr7mpHnqvCZJwAn201 6mR7OTDhAmXuNCjvdv0e//gj =f40L -----END PGP SIGNATURE----- |