From Jack.Jansen@cwi.nl Tue Feb 2 10:35:25 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 02 Feb 1999 11:35:25 +0100 Subject: [Pythonmac-SIG] Passowrd dialog box, anyone? Message-ID: Does anyone happen to have a password dialog box (like EasyDialogs.AskString, but with bullets as feedback in stead of the text typed) lying around that they'd be willing to contribute? Alternatively, would anyone be willing to write one (and be rewarded with eternal fame on the macpython mailing list:-)? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Tue Feb 2 12:43:28 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 02 Feb 1999 13:43:28 +0100 Subject: [Pythonmac-SIG] List selection in background windows Message-ID: In MacPython, if a window with a list object is sent to the background the selection in that list object becomes invisible (not the data itself, but the fact that it has been selected), where most other applications change the selection focus to an outline. Does anyone know what I should do to fix this? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From just@letterror.com Tue Feb 2 12:57:20 1999 From: just@letterror.com (Just van Rossum) Date: Tue, 2 Feb 1999 13:57:20 +0100 Subject: [Pythonmac-SIG] List selection in background windows In-Reply-To: Message-ID: At 1:43 PM +0100 2/2/99, Jack Jansen wrote: >In MacPython, if a window with a list object is sent to the background the >selection in that list object becomes invisible (not the data itself, but the >fact that it has been selected), where most other applications change the >selection focus to an outline. The List Manager just doesn't do this :-( >Does anyone know what I should do to fix this? I _think_ a custom LDEF could fix it (but I'm not sure). The "other" apps you're talking about probably use an alternative list manager (The A List, Stone Table, PowerPlant(?)). Just From just@letterror.com Tue Feb 2 12:57:20 1999 From: just@letterror.com (Just van Rossum) Date: Tue, 2 Feb 1999 13:57:20 +0100 Subject: [Pythonmac-SIG] List selection in background windows In-Reply-To: Message-ID: At 1:43 PM +0100 2/2/99, Jack Jansen wrote: >In MacPython, if a window with a list object is sent to the background the >selection in that list object becomes invisible (not the data itself, but the >fact that it has been selected), where most other applications change the >selection focus to an outline. The List Manager just doesn't do this :-( >Does anyone know what I should do to fix this? I _think_ a custom LDEF could fix it (but I'm not sure). The "other" apps you're talking about probably use an alternative list manager (The A List, Stone Table, PowerPlant(?)). Just From savageb@pacbell.net Tue Feb 2 22:35:39 1999 From: savageb@pacbell.net (Bob Savage) Date: Tue, 02 Feb 1999 14:35:39 -0800 Subject: [Pythonmac-SIG] GIF transp not supported in Mac vers? Message-ID: <4.0.2.19990128160503.008c6e70@bsavage.pobox.stanford.edu> Hi, I am not able to properly display with Tkinter a GIF file which has transparency turned on. Is there anyone who can confirm this for me? This URL points to a .sit file which demonstrates my attempts to use both straight Tkinter & PIL. The GIFs show properly if the transparency is not turned on, but with transparency turned on (GIF89a export from PhotoShop) they look really messed up. If you download the file and run it on your system, and it looks fine, please let me know. I tried to run these tests on a windows machine, but there seems to be some problem with the install 'cuz neither script will run. thanks for any help, Bob From sdm7g@virginia.edu Thu Feb 4 01:56:10 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Wed, 3 Feb 1999 20:56:10 -0500 (EST) Subject: [Pythonmac-SIG] toolbox interfaces In-Reply-To: Message-ID: What do you currently use to generate the MacPython Mac-Toolbox modules? bgen, modulator, SWIG ? ... and is there any documentation on the process ? While trying to use Python for some prototyping, and also looking into answers to a couple of other questions on this list ( Password dialogs, floating windows, ... ), I've run into some missing routines. ( Or, if they're there, I haven't found them where I expected them.) Specifically: The dialog manager helper function in Technote 1148 aren't in Dlg, and I don't see SndRecord & SndRecordToFile in Snd ( although I do see the SPBRecord function ) ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- Q: How many existentialists does it take to screw in a lightbulb? A: Two. One to screw it in and one to observe how the lightbulb itself symbolizes a single incandescent beacon of subjective reality in a netherworld of endless absurdity reaching out toward a maudlin cosmos of nothingness. From WIGHTJ@dstm.com Thu Feb 4 14:39:14 1999 From: WIGHTJ@dstm.com (Jon Wight) Date: Thu, 4 Feb 1999 09:39:14 -0500 Subject: [Pythonmac-SIG] Modules that don't work with Mac Python Message-ID: Is there a list of 'standard' Python modules that don't work on MacOS? I'm specifically wondering about sockets, socketserver, threads and threading. Thanks. Jon. --- Jonathan Wight Datastream Systems Inc. Development Rm: 429B, Ext: 5441 Voice: +1 (864) 422-5001, Fax: +1 (864) 422-5000 Email: jwight@dstm.com From just@letterror.com Thu Feb 4 15:03:31 1999 From: just@letterror.com (Just van Rossum) Date: Thu, 4 Feb 1999 16:03:31 +0100 Subject: [Pythonmac-SIG] Modules that don't work with Mac Python In-Reply-To: Message-ID: At 9:39 AM -0500 2/4/99, Jon Wight wrote: >Is there a list of 'standard' Python modules that don't work on MacOS? > >I'm specifically wondering about sockets, socketserver, threads and >threading. Sockets work, select works, threads don't work unfortunately. Just From WIGHTJ@dstm.com Thu Feb 4 14:59:04 1999 From: WIGHTJ@dstm.com (Jon Wight) Date: Thu, 4 Feb 1999 09:59:04 -0500 Subject: [Pythonmac-SIG] Modules that don't work with Mac Python Message-ID: What about with JPython running on the Mac? I'm assuming they'd work fine right? Anyone got anything bad to say about Mac version of JPython? > -----Original Message----- > From: Just van Rossum [mailto:just@letterror.com] > Sent: Thursday, February 04, 1999 10:04 AM > To: Jon Wight; pythonmac-sig@python.org > Subject: Re: [Pythonmac-SIG] Modules that don't work with Mac Python > > > At 9:39 AM -0500 2/4/99, Jon Wight wrote: > >Is there a list of 'standard' Python modules that don't work > on MacOS? > > > >I'm specifically wondering about sockets, socketserver, threads and > >threading. > > Sockets work, select works, threads don't work unfortunately. > > Just > > From erik@letterror.com Fri Feb 5 12:28:11 1999 From: erik@letterror.com (Erik van Blokland) Date: Fri, 5 Feb 99 14:28:11 +0200 Subject: [Pythonmac-SIG] gensuitemodule, Filemaker Message-ID: <199902051322.OAA24050@kalvermarkt.denhaag.dataweb.net> Is there someone in this SIG who has experience with gensuitemodule and FileMaker Pro? Letting gensuitemodule sniff at FileMaker results FileMaker_Suite.py, URL_Suite.py and something called (shudder!) Subset_of_the_Core_2c__Table_2c. (Before venturing into the great unknown, inquire at the local Burger King ;) erik van blokland From sdm7g@virginia.edu Tue Feb 9 06:19:19 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Tue, 9 Feb 1999 01:19:19 -0500 (EST) Subject: [Pythonmac-SIG] password dialog (& toolbox interfaces followup) In-Reply-To: Message-ID: Someone asked for a (hidden) password dialog. Here (at bottom) is one attempt -- it has a few flaws -- mainly it doesn't handle full cut and pasted editing. Maybe a few more I haven't found myself. I don't think this is the best way to do it in Python (see notes below) but I thought I'ld share the effort, along with a few notes and questions. Maybe someone else wants to either try the "special font" method, or else figure out how to get DialogCut et.al. to do the right thing. -- Steve M. NOTES on this function: Doesn't handle cut and paste from menu's or command keys. The following lines make the command key equivalents a NoOp: if ( mod & cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands Removing those lines will restore command key actions, but they don't quite work in this dialog since DialogPaste, et.al. bypass the keyDown processing and the external python string buffer. ( So unless you want to figure out how to make it work completely, it's better to disable it entirely. ) Also: backspace and left-arrow keys delete the last char from the buffer, but clicking into the middle of partially entered text and entering and/or deleting chars, or using left & right arrows together will not keep the display & the internal buffer consistent. The default resource id is the same used for AskString in EasyDialogs. If you make a duplicate in ResEdit and change the window type to 5 for a Movable Modal Dialog, and if you use that id, the dialog is made movable by the lines: if part == inDrag and win: win.DragWindow(where, screenbounds) If you use the default resource definition, then the window doesn't have a Drag part, so it does nothing. eight bit chars may get munged in email. In the line: "msg = ord('¥')" the character literal is the option-8 'dot' : ord('¥') = '\\245' = 165 (10) = 0xA5 Re: Previous message about Technote 1148 Dialog functions. I mistakenly referred to them as new functions. They have been there since system 7.0. It's just a new technote describing them. They are there in Dlg, but as methods of dialog objects, not as module function. SetDialogDefaultItem & SetDialogCancelItem are used in EasyDialogs, and I've copies that use here (although, since I'm not calling ModalDialog to process the events, I believe the only function of SetDialogDefaultItem is to cause the special emphasis drawing the default OK button. ) There seem to be some problems with StdFilterProc (discussed below) Other comments: Mac DTS has example password code in C that demonstrates three different methods: [1] using two edit text items -- one hidden -- and redirecting events from the visible edit-text to the hidden one. [2] Setting the dialog font to display a single glyph, and drawing the static text with a user proc. [3] Internal buffer. Both methods #1 and #3, in the DTS example code, used custom event filters in calls to ModalDialog. My function is a variant of method 3: it doesn't use a dialog event filter because I had some problems with translating the event filter idiom to MacPython. (Also, doing more explicit processing allows it to support movable modal dialogs.) [ BTW: After taking a hack at #3 and seeing that it would take a bit more effort to support Cut & Paste & arrow keys properly, I think that #2 is probably the best way to get full functioning edit-text dialogs without visible echo. ] They way that the filter procedures are wrapped in MacPython seem to make it very difficult to translate these idioms. The DTS routines make a lot of use of the trick of modifying the event or item args in the filter, and returning False to signify that the event wasn't handled in the filter. The toolbox wrapper code has to take an educated guess at which pointer args are IN, OUT, and INOUT. It looks like Dlg_UnivFilterProc in Dlgmodule.c folds the *item args and the return value together so that they can't be used independently. Maybe it's possible, but I couldn't figure out how to do it. Also dialog.StdFilterProc appears to be a method of no args returning the boolean return value along with the event record and itemHit: >>> d.StdFilterProc.__doc__ '() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)' but to use is as described in some of the Apple Docs, it should be called with ( dialog, event, itemHit ) args. It looks like the Python wrapper assumes there are only OUT args, where the Apple Docs and examples sometimes modify the events they pass to the standard filter to process. Does this analysis sound reasonable ? In the previous message, I asked about how the automatic wrapping is done. I've since been looking at the sources and I've seen some of the scripts. I'm not yet sure that I understand the whole process. ( So if I try to hack out a fix right now, I'm likely to start from Dlgmodule.c rather than regenerating the code templates from square one.) #----------------------- import Dlg,Win,Evt import MacOS,sys from EasyDialogs import cr2lf,lf2cr,screenbounds from Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog import Dialogs from Events import * # for char-codes from Windows import inDrag,inMenuBar def AskPassword(prompt, id=257): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return tp, h, rect = d.GetDialogItem(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) tp, h, rect = d.GetDialogItem(4) # EDIT TEXT ITEM SetDialogItemText(h, '' ) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = '' while 1: ready,ev = Evt.WaitNextEvent( -1, 6 ) if not ready: continue what,msg,when,where,mod = ev if what == 0 : DlgDialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what == keyDown: charcode = msg & charCodeMask if ( mod & cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == kReturnCharCode: return string elif charcode == kEscapeCharCode: return None elif charcode in (kLeftArrowCharCode,kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = ord('¥') ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : return string elif item == Dialogs.cancel : return None elif what == mouseDown: part, win = Win.FindWindow(where) if part == inDrag and win: win.DragWindow(where, screenbounds) elif part == inMenuBar : MacOS.HandleEvent(ev) elif what == updateEvt: MacOS.HandleEvent(ev) From sdm7g@virginia.edu Tue Feb 9 18:54:57 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Tue, 9 Feb 1999 13:54:57 -0500 (EST) Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: Message-ID: | Resending this message -- I sent it out last night and didn't | see it appear on the mailing list --a nd looking back, I see | that my previous message which I acused Jack of not answering | also didn't come back to me from the list. - Steve. Someone asked for a (hidden) password dialog. Here (at bottom) is one attempt -- it has a few flaws -- mainly it doesn't handle full cut and pasted editing. Maybe a few more I haven't found myself. I don't think this is the best way to do it in Python (see notes below) but I thought I'ld share the effort, along with a few notes and questions. Maybe someone else wants to either try the "special font" method, or else figure out how to get DialogCut et.al. to do the right thing. -- Steve M. NOTES on this function: Doesn't handle cut and paste from menu's or command keys. The following lines make the command key equivalents a NoOp: if ( mod & cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands Removing those lines will restore command key actions, but they don't quite work in this dialog since DialogPaste, et.al. bypass the keyDown processing and the external python string buffer. ( So unless you want to figure out how to make it work completely, it's better to disable it entirely. ) Also: backspace and left-arrow keys delete the last char from the buffer, but clicking into the middle of partially entered text and entering and/or deleting chars, or using left & right arrows together will not keep the display & the internal buffer consistent. The default resource id is the same used for AskString in EasyDialogs. If you make a duplicate in ResEdit and change the window type to 5 for a Movable Modal Dialog, and if you use that id, the dialog is made movable by the lines: if part == inDrag and win: win.DragWindow(where, screenbounds) If you use the default resource definition, then the window doesn't have a Drag part, so it does nothing. eight bit chars may get munged in email. In the line: "msg = ord('¥')" the character literal is the option-8 'dot' : ord('¥') = '\\245' = 165 (10) = 0xA5 Re: Previous message about Technote 1148 Dialog functions. I mistakenly referred to them as new functions. They have been there since system 7.0. It's just a new technote describing them. They are there in Dlg, but as methods of dialog objects, not as module function. SetDialogDefaultItem & SetDialogCancelItem are used in EasyDialogs, and I've copies that use here (although, since I'm not calling ModalDialog to process the events, I believe the only function of SetDialogDefaultItem is to cause the special emphasis drawing the default OK button. ) There seem to be some problems with StdFilterProc (discussed below) Other comments: Mac DTS has example password code in C that demonstrates three different methods: [1] using two edit text items -- one hidden -- and redirecting events from the visible edit-text to the hidden one. [2] Setting the dialog font to display a single glyph, and drawing the static text with a user proc. [3] Internal buffer. Both methods #1 and #3, in the DTS example code, used custom event filters in calls to ModalDialog. My function is a variant of method 3: it doesn't use a dialog event filter because I had some problems with translating the event filter idiom to MacPython. (Also, doing more explicit processing allows it to support movable modal dialogs.) [ BTW: After taking a hack at #3 and seeing that it would take a bit more effort to support Cut & Paste & arrow keys properly, I think that #2 is probably the best way to get full functioning edit-text dialogs without visible echo. ] They way that the filter procedures are wrapped in MacPython seem to make it very difficult to translate these idioms. The DTS routines make a lot of use of the trick of modifying the event or item args in the filter, and returning False to signify that the event wasn't handled in the filter. The toolbox wrapper code has to take an educated guess at which pointer args are IN, OUT, and INOUT. It looks like Dlg_UnivFilterProc in Dlgmodule.c folds the *item args and the return value together so that they can't be used independently. Maybe it's possible, but I couldn't figure out how to do it. Also dialog.StdFilterProc appears to be a method of no args returning the boolean return value along with the event record and itemHit: >>> d.StdFilterProc.__doc__ '() -> (Boolean _rv, EventRecord event, DialogItemIndex itemHit)' but to use is as described in some of the Apple Docs, it should be called with ( dialog, event, itemHit ) args. It looks like the Python wrapper assumes there are only OUT args, where the Apple Docs and examples sometimes modify the events they pass to the standard filter to process. Does this analysis sound reasonable ? In the previous message, I asked about how the automatic wrapping is done. I've since been looking at the sources and I've seen some of the scripts. I'm not yet sure that I understand the whole process. ( So if I try to hack out a fix right now, I'm likely to start from Dlgmodule.c rather than regenerating the code templates from square one.) #----------------------- import Dlg,Win,Evt import MacOS,sys from EasyDialogs import cr2lf,lf2cr,screenbounds from Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog import Dialogs from Events import * # for char-codes from Windows import inDrag,inMenuBar def AskPassword(prompt, id=257): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return tp, h, rect = d.GetDialogItem(3) # STATIC TEXT ITEM <= prompt SetDialogItemText(h, lf2cr(prompt)) tp, h, rect = d.GetDialogItem(4) # EDIT TEXT ITEM SetDialogItemText(h, '' ) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) string = '' while 1: ready,ev = Evt.WaitNextEvent( -1, 6 ) if not ready: continue what,msg,when,where,mod = ev if what == 0 : DlgDialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what == keyDown: charcode = msg & charCodeMask if ( mod & cmdKey ): MacOS.SysBeep() continue # don't do cut & paste commands else: if charcode == kReturnCharCode: return string elif charcode == kEscapeCharCode: return None elif charcode in (kLeftArrowCharCode,kBackspaceCharCode): string = string[:-1] else: string = string + chr(charcode) msg = ord('¥') ev = (what,msg,when,where,mod) rs, win, item = Dlg.DialogSelect(ev) if item == Dialogs.ok : return string elif item == Dialogs.cancel : return None elif what == mouseDown: part, win = Win.FindWindow(where) if part == inDrag and win: win.DragWindow(where, screenbounds) elif part == inMenuBar : MacOS.HandleEvent(ev) elif what == updateEvt: MacOS.HandleEvent(ev) ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- Q: How many existentialists does it take to screw in a lightbulb? A: Two. One to screw it in and one to observe how the lightbulb itself symbolizes a single incandescent beacon of subjective reality in a netherworld of endless absurdity reaching out toward a maudlin cosmos of nothingness. From savageb@pacbell.net Wed Feb 10 00:49:27 1999 From: savageb@pacbell.net (Bob Savage) Date: Tue, 09 Feb 1999 16:49:27 -0800 Subject: [Pythonmac-SIG] transparent GIF on Mac Python (update) Message-ID: <4.0.2.19990209090520.008cf790@bsavage.pobox.stanford.edu> Here's an update on using transparent GIFs with Mac Python. Apparently it is not possible with either straight Tkinter or PIL. I spoke with Frederik Lundh, and he said that of the two examples I posted earlier PIL doesn't support transparency only RGBA - style (Alpha Mask) effects (although I tried with a PNG and that didn't work either). The pure Tkinter approach *should* work, however, and displays correctly on his computer (some sort of Unix), but apparently there is something off with the way Tkinter works on the Mac. Just thought I'ld let the list know in case someone ends up looking through the archive for some answers. Bob From joe@strout.net Wed Feb 10 19:09:19 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 10 Feb 1999 11:09:19 -0800 Subject: [Pythonmac-SIG] making plug-ins? Message-ID: I'm getting annoyed at all the Python extensions written in C and not provided with MacOS versions... annoyed enough to do something about it myself, maybe. So I'm trying to learn how to make Python plug-ins. Jack writes: >One example project is included, PlugIns:xx.prj I loaded this, ignored the numerous warnings about converting from older formats. The project file contains xxmodule.c, but there's no such file, and double-clicking it in the project window (of course) does nothing. There's also a mysterious "xx.prj.exp" file which contains the word "initxx". Now what? I seem to be no closer to making my own plug-ins than I was before. Can somebody get me started? (This is the 1.5.2b1 distribution.) Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Wed Feb 10 19:34:08 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 10 Feb 1999 11:34:08 -0800 Subject: [Pythonmac-SIG] making plug-ins? In-Reply-To: Message-ID: Whoops, I just found Mac/Demo/plugins.html, which claims that you need a source distribution to make plug-ins, but otherwise looks useful. I'll pursue this, try to make the interslip plug-in, and see what happens. (Jack, may I suggest that you mention this page in your ReadMe-dev file, in addition to the other files which really don't help much with plugin development at all.) Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From savageb@pacbell.net Wed Feb 10 20:00:22 1999 From: savageb@pacbell.net (Bob Savage) Date: Wed, 10 Feb 1999 12:00:22 -0800 Subject: [Pythonmac-SIG] making Python Mac-friendly (was: making plug-ins?) In-Reply-To: Message-ID: <199902102000.MAA29807@smtp2.Stanford.EDU> At 11:09 AM 2/10/99 -0800, Joe Strout wrote: >I'm getting annoyed at all the Python extensions written in C and not >provided with MacOS versions... annoyed enough to do something about it >myself, maybe. It seems to me that there are a lot of modules that either don't work on a Mac or act differently, and yet these incompatibilities really aren't documented (In some cases the documentation may exist, but it is scattered enough to make hunting for it a frustrating experience). I wonder if it wouldn't be possible to collectively (even gradually) create a FAQ-wizard for using MacPython which specifically deals with what doesn't work or what works differently on a Mac. I think it would be really helpful (especially for beginners to Python, or those interested in cross-platform development) to have a list of modules that do not work -- including demo modules, and examples in the standard reference works (e.g. Lutz, which often has a very Unix-oriented approach). Eventually people could add alternatives & workarounds to the identified problem areas. I believe a tool like this MacPython Compatability FAQ will be very helpful as the Python community grows (and with it the MacPython community). Of course, one thing that complicates this is the transition to MacOSX (which will add a posix layer, presumably a major factor in compatibility). end transmission ... From Jack.Jansen@cwi.nl Wed Feb 10 21:41:14 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 10 Feb 1999 22:41:14 +0100 Subject: [Pythonmac-SIG] making plug-ins? In-Reply-To: Message by "Joseph J. Strout" , Wed, 10 Feb 1999 11:34:08 -0800 , Message-ID: Mac:Demo:plugins.html is outdated, I'll be updating it. The missing xxmodule.c file is a rather unfortunate side-effect of the way I build distributions, I'll try and remember to see if I can do something about it for the next release. You don't need a source distribution anymore, despite what the documentation says, loading the plugin developer kit in the binary distribution is good enough. But, indeed, you miss the xxmodule.c and xx.prj.exp files:-( And if people are willing to "adopt" various of the neat extension modules out there for MacPython I would be much obliged. As of the next release the shared library CFM version numbering scheme should finally allow extension modules to be written for multiple Python versions, so that should make it easier to distribute binary plugin modules. For the CFM-wise: the "current" cfm version will be the same as sys.hexversion of the current Python, and the "oldest" cfm version will be sys.hexversion of the oldest Python that has the same PYTHON_API_VERSION as the current Python (unless MetroWerks change their C library in between, in which case it'll be the sys.hexversion of the oldest Python built with a compatible C library). If I can work out how to keep only the definition part of a .slb I might also try including that slb of the oldest PythonCore with the same PYTHON_API_VERSION, then extension-builders can link against that and create an extension module that they know (well... be reasonably sure:-) will run in older Pythons as well. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Wed Feb 10 21:52:29 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 10 Feb 1999 22:52:29 +0100 Subject: [Pythonmac-SIG] making Python Mac-friendly (was: making plug-ins?) In-Reply-To: Message by Bob Savage , Wed, 10 Feb 1999 12:00:22 -0800 , <199902102000.MAA29807@smtp2.Stanford.EDU> Message-ID: Recently, Bob Savage said: > It seems to me that there are a lot of modules that either don't work on a > Mac or act differently, and yet these incompatibilities really aren't > documented (In some cases the documentation may exist, but it is scattered > enough to make hunting for it a frustrating experience). I wonder if it > wouldn't be possible to collectively (even gradually) create a FAQ-wizard > for using MacPython which specifically deals with what doesn't work or what > works differently on a Mac. Yes, please! If somebody can set this up that would be a valuable resource... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From joe@strout.net Wed Feb 10 22:21:41 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 10 Feb 1999 14:21:41 -0800 Subject: [Pythonmac-SIG] making Python Mac-friendly (was: making plug-ins?) In-Reply-To: References: Message by Bob Savage , Wed, 10 Feb 1999 12:00:22 -0800 , <199902102000.MAA29807@smtp2.Stanford.EDU> Message-ID: >Recently, Bob Savage said: >> ... I wonder if it >> wouldn't be possible to collectively (even gradually) create a FAQ-wizard >> for using MacPython which specifically deals with what doesn't work or what >> works differently on a Mac. To which Jack replied: >Yes, please! If somebody can set this up that would be a valuable resource... How about the PyModules FAQ-o-Matic: http://starship.skyport.net/crew/aaron_watters/faqwiz/contrib.cgi?req=index The only problem being, only PSA members are allowed to contribute, which is a horrible idea -- anybody with a good Answer should be allowed to contribute it. But maybe we could use the same software... I could host it on my site at strout.net, if they'd ever get around to supporting Python (*). Cheers, -- Joe (*) Want to help? Go to http://www.web2010.com or write to sales@web2010.com, and tell them you're looking at ISPs and they look good, but it's important to you that they provide Python. Perhaps even point out that other ISPs (e.g., best.com, or insert your own here) do provide this service. I've been bugging them for months, but they're Perl believers... ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From redbird@orlando.crosswinds.net Wed Feb 10 23:16:14 1999 From: redbird@orlando.crosswinds.net (Gordon Worley) Date: Wed, 10 Feb 1999 18:16:14 -0500 (EST) Subject: [Pythonmac-SIG] making Python Mac-friendly (was: making plug-ins?) In-Reply-To: References: Message by Bob Savage , Wed, 10 Feb 1999 12:00:22 -0800 , <199902102000.MAA29807@smtp2.Stanford.EDU> Message-ID: Joseph J. Strout wrote: >But maybe we could use the same software... I could host it on my site at >strout.net, if they'd ever get around to supporting Python (*). Until then, I would be happy to compile such a list the old fashioned way. I've done this kind of stuff before, so I wouldn't mind doing for the MacPython community. Just send your messages regarding the content of a compatibility faq to me and I will put them together. I'll post the faq's location back to the list when a decent amout of it is done. ________________________________________ Red Bird Island Productions Gordon Worley http://www.crosswinds.net/orlando/~redbird/ mailto:redbird@orlando.crosswinds.net From sdm7g@elvis.med.virginia.edu Thu Feb 11 02:14:22 1999 From: sdm7g@elvis.med.virginia.edu (Steven D. Majewski) Date: Wed, 10 Feb 1999 21:14:22 -0500 (EST) Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: Message-ID: The 'use-special-font-in-dialog-text-edit' method does seem to be simpler. There is a special custom font ".Pwd" with the DTS password C code, which I have pasted into my PythonCore resources. ( All characters have the same diamond shaped glyph representation. ) We can add that as well as another window definition to the distribution. On the previous pass, I used ResEdit to duplicate the EasyDialogs AskString window ( id=257 ) and change it to a Movable Modal Dialog style window. This pass, I made another duplicate and also duplicated and changed the DITL resource. The required change is to make the static text item into a user item. If you don't add the password font, it works with the Symbol font, which produces a close approximation of gibberish. In fact, it actually looks pretty cool as a normal dialog to have the text item in a different font, like "Sand" ! The short summary of the code is that it changes the dialog font to something other than the system font, so that edit text is unreadable, and instead of a static text item, it uses a user defined drawing procedure to draw what was the static text string, setting the font and size back to the system defaults. Questions: [Q1] I've been trying to extract the event processing into two different procedures for movable-modal vs modal dialogs. Either procedure should work -- the default is assigned to 'HandleDialog'. [ These functions are also handy if you want to do some interactive window hacking. You can do a 'd=Dlg.GetNewDialog(id,-1)', ... do some stuff interactively maybe using 'd' ... and then when you need to "activate" it or move it out of the way, you can type 'HandleDialog(d)' ] Is there any way in Python to get the 'style' of the window: GetWindowKind just differentiates between Dialog and Document windows. ( and it used to identify "Desk Accessories" but I guess that is obsolete. ). What I need is the Window Definition ID: dBoxProc vs. movableDBoxProc. ( Maybe the new 8.5 Window Class functions return this but the Win2 calls aren't wrapped into an extension yet. ) Does anyone know a path to this value from a MacPython Window or Dialog object ? What I would like is for HandleDialog to dynamically choose between modal & movable modal. ( I may have to back up and get the info from the resource when the dialog is created. If it can be made to work in some fashion, maybe we can roll this back into EasyDialogs. Aesthetically and functionally, HI-wise, movable dialogs are much nicer. If you have to enter something more than yes or now, sometimes you need to look elsewhere for the answer. ) [Q2: -- this one's especially for Jack! ] Is there any reason for the restriction of having only one user item handler set? I discovered that SetDialogItem won't take a Python procedure for the third arg -- it demands a resource -- and the way to coerce it to a resource is with SetUserItemHandler. (which needs a call to unset it with a None arg before setting it to another value. ) Is there any functional reason for this, other than that it makes it simpler just to manage a single possible callback. ( i.e. If I try to change this behavior, it there some hole I'm going to fall into that you're aware of?) ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- #----------------------- import Dlg,Win,Evt,Qd,TE,Fm import MacOS,sys from EasyDialogs import cr2lf,lf2cr,screenbounds from Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog import Dialogs from Events import * # for char-codes from Windows import inDrag,inMenuBar #--- version 2: change dialog font and make static text prompt a UserItemProc import Qd,TE,Fm # in addition to all of the others # This is the closure to bind a userProc with required two args # to the text variable string. class myTextItem: def __init__( self, text ): self.text = text def install(self, dialog, item ): Dlg.SetUserItemHandler(None) self.r = Dlg.SetUserItemHandler(self.myUserItemProc) item_args = dialog.GetDialogItem(item) dialog.SetDialogItem( item, item_args[0], self.r, item_args[2] ) return self.r def myUserItemProc( self, dialog, item ): Qd.SetPort( dialog ) tp,h,rec = dialog.GetDialogItem( item ) Qd.TextFont(0) Qd.TextSize(0) TE.TETextBox( self.text, rec, 0 ) def __del__(self): Dlg.SetUserItemHandler(None) def AskPwd(prompt, font='Symbol', id=158, title='Password' ): Dlg.SetDialogFont(Fm.GetFNum(font)) d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return d.SetWTitle( title ) mytextproc = myTextItem( prompt ) mytextproc.install( d, 3 ) tp, h, rect = d.GetDialogItem(4) # EDIT TEXT ITEM SetDialogItemText(h, '' ) d.SetDialogDefaultItem(Dialogs.ok) d.SetDialogCancelItem(Dialogs.cancel) value = HandleDialog( d ) Dlg.SetDialogFont(0) # back to system font return value def HandleModalDialog( d ): d.BringToFront() OK = d.GetDialogDefaultItem() or Dialogs.ok CANCEL = d.GetDialogCancelItem() or Dialogs.cancel while 1: n = ModalDialog(None) if n == OK: tp, h, rect = d.GetDialogItem(4) return cr2lf(GetDialogItemText(h)) if n == CANCEL: return None def HandleMovableModalDialog( d ): d.BringToFront() OK = d.GetDialogDefaultItem() or Dialogs.ok CANCEL = d.GetDialogCancelItem() or Dialogs.cancel while 1: ready,ev = Evt.WaitNextEvent( everyEvent, 6 ) if not ready: continue what,msg,when,where,mod = ev if what == 0 : Dlg.DialogSelect(ev) # for blinking caret elif Dlg.IsDialogEvent(ev): if what == keyDown: charcode = msg & charCodeMask if charcode == kReturnCharCode: tp, h, rect = d.GetDialogItem(4) return cr2lf(GetDialogItemText(h)) elif charcode == kEscapeCharCode: return None rs, win, item = Dlg.DialogSelect(ev) if item == OK : tp, h, rect = d.GetDialogItem(4) return cr2lf(GetDialogItemText(h)) elif item == CANCEL : return None elif what == mouseDown: part, win = Win.FindWindow(where) if part == inDrag and win: win.DragWindow(where, screenbounds) else: MacOS.HandleEvent(ev) else: MacOS.HandleEvent(ev) HandleDialog = HandleMovableModalDialog From sdm7g@elvis.med.virginia.edu Thu Feb 11 02:45:03 1999 From: sdm7g@elvis.med.virginia.edu (Steven D. Majewski) Date: Wed, 10 Feb 1999 21:45:03 -0500 (EST) Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: Message-ID: On Wed, 10 Feb 1999, Jack Jansen wrote: |I did see the dialog (thanks!), yesterday morning, twice (once to me, once to |the list), but I didn't see the other message accusing me of something or |other. Could you please accuse me again, preferrably in a public forum? :-) The accusation was that you never responded to the message that seems to have gotten lost somewhere. That was burried somewhere in the first version of that note that I resent. The previous message to that, I won't bother to resend. Part was a 'nevermind' : some of the Dialog functions I couldn't seem to find were there as Dialog methods. However, the other question was a request for details on the procedure you use for creating the wrappers. I'm still interested in that answer as other problems with the Python toolbox interfaces have come up. Some I've mentioned in this thread: that the StdFilterProc function aren't usable with the current argument passing choice; that you can only set one UserItemProc globally; that I'ld like to be able to get the WindowDefProc number. The other big can of worms is all of the toolbox changes for 8.5, with probably more to come for 8.6! Look on apple's developer web for drafts of the new docs. One item I'll mention, because of another recent MacPython feature request: someone asked about Floating Window support. This is something that has had a couple of different preferred implementations in the MacOS history. At least one of those undocumented methods is officially deprecated. I'm not sure if the last preferred method of using the Text Services support is still OK. I'll try to put together a summary sometime. I've got code from appe-window, Infinity windoid, and from (I think) Apple DTS -- however 8.5 Win2 interfaces add official support for floating windows, and the handler code is supposed to do-the-right-thing-for-the-right-kind-of-window. ( That's one reason windowClasses are added: they are separating window Class behaviour from window appearance. ) BTW: Also added is timeout's for Modal Dialogs. [ I'm hoping we can manage to distribute some of this work so it's not all on Jack's shoulders! ] ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- From joe@strout.net Thu Feb 11 06:08:35 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 10 Feb 1999 22:08:35 -0800 Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: References: Message-ID: At 6:45 PM -0800 2/10/99, Steven D. Majewski wrote: >[ I'm hoping we can manage to distribute some of this work so it's > not all on Jack's shoulders! ] My boss/P.I. will be making a final decision on Python vs. LISP for our lab, probably by the end of the week. If it's Python -- and that's looking hopeful -- then it will be among my job duties to help support and develop MacPython. I just today compiled my very first Python plug-in module. This is extremely cool, and I expect to be making Mac precompiled versions of just about every module I find on the net that doesn't already have one. I also have a long list of things which need to be "fixed" or improved about MacPython, like the way you can't get to the next line of the python path in the EditPythonPrefs app without copying & pasting a newline. Rather than gripe about most of these things, I figure I'll just dive in and fix what I can, submit those, and gripe about the rest. I've also been working with Just on some improvements to the IDE. Syntax highlighting is coming (ask him about it!), as well as a (IMHO) cool feature that lets you press the question mark while on a function name, and see its prototype and docstring in the output window. So sure, I'm also interested in learning how bgen works, and taking some of the load off of Jack's shoulders. Y'all let me know if there's anything I can do. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From da@ski.org Thu Feb 11 06:34:56 1999 From: da@ski.org (David Ascher) Date: Wed, 10 Feb 1999 22:34:56 -0800 (Pacific Standard Time) Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: Message-ID: On Wed, 10 Feb 1999, Joseph J. Strout wrote: > So sure, I'm also interested in learning how bgen works, and taking some of > the load off of Jack's shoulders. Y'all let me know if there's anything I > can do. Togl for the mac! Togl for the mac! =) --david From savageb@pacbell.net Thu Feb 11 08:16:33 1999 From: savageb@pacbell.net (savageb) Date: Thu, 11 Feb 1999 00:16:33 -0800 Subject: [Pythonmac-SIG] Go Joe! Message-ID: <199902110807.AAA03192@mail-gw5.pacbell.net> wrote: > I just today compiled my very first Python plug-in module. This is > extremely cool, and I expect to be making Mac precompiled versions of just > about every module I find on the net that doesn't already have one. > > I also have a long list of things which need to be "fixed" or improved > about MacPython, like the way you can't get to the next line of the python > path in the EditPythonPrefs app without copying & pasting a newline. > Rather than gripe about most of these things, I figure I'll just dive in > and fix what I can, submit those, and gripe about the rest. > > I've also been working with Just on some improvements to the IDE. Syntax > highlighting is coming (ask him about it!), as well as a (IMHO) cool > feature that lets you press the question mark while on a function name, and > see its prototype and docstring in the output window. > Yeah! This is sounding very good! Good luck with the big decision. How about a Gadfly binary? Say, has anyone gotten Idle to work on the Mac? I got some TCL error when I tried -- really looking forward to syntax coloring (what great news!). FWIW I think the EditPythonPrefs app is much better than editing the windows registry :p Bob Savage savageb@pacbell.net From savageb@pacbell.net Thu Feb 11 08:15:58 1999 From: savageb@pacbell.net (savageb) Date: Thu, 11 Feb 1999 00:15:58 -0800 Subject: [Pythonmac-SIG] testing IMG on Mac Message-ID: <199902110806.AAA03055@mail-gw5.pacbell.net> I was trying out IMG and running the test when: -- begin error message -- - Read ppm original image - Write ppm original image - Write ppm upsidedown image - Read ppm upsidedown image - Read pgm original image - Write pgm original image - Write pgm upsidedown image - Read pgm upsidedown image - Write sgi rgb image - (checking) - Write sgi rgb image upsidedown - (checking) - Write sgi grey image (cannot check) - Write sgi grey image upsidedown (cannot check) - Write jpeg rgb image (cannot check) Traceback (innermost last): File "Henrietta:Python 1.5.2b1:Extensions:img:test:testimg.py", line 143, in ? w.write(rgb_t2b_data) imgformat.error: Output file write error --- out of disk space? -- end error message -- ** NOTE ** I have 450 MB available on that disk so disk space cannot be the problem Any ideas? Bob Savage savageb@pacbell.net From Jack.Jansen@cwi.nl Thu Feb 11 10:15:55 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 11 Feb 1999 11:15:55 +0100 Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: Message by "Joseph J. Strout" , Wed, 10 Feb 1999 22:08:35 -0800 , Message-ID: also have a long list of things which need to be "fixed" or improved > about MacPython, like the way you can't get to the next line of the python > path in the EditPythonPrefs app without copying & pasting a newline. > Rather than gripe about most of these things, I figure I'll just dive in > and fix what I can, submit those, and gripe about the rest. If someone is looking for a project to get to know the toolbox better: EditPythonPrefs could definitely use some work. The sys.path thing should be replaced by a scrolled widget, for instance, and it would probably be nice if the whole dialog was built as a set of preference panes. The interface from EditPythonPref to the preferences file was already factored out a while ago (exactly for reason of redesign of the interface), so this should be a 100% gui job. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Thu Feb 11 10:38:06 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 11 Feb 1999 11:38:06 +0100 Subject: [Pythonmac-SIG] testing IMG on Mac In-Reply-To: Message by "savageb" , Thu, 11 Feb 1999 00:15:58 -0800 , <199902110806.AAA03055@mail-gw5.pacbell.net> Message-ID: > I was trying out IMG and running the test when: > ... > - Write jpeg rgb image (cannot check) > Traceback (innermost last): > File "Henrietta:Python 1.5.2b1:Extensions:img:test:testimg.py", line 143, > in ? > w.write(rgb_t2b_data) > imgformat.error: Output file write error --- out of disk space? I ran into the same problem last week, and it turns out there were some rather serious bugs in the JPEG writer. There's a (possibly similar) bug in the TIFF writer that I haven't nailed down yet. This will be fixed in the next release, but if people really need it now let me know. Only if you really need it, please: the organization of the plugins and extension modules has changed rather drastically, so distributing a new img is non-trivial at the moment... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From managan@llnl.gov Thu Feb 11 16:48:04 1999 From: managan@llnl.gov (Rob Managan) Date: Thu, 11 Feb 1999 08:48:04 -0800 Subject: [Pythonmac-SIG] password dialog (& toolbox interfaces followup) In-Reply-To: References: Message-ID: "Steven D. Majewski" gave a sample of a password dialog. That prompted me to look into filter functions. It appears from the source that you can suypply a filter function. The one technique I have seen used a lot is to use ((DialogPeek) theDialog)->editField + 1 to get the item number of the text field that the user has typed in. What ways are there to get at this information and/or do we need to ask Jack to add a method that returns that information from the dialog object? *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan mailto://managan@llnl.gov LLNL ph: 925-423-0903 P.O. Box 808, L-098 FAX: 925-423-5804 Livermore, CA 94551-0808 From sdm7g@elvis.med.virginia.edu Thu Feb 11 17:12:44 1999 From: sdm7g@elvis.med.virginia.edu (Steven D. Majewski) Date: Thu, 11 Feb 1999 12:12:44 -0500 (EST) Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: Message-ID: On Wed, 10 Feb 1999, David Ascher wrote: |On Wed, 10 Feb 1999, Joseph J. Strout wrote: | |> So sure, I'm also interested in learning how bgen works, and taking some of |> the load off of Jack's shoulders. Y'all let me know if there's anything I |> can do. | |Togl for the mac! Togl for the mac! | |=) | Apple is late on the developer release of OpenGL for Mac that they promised to put on the web at the end of the month. Expecting an official release "RealSoon" has kept me from trying to play with Mesa. (But if I don't hear anything soon, maybe I'll give it a try! - Has anyone built Togl with Mesa on other platforms? ) ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- Q: How many existentialists does it take to screw in a lightbulb? A: Two. One to screw it in and one to observe how the lightbulb itself symbolizes a single incandescent beacon of subjective reality in a netherworld of endless absurdity reaching out toward a maudlin cosmos of nothingness. From da@ski.org Thu Feb 11 17:11:48 1999 From: da@ski.org (David Ascher) Date: Thu, 11 Feb 1999 09:11:48 -0800 (Pacific Standard Time) Subject: [Pythonmac-SIG] Re: password dialog (& toolbox interfaces followup) In-Reply-To: Message-ID: On Thu, 11 Feb 1999, Steven D. Majewski wrote: > Apple is late on the developer release of OpenGL for Mac that they > promised to put on the web at the end of the month. Expecting an > official release "RealSoon" has kept me from trying to play with > Mesa. (But if I don't hear anything soon, maybe I'll give it a try! - > Has anyone built Togl with Mesa on other platforms? ) Togl works fine w/ Mesa on other platforms. The issue isn't so much OpenGL support (that's delegated to OpenGL or Mesa), but the creation of a new kind of Tk widget. It's not especially tricky, I suspect, but it takes someone willing to dig inside of the mac-specific Tk code. -david From sdm7g@elvis.med.virginia.edu Thu Feb 11 18:49:49 1999 From: sdm7g@elvis.med.virginia.edu (Steven D. Majewski) Date: Thu, 11 Feb 1999 13:49:49 -0500 (EST) Subject: [Pythonmac-SIG] EasyDialogs bug (was: password dialog) In-Reply-To: Message-ID: BTW: In doing the password dialog code, I discovered a small bug in EasyDialogs ProgressBar. ( for which I also get the blame -- I submitted the changes that added the bug. ) EasyDialogs ProgressBar._update contains the code: what,msg,when,where,mod = ev part = Win.FindWindow(where)[0] if Dlg.IsDialogEvent(ev): ds = Dlg.DialogSelect(ev) if ds[0] and ds[1] == self.d and ds[-1] == 1: raise KeyboardInterrupt, ev else: if part == 4: # inDrag self.d.DragWindow(where, screenbounds) else: MacOS.HandleEvent(ev) FindWindow( xy-point ) returns (part,win), and in the code above, the win value is discarded and only part is used as the condition for self.d.DrawWindow. Clicking in the drag region of another window in the app, like the console window, will cause a drag of the progress bar dialog. The HandleMovableDialog function included with the password dialog does it differently to avoid this. The "and win" test is also required: the console window, created by SIOUX rather than by Python causes the return of ( part, None ) as there is no Python object wrapper for that window. elif what == mouseDown: part, win = Win.FindWindow(where) if part == inDrag and win: win.DragWindow(where, screenbounds) else: MacOS.HandleEvent(ev) else: MacOS.HandleEvent(ev) [ I'll probably collect some more changes and fixes as well as a final version of the password dialog into an updated EasyDialogs.] ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- From sdm7g@virginia.edu Fri Feb 12 22:39:03 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Fri, 12 Feb 1999 17:39:03 -0500 (EST) Subject: [Pythonmac-SIG] Can't get there from here? Message-ID: In the continuing saga to build a better dialog... Inside Mac says that if a Dialog has an editable text item in it, then it doesn't disable the Edit menu when processing events -- and this seems to be the case for my dialog when I use ModalDialog to process it, however, for a movable modal dialog, where I'm processing it with WaitNextEvent & DialogSelect, the items in the Edit menu are disabled. I'm not doing anything explicitly to disable those items and they are enabled before I call my dialog handler -- anyone know what turns them off ? I could turn them off if I could get a handle to the Edit menu. Framework.py clears it's menubar and builds a new one, so it keeps it's own list of menus. Menu.GetMenuBar() should return the current menu list, however, it returns this handle as a resource object. Is there any way from this to walk the list of menus in the menu bar ? ( If not, then that's another toolbox TODO: change GetMenuBar() to return the list of windows instead of an opaque resource. ) Is this info encoded in resource.data, or is that just garbage if it's not a real resource? ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- From sdm7g@virginia.edu Fri Feb 12 23:26:29 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Fri, 12 Feb 1999 18:26:29 -0500 (EST) Subject: [Pythonmac-SIG] Can't get there from here? In-Reply-To: Message-ID: I can't answer my own questions, but I did find a kludge around: Calling ModalDialog(None) before the event handling loop causes the edit menu to be enabled, even after that function has returned. However, you have to give it an event to cause it to return. If you try to drag the window before that, it's still in ModalDialog processing, and it just beeps at you. ( And if the first event is a real one, like clicking the button, it will get lost. ) Calling: ModalDialog( lambda x,y: 1 ) seems to work correctly. I'm guessing that it fires on a the first Null event. ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- From william@dakini.orient.ox.ac.uk Sun Feb 14 19:46:18 1999 From: william@dakini.orient.ox.ac.uk (W.B. Douglas) Date: Sun, 14 Feb 1999 19:46:18 +0000 Subject: [Pythonmac-SIG] (Newbie) Troubles with ConfigurePython Message-ID: List members, My apologies for introducing myself in the way. I have been able to find a reference in the mailing list archive to this very problem, but no mention of its _solution. I hope I will not be trying your patience too much by raising the question here. On installing either 1.52b1 or 1.51 I get an error when ConfigurePython tries to run. In the case of 1.5.1 it seems identical to a previously reported case - Python claims it cannot find toolboxmodules.CFM68K.slb or toolboxmodules.PPC.slb while looking to load Res, although inspecting sys.path shows that the the correct directory _is in the list and those two files are definitely in that directory. The error for 1.52b1 is somewhat more cryptic but appears to be similar; a 'file not found' error is being reported. Would someone be so kind as to give me what must be a rather well-worn pointer to the solution for this? I'd like to get Python running on my Mac, not merely to play, but actually to do some work! - after which I hope to play... -wbd. - - - - - - - - - - - - - - - - - - - - - - - William Douglas IREMO & Oriental Institute, Oxford University From just@letterror.com Sun Feb 14 20:31:07 1999 From: just@letterror.com (Just van Rossum) Date: Sun, 14 Feb 1999 21:31:07 +0100 Subject: [Pythonmac-SIG] (Newbie) Troubles with ConfigurePython In-Reply-To: Message-ID: At 7:46 PM +0000 2/14/99, W.B. Douglas wrote: >List members, > >My apologies for introducing myself in the way. I have been able to find a >reference in the mailing list archive to this very problem, but no mention >of its _solution. I hope I will not be trying your patience too much by >raising the question here. > >On installing either 1.52b1 or 1.51 I get an error when ConfigurePython >tries to run. In the case of 1.5.1 it seems identical to a previously >reported case - Python claims it cannot find toolboxmodules.CFM68K.slb or >toolboxmodules.PPC.slb while looking to load Res, although inspecting >sys.path shows that the the correct directory _is in the list and those two >files are definitely in that directory. The error for 1.52b1 is somewhat >more cryptic but appears to be similar; a 'file not found' error is being >reported. > >Would someone be so kind as to give me what must be a rather well-worn >pointer to the solution for this? I'd like to get Python running on my Mac, >not merely to play, but actually to do some work! - after which I hope to >play... Did you try removing the Python preferences file and _then running ConfigurePython?? That often helps. Just From jack@cwi.nl Mon Feb 15 14:25:04 1999 From: jack@cwi.nl (Jack Jansen) Date: Mon, 15 Feb 1999 14:25:04 +0000 Subject: [Pythonmac-SIG] Scripting Sherlock from Python Message-ID: <36C82E40.ADF5017B@oratrix.nl> If anyone happens to be looking for a project to fill a couple of idle hours: I just noticed that Sherlock, the 8.5 search engine, is scriptable. Apple Technote 1141, http://developer.apple.com/technotes/tn/tn1141.html , has the details. It would be nice to use this functionality from the IDE. What I'm thinking of is a script that you would invoke from the IDE that would get the current selection (or interactively ask for a word) and that would use an AppleEvent to Sherlock to lookup that selection in the Python manual (or FAQ). -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Mon Feb 15 22:54:37 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 15 Feb 1999 23:54:37 +0100 Subject: [Pythonmac-SIG] Tk and 68K macs Message-ID: I'm looking at putting the new Tk version into MacPython, and before I start with all the mods needed to get the cfm68k version of Tcl/Tk running let me first ask: is _anyone_ using Tkinter on a 68K mac? If so, how sad would you be if I dropped Tk support for 68K macs? How sad would you be if I kept it in the static interpreter (Python68KStand) but dropped it in the Cfm68K (fat) version? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From schliep@zpr.uni-koeln.de Tue Feb 16 10:42:09 1999 From: schliep@zpr.uni-koeln.de (Alexander Schliep) Date: Tue, 16 Feb 1999 11:42:09 +0100 Subject: [Pythonmac-SIG] Tk and 68K macs In-Reply-To: Jack Jansen "[Pythonmac-SIG] Tk and 68K macs" (Feb 15, 11:54pm) References: Message-ID: <9902161142.ZM17006@Octopussy.MI.Uni-Koeln.DE> On Feb 15, 11:54pm, Jack Jansen wrote: > Subject: [Pythonmac-SIG] Tk and 68K macs > I'm looking at putting the new Tk version into MacPython, and before I Great to see improvements in this area. Unfortunately I have to finish up my Ph.D. real soon now and cannot volunteer to help. > start with all the mods needed to get the cfm68k version of Tcl/Tk > running let me first ask: is _anyone_ using Tkinter on a 68K mac? If We are developing a graph algorithm visualisation software, which uses Tkinter and so far seems to run pretty well even on old Windows boxes and on old Macs (LC II or so). Dropping Tk support for 68K macs would eliminate probably a lot of schools and University computer labs. I certainly would regret it. (Btw, the visualisation software will be made freely available. A set of particular algorithms with a textbook will be published by Springer.) > so, how sad would you be if I dropped Tk support for 68K macs? How sad > would you be if I kept it in the static interpreter (Python68KStand) > but dropped it in the Cfm68K (fat) version? I only would need Cfm68K for having dinamically loadable extensions, right ? I could do without it. Alexander > -- > Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ > Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ > http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://www.python.org/mailman/listinfo/pythonmac-sig >-- End of excerpt from Jack Jansen -- Alexander Schliep schliep@zpr.uni-koeln.de ZPR/ZAIK Tel: +49-221-470-6011 (w) University of Cologne FAX: +49-221-470-5160 Weyertal 80 http://www.zpr.uni-koeln.de/~schliep 50931 Cologne, Germany Tel: +49-231-143083 (h) From igor@db3.so-net.ne.jp Wed Feb 17 01:55:35 1999 From: igor@db3.so-net.ne.jp (BUYO-BUYO-IGOR) Date: Wed, 17 Feb 1999 10:55:35 +0900 Subject: [Pythonmac-SIG] from a footprint maker References: <199902161742.MAA25931@python.org> Message-ID: <36CA2197.7FF8@db3.so-net.ne.jp> excuse me for sending FAQ oriented bigginner Q.. but thought this was a chance to try.. I am still making foootprints at the entrance of Phython world.. I using iMac & powerbook190 and the latter is the 68k thing. I've read the READ-ME things of the downloaded folder (mmm?..this one wasn't FAT already?) but couldn't get which one could be used on my powerbook ...the cfm68k-enabler is in the not-in-use-extention folder...do I also need this to use the application that i've downloaded?...or it depends?... only for me...if basic things(static interpreter?) could be kent running without problem on my PB and complicated things on iMac(do I have to download an another version for this?)...that's super OK.. pythonmac-sig-admin@python.org wrote: > I'm looking at putting the new Tk version into MacPython, and before I > start with all the mods needed to get the cfm68k version of Tcl/Tk > running let me first ask: is _anyone_ using Tkinter on a 68K mac? If > so, how sad would you be if I dropped Tk support for 68K macs? How sad > would you be if I kept it in the static interpreter (Python68KStand) > but dropped it in the Cfm68K (fat) version? From Jack.Jansen@cwi.nl Wed Feb 17 09:48:32 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 17 Feb 1999 10:48:32 +0100 Subject: [Pythonmac-SIG] from a footprint maker In-Reply-To: Message by BUYO-BUYO-IGOR , Wed, 17 Feb 1999 10:55:35 +0900 , <36CA2197.7FF8@db3.so-net.ne.jp> Message-ID: Recently, BUYO-BUYO-IGOR said: > excuse me for sending FAQ oriented bigginner Q.. > but thought this was a chance to try.. > I am still making foootprints at the entrance of Phython world.. > I using iMac & powerbook190 and the latter is the 68k thing. > I've read the READ-ME things of the downloaded folder (mmm?..this one > wasn't FAT already?) but couldn't get which one could be used on my > powerbook ...the cfm68k-enabler is in the not-in-use-extention > folder...do I also need this to use the application that i've > downloaded?...or it depends?... The standard installer can install one of two Python versions: PythonFAT or Python68K. PythonFAT runs on PPC machines and one 68K machines with the cfm68k enabler, Python68K runs on any machine. If you can run the PythonFAT version it is probably advisable to do so: the interpreter is smaller (since the 68k interpreter loads all extension modules into memory at startup, which the fat version loads modules from shared libraries as needed), and it supports things like applets. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From william@dakini.orient.ox.ac.uk Wed Feb 17 22:23:58 1999 From: william@dakini.orient.ox.ac.uk (W.B. Douglas) Date: Wed, 17 Feb 1999 22:23:58 +0000 Subject: [Pythonmac-SIG] Tk and 68K macs In-Reply-To: <9902161142.ZM17006@Octopussy.MI.Uni-Koeln.DE> References: Jack Jansen "[Pythonmac-SIG] Tk and 68K macs" (Feb 15, 11:54pm) Message-ID: At 11:42 am +0100 16/2/99, Alexander Schliep wrote: >On Feb 15, 11:54pm, Jack Jansen wrote: >> Subject: [Pythonmac-SIG] Tk and 68K macs >> I'm looking at putting the new Tk version into MacPython... I'm with Alexander on this: so long as it's possible to run _something on the 68K machines, it'll be okay. The 68K duos have not, so far, been bettered for a small multilingual platform for research, unless you can afford a 2300. -wbd. - - - - - - - - - - - - - - - - - - - - - - - William Douglas IREMO & Oriental Institute, Oxford University From petrilli@amber.org Wed Feb 17 22:36:18 1999 From: petrilli@amber.org (Christopher G. Petrilli) Date: Wed, 17 Feb 1999 17:36:18 -0500 Subject: [Pythonmac-SIG] Tk and 68K macs In-Reply-To: ; from W.B. Douglas on Wed, Feb 17, 1999 at 10:23:58PM +0000 References: <9902161142.ZM17006@Octopussy.MI.Uni-Koeln.DE> Message-ID: <19990217173618.28418@amber.org> On Wed, Feb 17, 1999 at 10:23:58PM +0000, W.B. Douglas wrote: > At 11:42 am +0100 16/2/99, Alexander Schliep wrote: > >On Feb 15, 11:54pm, Jack Jansen wrote: > >> Subject: [Pythonmac-SIG] Tk and 68K macs > >> I'm looking at putting the new Tk version into MacPython... > > I'm with Alexander on this: so long as it's possible to run _something on > the 68K machines, it'll be okay. The 68K duos have not, so far, been > bettered for a small multilingual platform for research, unless you can > afford a 2300. Alas, I have to agree :-) I use my Duo 230 whenever I travel---although it's time to replace the battery, I've not found a better machien to take with me, honestly, plus it's paid for... having said that, I'm happy as long as SOME implementation of Python runs, it doesn't have to by a wizz-bang-bam CFM enabled jobbie :-) Chris -- | Christopher Petrilli | petrilli@amber.org From schliep@zpr.uni-koeln.de Thu Feb 18 00:49:34 1999 From: schliep@zpr.uni-koeln.de (Alexander Schliep) Date: Thu, 18 Feb 1999 01:49:34 +0100 Subject: [Pythonmac-SIG] Q: Tk & Greyscale Appearance & Mac-native problems & bugs Message-ID: <9902180149.ZM12745@Octopussy.MI.Uni-Koeln.DE> I have a couple of questions (I am using 1.5.2b1 and MacOS 8.1) for which I would appreciate any answers, leads etc. I didnt find anything in the Python and Tcl books I have, nor in dejanews in comp.lang.python or comp.lang.tcl. I wouldnt rule out that I do not truly understand the appearance manager and its implications for Tk/Tkinter. Thanks & Good night, Alexander Q: The menus I created have a white instead of a platinum background except for my About box entry in the Apple menu which has background color "SystemMenu". Changing the background color of my other menus does not have an effect (nor does "SystemMenu" have any effect for frames in dialogs). How to do that ? Q: tk_OptionMenu does not use the usual MacOS Widget. Is this something which will be fixed eventually, or do I need to deal with the Toolbox directly. Does anybody have a OptionMenu replacement ready which does Toolbox on the Mac and the usual Tk on Unix and Windows ? BUG: OptionMenu as it is is buggy. The popup will be displayed at the top of the screen when the popup-menubutton is too close to the bottom. Q: Is there a way to find out which rgb values are available in the palette ? I rather would compromise on colors then bear the rasterizing artefacts Tk produces on my 8-bit display. BUG: The standard dialogs use the Unix-Icons instead of the Mac-icons. Is this a bug in Tk or an inconvenience caused by Tkinter's Mac-port ? Also, the buttons are nicely gray, but the background is white. BUG: PhotoImage does not handle transparency in GIFs correctly. Q: Would it break a lot of things if the interpreter would handle python files with Unix or DOS end of line markers directly? Python on windows already does it (for Unix files at least) and it is very convenient Of course I will not really miss it that much until I find an NFS-client for my Mac. Though starting my software on the Unix side and the double-clicking on the same file (mounted over NFS) on my Windows box never fails to impress people when I demo cross-plattform GUI stuff. PS: BuildApplication left me truly impressed :) -- Alexander Schliep schliep@zpr.uni-koeln.de ZPR/ZAIK Tel: +49-221-470-6011 (w) University of Cologne FAX: +49-221-470-5160 Weyertal 80 http://www.zpr.uni-koeln.de/~schliep 50931 Cologne, Germany Tel: +49-231-143083 (h) From redbird@orlando.crosswinds.net Thu Feb 18 02:20:25 1999 From: redbird@orlando.crosswinds.net (Gordon Worley) Date: Wed, 17 Feb 1999 21:20:25 -0500 (EST) Subject: [Pythonmac-SIG] Tk and 68K macs In-Reply-To: <19990217173618.28418@amber.org> References: ; from W.B. Douglas on Wed, Feb 17, 1999 at 10:23:58PM +0000 <9902161142.ZM17006@Octopussy.MI.Uni-Koeln.DE> Message-ID: Christopher G. Petrilli wrote: >having said that, I'm happy as long as SOME implementation of Python >runs, it doesn't have to by a wizz-bang-bam CFM enabled jobbie :-) Don't say that. I use the cfm version and plan to keep on using it. My PowerBook 520c run the cfm version just fine and I find the static version rather limited. Even if the cfm version runs a little bit slow, I like the freedom it provides. ________________________________________ Red Bird Island Productions Gordon Worley http://www.crosswinds.net/orlando/~redbird/ mailto:redbird@orlando.crosswinds.net From Jack.Jansen@cwi.nl Thu Feb 18 10:37:29 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 18 Feb 1999 11:37:29 +0100 Subject: [Pythonmac-SIG] Tk and 68K macs In-Reply-To: Message by Gordon Worley , Wed, 17 Feb 1999 21:20:25 -0500 (EST) , Message-ID: Don't worry: 68K Python isn't going to go away for a long time, and the cfm68k version of Python will probably stay around just as long (unless something unforeseen happens, like MetroWerks dropping 68k support, but that seems pretty unlikely for the next couple of years). And I've also received enough notes of people who use Tkinter on 68K machines that I'll try to continue supporting it. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From joe@strout.net Thu Feb 18 18:23:14 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 18 Feb 1999 10:23:14 -0800 Subject: [Pythonmac-SIG] img vs. Imaging vs. PIL?!? Message-ID: Can someone explain to me the relationship between these things which I find in my Python Extensions folder... img: "a number of python modules that support handling of many different image formats" Imaging: a folder containing PIL, and associated files PIL: "adds image processing capabilities to your Python interpreter. This library provides extensive file format support, an efficient internal representation, and fairly powerful image processing capabilities" Are img and PIL basically different approaches to the same problem? Is one more standard than the other? Does one work better on the Mac than the other? Finally, in the PIL 0.2b3 documentation, there's an ImageTk and an ImageWin module, but no ImageMac module... any advice on how to display a PIL image in a QuickDraw (e.g., IDE) window? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Thu Feb 18 18:33:49 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 18 Feb 1999 10:33:49 -0800 Subject: [Pythonmac-SIG] PIL on Mac doesn't work? Message-ID: I'm trying to get a grip on the Image module of PIL under MacOS. I was able to open an image just fine using: im = Image.open(pathname) but whenever I try to do anything with this image -- even just get a pixel value -- I get a traceback: >>> im.getpixel( (0,0) ) Traceback (innermost last): File "", line 1, in ? File "Birdsong:Users:Strout:tools:Python 1.5.2b1:Extensions:Imaging:PIL:Image.py", line 503, in getpixel self.load() File "Birdsong:Users:Strout:tools:Python 1.5.2b1:Extensions:Imaging:PIL:ImageFile.py", line 122, in load self.im = Image.core.new(self.mode, self.size) File "Birdsong:Users:Strout:tools:Python 1.5.2b1:Extensions:Imaging:PIL:Image.py", line 36, in __getattr__ raise ImportError, "The _imaging C module is not installed" ImportError: The _imaging C module is not installed No mention of "_imaging" is made in the PIL 0.2b3 manual. Can anyone provide any insight here? What must I do to get at the pixels loaded by Image? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Thu Feb 18 19:55:06 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 18 Feb 1999 11:55:06 -0800 Subject: [Pythonmac-SIG] PIL on Mac doesn't work? In-Reply-To: References: Message-ID: >The Imaging folder should have a _imaging.ppc.slb file in it. I think this >module contains the core C code to run PIL. There are a lot of Python >scripts in the Imaging:PIL folder amongst others. So check to see that you >have a shared library there. Then make sure that folder is in the path. Yep, that does it. I feel like a shmuck for not noticing this myself -- thanks for pointing it out. I hate adding an entire folder for one item, so I put an alias to this library into the PIL folder. Jack, any reason we shouldn't put this shared library inside PIL (where everything else that's needed seems to be)? Does anyone have code to blit an Image into a QuickDraw window, or convert it to something that can be drawn (i.e. PICT data)? I know I could display it via Tk, but I'm hoping to integrate it with Mac toolbox calls more directly. Thanks again, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From Jack.Jansen@cwi.nl Thu Feb 18 21:59:41 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 18 Feb 1999 22:59:41 +0100 Subject: [Pythonmac-SIG] img vs. Imaging vs. PIL?!? In-Reply-To: Message by "Joseph J. Strout" , Thu, 18 Feb 1999 10:23:14 -0800 , Message-ID: Recently, "Joseph J. Strout" said: > Are img and PIL basically different approaches to the same problem? Is one > more standard than the other? Does one work better on the Mac than the > other? More-or-less. Img was written by me, with help from Sjoerd, and is meant for easy display, reading and writing of images. It supports a host of in-core bitmap formats, and can convert these to each other and the various file formats on the fly, and pretty efficient too. So, you don't really have to worry that your X11 application wants 8/8/8 RGB padded to 32 bits for easy display while your mac wants unpadded 8/8/8 BGR, img takes care of that. It'll also do conversion between colormapped/rgb/grey/bitmapped, etc. It is also pretty fast, everything being implemented in C. All that said PIL is the more functional package. Aside from reading and writing images (a tad slower, and last time I checked in less formats than img) it does all sorts of nifty image manipulations that img lacks. It is also maintained a lot better, as Fredrik keeps extending it (while img completely fits my needs as it is at the moment). There is (or at least was, I haven't used PIL in ages) a bridge module that allows PIL to use img for reading/writing images, thereby giving you the best of both worlds. The main reason I'm still maintaining img is that it is a central part in our multimedia editor and player. Maybe one day I'll turn img into something more pil-ish, but for now keeping it at least at the functionality it is at is all I have time for. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Thu Feb 18 22:02:40 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 18 Feb 1999 23:02:40 +0100 Subject: [Pythonmac-SIG] PIL on Mac doesn't work? In-Reply-To: Message by "Joseph J. Strout" , Thu, 18 Feb 1999 11:55:06 -0800 , Message-ID: Recently, "Joseph J. Strout" said: > Yep, that does it. I feel like a shmuck for not noticing this myself -- > thanks for pointing it out. I hate adding an entire folder for one item, > so I put an alias to this library into the PIL folder. Jack, any reason we > shouldn't put this shared library inside PIL (where everything else that's > needed seems to be)? There used to be a reason, but as I can't remember it anymore I guess I might as well put it there. Consider it done for the next release. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From paulmc@radiks.net Fri Feb 19 02:16:30 1999 From: paulmc@radiks.net (Paul McNally) Date: Thu, 18 Feb 1999 20:16:30 -0600 Subject: [Pythonmac-SIG] Scripting Sherlock from Python References: <36C82E40.ADF5017B@oratrix.nl> Message-ID: <36CCC97C.69A66891@radiks.net> It might be a great way to learn Python. Paul Jack Jansen wrote: > If anyone happens to be looking for a project to fill a couple of idle hours: I > just noticed that Sherlock, the 8.5 search engine, is scriptable. Apple > Technote 1141, http://developer.apple.com/technotes/tn/tn1141.html , has the > details. > > It would be nice to use this functionality from the IDE. What I'm thinking of > is a script that you would invoke from the IDE that would get the current > selection (or interactively ask for a word) and that would use an AppleEvent to > Sherlock to lookup that selection in the Python manual (or FAQ). > -- > Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ > Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ > http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://www.python.org/mailman/listinfo/pythonmac-sig From joe@strout.net Fri Feb 19 17:41:59 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 19 Feb 1999 09:41:59 -0800 Subject: [Pythonmac-SIG] XML package vs xmllib? Message-ID: I'm starting to look into XML parsing in Python. Looking over the documentation and notes at http://www.python.org/topics/xml/, it sounds like there is an xml "package" that includes a variety of modules, plus sample code, etc. In my Mac distribution, I find "xmllib.py", but this does not seem to contain all the stuff that is apparently included in the "XML package" mentioned on the web. Can anyone clarify the relationship between xmllib and the bigger XML package referred to above? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From bsavage@leland.Stanford.EDU Fri Feb 19 21:57:56 1999 From: bsavage@leland.Stanford.EDU (Robert S Savage) Date: Fri, 19 Feb 1999 13:57:56 -0800 (PST) Subject: [Pythonmac-SIG] MacOS X support in 1.5.2b2! Message-ID: <199902192157.NAA07489@treex.Stanford.EDU> Just saw this in the "what's new" file for the new beta! http://www.python.org/1.5/NEWS-152b2.txt New or improved ports --------------------- - Support for Nextstep descendants (future Mac systems). Pretty cool! - bob From cguest@ucsd.edu Fri Feb 19 23:04:54 1999 From: cguest@ucsd.edu (Clark Guest) Date: Fri, 19 Feb 1999 15:04:54 -0800 Subject: [Pythonmac-SIG] PIL on Mac doesn't work? Message-ID: It appears that the _imaging shared library is not in your PATH. If you haven't moved things around, use EditPythonPrefs to include: $(PYTHON):Extensions:Imaging and things should start to work. PIL is able to open (but not load) an image file without the shared library, but needs it for anything else. Of course, the next headache is that you can't display your image on the Mac. The Image.show() method chokes. Assuming you're using the IDE, the minimal code I've been able to use to see an image is: import Wwindows bnds = (100,100,356,356) win = Wwindows.Window(bnds,"Test") win.open() import imgformat import img flnm ="yourFilePathHere.GIF" rdr = img.reader(imgformat.macrgb16,flnm) data = rdr.read() import mac_image pixmap = mac_image.mkpixmap(256,256,imgformat.macrgb16,data) import Qd import QuickDraw Qd.CopyBits(pixmap,win.wid.GetWindowPort().portBits,(0,0,256,256),(0,0,256,256), QuickDraw.srcCopy,None) Notice: a) That this is hardwired for a 256 x 256 image, for clarity of presentation. b) It doesn't use PIL at all, but img instead. This is because img can read directly into a macrgb16 format, but as far as I know, PIL cannot. It should be possible to get PIL and img to talk to each other using PIL's Image.tostring() and Image.fromstring() methods plus some math, but I haven't worked out the details yet. c) The resulting window doesn't refresh itself. See $(PYTHON):Mac:Demo:imgbrowse:imgbrowse.py for some ideas on this. In the meantime, re-execute the last line to refresh the image. I have this vision of getting the IDE, Numeric, PIL, and a yet-to-be-named (or written) plotting package working together as a seamless whole as a python substitute for MatLab on the Mac. But I have precious little time to work on it, so progress is glacial. Hope this helps, --Clark From joe@strout.net Fri Feb 19 23:33:20 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 19 Feb 1999 15:33:20 -0800 Subject: [Pythonmac-SIG] PIL on Mac doesn't work? In-Reply-To: Message-ID: At 3:04 PM -0800 2/19/99, Clark Guest wrote: >It appears that the _imaging shared library is not in your PATH. If you >haven't moved things around, use EditPythonPrefs to include: > >$(PYTHON):Extensions:Imaging Thanks -- I solved the same problem by moving the _imaging library into the PIL folder (which was already in my path). Either way. =) >Of course, the next headache is that you can't display your image on the >Mac. The Image.show() method chokes. Assuming you're using the IDE, the >minimal code I've been able to use to see an image is... I just wrote a PixMapWrapper class which, as you might expect, wraps a QuickDraw PixMap data structure. Among the cool things it can do are: 1. initialize itself from a PIL Image object 2. initialize itself from raw data in macrgb or macrgb16 format 3. blit itself to the a QuickDraw grafport (by default, the current one) Jack wants to include this in the next release; meanwhile, if you want it, let me know and I'll be happy to send it along. >I have this vision of getting the IDE, Numeric, PIL, and a yet-to-be-named >(or written) plotting package working together as a seamless whole as a >python substitute for MatLab on the Mac. But I have precious little time to >work on it, so progress is glacial. I have the same vision, and I probably have a lot more time to work on it. Currently I'm producing (with several other people) a plug-in 2D drawing module called PIDDLE which integrates very nicely with the IDE (but also has back-ends for PostScript, Windows, PDF, and Tk, with more likely to come later). That's nearly done, though I need some things from Jack (like the GWorld toolbox calls). In the next couple of months, my spouse and I are probably going to build a plotting package on top of PIDDLE, NumPy, and Image; the only thing that will prevent us from doing so is the discovery of an existing package that already does a good job. So by summer, we should be able to kick some major Matlab arse. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Mon Feb 22 17:31:06 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 22 Feb 1999 09:31:06 -0800 Subject: [Pythonmac-SIG] "edit" and "inspect" Message-ID: Short story: I think it'd be cool to have an "edit" command in the IDE, which launches an editor appropriate for its argument -- given an Image, it passes the image to your favorite paint program; given a fsspec to a text file, it opens it in the IDE (or maybe in BBEdit?); given a list or array, it opens a spreadsheet-like editor built on the List Manager; etc. I'd like to get feedback on this idea. Long story: Just has this cool object browser built into the IDE, that lets you browse the data of anything with a __dict__ attribute, such as namespaces or objects. It has twist-down triangles to show/hide elements of a list or sub-object, or you can double-click any subobject to open it in its own browser. With Just's kindly help, I added an "inspect" command that acts like a built-in while you're in the IDE, which launches the object browser on its argument. (You should see this in the next release.) This is mighty handy, and if any of you have used Mac Common Lisp, you'll recognize this feature borrowed from that environment. While thinking about the ideal numeric data-processing environment recently, it occurred to me to extend this further: one should be able to open a matrix (array or list) in a spreadsheet-ish editor, for easy browsing and editing. Using the List Manager, such an editor would be nontrivial but doable. Then today, it occurred to me that we might want to "edit" other types as well. So I'm imagining an edit module, to which one can add more particular types of editors. Given "edit(foo)", the edit command will look up which installed editors handle type(foo), and basically give each one a chance to handle the data, until one reports that it can indeed handle it. Some will work entirely within the IDE (like the array editor); others may work by passing the data through AppleEvents to a helper application. What do you think? Any merit in this idea? Anybody want to help? I'm especially uncertain when it comes to mucking about with AppleEvents, so any help there would be much appreciated. I can probably do the array editor myself. If you work with a particular kind of data often, and want to do (or suggest) an editor for it, let's talk about that too. I think this could be a great improvement to the IDE, and go a long way to making MacPython a real power in the data-manipulation world. Any comments? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Mon Feb 22 19:30:52 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 22 Feb 1999 11:30:52 -0800 Subject: [Pythonmac-SIG] GetScrap -- use of? Message-ID: Anybody (Jack?) know how to use Scrap.GetScrap? The docstring on it sez: (Handle hDest, ResType theType) -> (long _rv, long offset) According to Inside Mac, I should be able to pass a null handle for the first parameter if I just want to see whether a certain type is on the clipboard. But neither of these works: >>> Scrap.GetScrap(None, 'TEXT') TypeError: Resource required >>> Scrap.GetScrap(0,'TEXT') TypeError: Resource required I also can't figure out how to get the data; there's apparently no "NewHandle" function available from Python, and passing a string as the first parameter gives me the same error. Perhaps the error refers to the second parameter, and I'm supposed to pass something other than a string for theType? I even did a global search on all .py files under the Python directory, including the IDE and Demo folders, and GetScrap doesn't occur anywhere. I'm stumped on this one... any help will be greatly appreciated! Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From byrne@acm.org Mon Feb 22 19:43:21 1999 From: byrne@acm.org (Mike Byrne) Date: Mon, 22 Feb 1999 14:43:21 -0500 Subject: [Pythonmac-SIG] Re: GetScrap -- use of? In-Reply-To: Message-ID: <199902221943.OAA07223@mail1.andrew.cmu.edu> On 99.02.22, Joseph J. Strout wrote: > Anybody (Jack?) know how to use Scrap.GetScrap? The docstring on it > sez: > > (Handle hDest, ResType theType) -> (long _rv, long offset) > > According to Inside Mac, I should be able to pass a null handle for > the first parameter if I just want to see whether a certain type is > on the clipboard. But neither of these works: > > >>> Scrap.GetScrap(None, 'TEXT') > TypeError: Resource required > > >>> Scrap.GetScrap(0,'TEXT') > TypeError: Resource required > > I also can't figure out how to get the data; I ran into this, too. You have to make a "dummy" resource, and then you access the results with the "data" field. Here's the function I use to get the text on the clipboard: import Res import Scrap def scrapString(): TheScrap = Res.Resource("") Scrap.GetScrap(TheScrap, 'TEXT') return TheScrap.data There's probably a better way to do this, but this has worked for me so far. -Mike =========================================================== Mike Byrne, Ph.D. byrne@acm.org +1 412-268-3498 Postdoctoral Research Associate in Cognitive Psychology/HCI Psychology Department, Carnegie Mellon University Pittsburgh, PA 15213-3890 http://act.psy.cmu.edu/ACT/people/byrne/index.html From joe@strout.net Mon Feb 22 19:50:25 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 22 Feb 1999 11:50:25 -0800 Subject: [Pythonmac-SIG] Re: GetScrap -- use of? In-Reply-To: <199902221943.OAA07223@mail1.andrew.cmu.edu> References: Message-ID: At 11:43 AM -0800 02-22-99, Mike Byrne wrote: >I ran into this, too. You have to make a "dummy" resource, and then you >access the results with the "data" field.... > >def scrapString(): > TheScrap = Res.Resource("") > Scrap.GetScrap(TheScrap, 'TEXT') > return TheScrap.data OK, thanks -- that gets me unstuck. (My 2D array editor is coming along just swimmingly, now!) Jack, any reason we don't have a NewHandle() function? And, how about supporting "None" for the first parameter to GetScrap, as a null handle? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From bsavage@leland.Stanford.EDU Mon Feb 22 22:32:04 1999 From: bsavage@leland.Stanford.EDU (Robert S Savage) Date: Mon, 22 Feb 1999 14:32:04 -0800 (PST) Subject: [Pythonmac-SIG] Gnuplot (console) Message-ID: <199902222232.OAA19344@treex.Stanford.EDU> > From: "Anthony M. Ingraldi" > To: pythonmac-sig@python.org > Subject: Re: [Pythonmac-SIG] drawing graphics with Mac version of Python > > The gnuplot console code is included in the gnuplot distribution. This is > > The console code is a rather simple script that interacts with the gnuplot > app via AppleEvents. > I have recently been looking at GNUplot and it occured to me that you should be able to drive GNUplot from MacPython by importing the Gnuplot object and simply sending it individual commands (rather than interactively). Am I right in this? If it is more complicated, would you happen to have an example of executing a GNUplot command from Python code? Thanks! Bob Savage From A.M.INGRALDI@larc.nasa.gov Tue Feb 23 14:36:19 1999 From: A.M.INGRALDI@larc.nasa.gov (Anthony M. Ingraldi) Date: Tue, 23 Feb 1999 09:36:19 -0500 Subject: [Pythonmac-SIG] Re: Gnuplot (console) Message-ID: <199902231434.JAA15963@express.larc.nasa.gov> > > I have recently been looking at GNUplot and it occured to me that you > should be able to drive GNUplot from MacPython by importing the Gnuplot > object and simply sending it individual commands (rather than > interactively). Am I right in this? Absolutely. All you need to do is pass the command you want executed to the gnuexec method. Here's an example that will produce a sine wave plot. This example makes use of gnuplot_Suites.py that I included in the gnuplot console package. (Line wrapping is at the mercy of my e-mail program.) import gnuplot_Suites, Required_Suite, aetools # The Creator signature of gnuplot: SIGNATURE="GPSE" class GNUPLOT(aetools.TalkTo, Required_Suite.Required_Suite, \ gnuplot_Suites.gnuplot_Suite, gnuplot_Suites.odds_and_ends, gnuplot_Suites.Standard_Suite, \ gnuplot_Suites.Miscellaneous_Events): pass g = GNUPLOT(SIGNATURE, 1) g.gnuexec('plot sin(x)') -- Tony Ingraldi | e-mail: A.M.INGRALDI@LaRC.NASA.GOV NASA Langley Research Center | Mail Stop 267 | Phone : (757) 864-3039 Hampton, VA 23681-0001 | Fax : (757) 864-7892 From Jack.Jansen@cwi.nl Wed Feb 24 09:17:36 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 24 Feb 1999 10:17:36 +0100 Subject: [Pythonmac-SIG] GetScrap -- use of? In-Reply-To: Message by "Joseph J. Strout" , Mon, 22 Feb 1999 11:30:52 -0800 , Message-ID: Recently, "Joseph J. Strout" said: > Anybody (Jack?) know how to use Scrap.GetScrap? The docstring on it sez: > > (Handle hDest, ResType theType) -> (long _rv, long offset) > > According to Inside Mac, I should be able to pass a null handle for the > first parameter if I just want to see whether a certain type is on the > clipboard. But neither of these works: > > >>> Scrap.GetScrap(None, 'TEXT') > TypeError: Resource required > > >>> Scrap.GetScrap(0,'TEXT') > TypeError: Resource required > > I also can't figure out how to get the data; there's apparently no > "NewHandle" function available from Python, and passing a string as the > first parameter gives me the same error. Perhaps the error refers to the > second parameter, and I'm supposed to pass something other than a string > for theType? NewHandle() is called Res.NewResource(), for silly historical reasons. I do plan to change that sometime, but since it'll break lots of things I'd like to put it off until I have a better idea how to do inheritance between the various types (i.e. a dialog inherits a window inherits a grafport, a menubar inherits a resource inherits a handle, etc), since this will also break things. > I even did a global search on all .py files under the Python directory, > including the IDE and Demo folders, and GetScrap doesn't occur anywhere. > I'm stumped on this one... any help will be greatly appreciated! That's funny, the test code seems to have disappeared... Anyway, you have to do def getscrap(): h = Res.Resource() length, offset = Scrap.GetScrap(h, 'TEXT') return h.data Maybe someone could add GetScrap/PutScrap calls to one of the example programs to show their use? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Wed Feb 24 09:19:17 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 24 Feb 1999 10:19:17 +0100 Subject: [Pythonmac-SIG] Re: GetScrap -- use of? In-Reply-To: Message by "Joseph J. Strout" , Mon, 22 Feb 1999 11:50:25 -0800 , Message-ID: Recently, "Joseph J. Strout" said: > At 11:43 AM -0800 02-22-99, Mike Byrne wrote: > > >I ran into this, too. You have to make a "dummy" resource, and then you > >access the results with the "data" field.... > > > >def scrapString(): > > TheScrap = Res.Resource("") > > Scrap.GetScrap(TheScrap, 'TEXT') > > return TheScrap.data Oops, Mike is right, Resource needs an empty string parameter. > Jack, any reason we don't have a NewHandle() function? And, how about > supporting "None" for the first parameter to GetScrap, as a null handle? The "None" parameter wouldn't be very useful, as you wouldn't be able to retrieve the data gotten from the scrap... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Wed Feb 24 12:50:26 1999 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 24 Feb 1999 13:50:26 +0100 Subject: [Pythonmac-SIG] Contributions for MacPython 1.5.2b2 requested Message-ID: As Guido just release 1.5.2b2 a new release of MacPython is also imminent. If people have stuff they would like to include in the Mac:Contrib section please drop me a note. Also, if the authors of the existing contributed software (BBPy, osam, PythonScript) have newer versions please send them to me. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From joe@strout.net Wed Feb 24 16:23:42 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 24 Feb 1999 08:23:42 -0800 Subject: [Pythonmac-SIG] Re: GetScrap -- use of? In-Reply-To: References: Message by "Joseph J. Strout" , Mon, 22 Feb 1999 11:50:25 -0800 , Message-ID: At 1:19 AM -0800 02-24-99, Jack Jansen wrote: >> > TheScrap = Res.Resource("") > >Oops, Mike is right, Resource needs an empty string parameter. Right, that's what's so wierd. I'm not suggesting changing this or disposing of Res.Resource. I'm just suggesting adding the following to some appropriate module: def NewHandle(size=0): import Res return Res.Resource('.'*size) This will give us the syntax and functionality of the toolbox NewHandle function, it will work, and nobody will have to get nailed to anything... >>And, how about >> supporting "None" for the first parameter to GetScrap, as a null handle? > >The "None" parameter wouldn't be very useful, as you wouldn't be able >to retrieve the data gotten from the scrap... Untrue -- it would be useful for the same reason the real toolbox call supports NULL for the first parameter: sometimes, you want to check whether the requested data type exists, but you don't need or want to retrieve it. For example, in deciding whether the Paste menu item should be enabled or disabled, you might check for the presence of 'TEXT' on the scrap, but it's wasteful to actually allocate a handle and stuff the text into it until someone actually does the paste operation. Moreover, since the toolbox call works that way, old Macheads like myself rather expect Scrap.GetScrap to work that way too. So by the Principle of Least Surprise, we should implement it that way unless it's a real pain to do so. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Wed Feb 24 18:57:22 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 24 Feb 1999 10:57:22 -0800 Subject: [Pythonmac-SIG] 'edit' module Message-ID: I've just posted my 'edit' module. This is the thing that, in an interactive IDE window, lets you type edit(foo) to quickly launch an editor appropriate for whatever 'foo' is. Currently I've got modules for short strings and 2D Numeric matrices; I've also got a shell of an editor for sequences, but it's not implemented yet. The whole thing is still rather rough around the edges, but I'm posting it to solicit feedback. See: http://www.strout.net/python/edit/ Then, once you've got the modules, try these tests: import Numeric foo = Numeric.ones(100) foo.shape = (10,10) edit(foo) foo = "bar" foo = editreturn(foo) (Please excuse the debugging outputs printed by the matrix editor -- as I said, it's a work in progress.) Looking forward to your comments, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Wed Feb 24 22:24:18 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 24 Feb 1999 14:24:18 -0800 Subject: [Pythonmac-SIG] diff/patch for MacOS? Message-ID: Anybody know of diff/patch utilities for MacOS? I know this isn't strictly a MacPython question, but it is related since (1) I want it mainly to control changes to Python apps, and apply those patches people keep sending me, and (2) if I get frustrated and end up writing them myself, I'll do it in Python. ;) Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From just@letterror.com Wed Feb 24 23:23:20 1999 From: just@letterror.com (Just van Rossum) Date: Thu, 25 Feb 1999 00:23:20 +0100 Subject: [Pythonmac-SIG] diff/patch for MacOS? In-Reply-To: Message-ID: At 2:24 PM -0800 2/24/99, Joseph J. Strout wrote: >Anybody know of diff/patch utilities for MacOS? > >I know this isn't strictly a MacPython question, but it is related since >(1) I want it mainly to control changes to Python apps, and apply those >patches people keep sending me, and (2) if I get frustrated and end up >writing them myself, I'll do it in Python. ;) There are diff/patch tools for MPW (which also comes with CodeWarrior these days). I've only used the diff part so far. The good thing about them is that they're the real thing, no reimplementations. Fully compatible with unix. You can find them both here: ftp://sunsite.cnlab-switch.ch/software/platform/macos/src/HTML/MPW_C.html I don't know of any standalone versions :-(. Just From sdm7g@virginia.edu Wed Feb 24 23:52:02 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Wed, 24 Feb 1999 18:52:02 -0500 (EST) Subject: [Pythonmac-SIG] diff/patch for MacOS? In-Reply-To: Message-ID: On Wed, 24 Feb 1999, Joseph J. Strout wrote: |Anybody know of diff/patch utilities for MacOS? | |I know this isn't strictly a MacPython question, but it is related since |(1) I want it mainly to control changes to Python apps, and apply those |patches people keep sending me, and (2) if I get frustrated and end up |writing them myself, I'll do it in Python. ;) | Joe -- I've used the 'compare' utility in the Alpha editor interactively but I never tried patching with it, so I just fired it up to see if there was a patch function. When I do a compare and the the compare output window is the front active window, a 'diff' menu appears, which has, among other items: patch into left window patch into right window In the Tools folder is a copy of "GNU Diff", which appears to implement these functions. It seems to be a "headless" background app, because just clicking on "GNU Diff" appears to start a process, which has no menu and doesn't appear in the task bar. The only sign that it's running is the visual clues on startup, and the fact that the icon is greyed out. There is a 'diff' mode which activates that menu, so if you open up a patch file and a source file, you should be able to access that option without doing a compare. ( Since it's based on GNU Diff, I assume that it ought to work on any diff generated patch file. ) BBEdit might have similar functionality. ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- Caldera Open Linux: "Powerful and easy to use!" -- Microsoft(*) (*) From sdm7g@virginia.edu Thu Feb 25 00:04:23 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Wed, 24 Feb 1999 19:04:23 -0500 (EST) Subject: [Pythonmac-SIG] diff/patch for MacOS? In-Reply-To: Message-ID: On Thu, 25 Feb 1999, Just van Rossum wrote: | |There are diff/patch tools for MPW (which also comes with CodeWarrior these |days). I've only used the diff part so far. The good thing about them is |that they're the real thing, no reimplementations. Fully compatible with |unix. You can find them both here: | |ftp://sunsite.cnlab-switch.ch/software/platform/macos/src/HTML/MPW_C.html | Cool. If you install Toolserver, you can run the MPW command line apps from the CodeWarrior IDE. I've only used it with some of the standard MPW tools, so I don't know if there is anything additional needed to enable that. ( One of these days we need to do a MPW tool version of Python so you can use if from CodeWarrior! ) ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- Caldera Open Linux: "Powerful and easy to use!" -- Microsoft(*) (*) From cwalker@pixar.com Fri Feb 26 19:58:54 1999 From: cwalker@pixar.com (Chris Walker) Date: Fri, 26 Feb 1999 11:58:54 -0800 Subject: [Pythonmac-SIG] alias question Message-ID: I'm doing an os.path.walk() checking for aliases and other file types. However, if there's an alias pointing to a network volume, the user is prompted to log in to the server to mount the volume so os.path.walk() can continue. My question is this: is there a way to determine whether or not a file is an alias such that if the alias points to a network volume, the user won't be prompted. This seems possible because the information is available via 'Get Info...'. TIA --- Chris Walker Pixar Animation Studios UNIX Systems Administrator (510) 620-3736 cwalker@pixar.com If it wasn't for disappointment, I wouldn't have any appointments. From joe@strout.net Fri Feb 26 20:45:10 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 26 Feb 1999 12:45:10 -0800 Subject: [Pythonmac-SIG] alias question In-Reply-To: Message-ID: At 11:58 AM -0800 02-26-99, Chris Walker wrote: >question is this: is there a way to determine whether or not a file is an >alias >such that if the alias points to a network volume, the user won't be prompted. Yep. I don't use os.path.walk() -- mainly because I didn't know about it -- but I do the same thing with a FileCrawler class, which lets you define behavior to take for docs, folders, doc aliases, and folder aliases: import mac import macfs from MACFS import * class FileCrawler: def handleAlias(self, path): print "Document alias:", path def handleFolderAlias(self, path): print "Folder alias:", path def handleDocument(self, path, typecode): print typecode, "Document:", path def handleFolder(self, path): print "Folder:", path self.crawl(path) def crawl(self, path): files = mac.listdir(path) for fname in files: if path[-1] == ':': fpath = path + fname else: fpath = path + ':' + fname spec = macfs.FSSpec(fpath) try: info = spec.GetFInfo() except: # if GetFInfo fails, it must be a folder! info = macfs.FInfo() info.Type = 'fldr' if info.Flags & kIsAlias: if info.Type == 'fdrp': self.handleFolderAlias(fpath) else: self.handleAlias(fpath) elif info.Type == 'fldr': self.handleFolder(fpath) else: self.handleDocument(fpath, info.Type) >--- >Chris Walker >Pixar Animation Studios Cool -- are you guys using MacPython at Pixar? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From just@letterror.com Fri Feb 26 21:20:14 1999 From: just@letterror.com (Just van Rossum) Date: Fri, 26 Feb 1999 22:20:14 +0100 Subject: [Pythonmac-SIG] alias question In-Reply-To: References: Message-ID: At 12:45 PM -0800 2/26/99, Joseph J. Strout wrote: >-- but I do the same thing with a FileCrawler class, which lets you define >behavior to take for docs, folders, doc aliases, and folder aliases: Cool class, Joe! Two nitpicks: >import mac [ ... ] > def crawl(self, path): > files = mac.listdir(path) Never import "mac" directly, all its functionality is available from os. I guess the docs aren't too clear about this. "mac" is the equivalent of the posix module on unix, which you also shouldn't use directly. > if path[-1] == ':': fpath = path + fname > else: fpath = path + ':' + fname Ah, here's another neat function from os.path which you could use instead: fpath = os.path.join(path, fname) (it's cross platform, too!) Just From sdm7g@virginia.edu Fri Feb 26 23:35:34 1999 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Fri, 26 Feb 1999 18:35:34 -0500 (EST) Subject: [Pythonmac-SIG] modal or movable-modal (or non-modal) dialog. Message-ID: FYI: I Found the answer to one of my own dialog questions: w.GetWVariant() returns the Proc type of a window. So determining if a dialog is (non-movable) modal can be: isModal = d.GetWVariant() in (1,2,3) [ So now EasyDialogs v2 can tell whether to use ModalDialog or not by the type of window used. ] ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- Caldera Open Linux: "Powerful and easy to use!" -- Microsoft(*) (*)