From Jack.Jansen@cwi.nl Fri Nov 1 11:30:26 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Fri, 01 Nov 1996 12:30:26 +0100 Subject: [PYTHONMAC-SIG] Drag & Drop ? In-Reply-To: Message by "Steven D. Majewski" , Tue, 29 Oct 1996 17:23:30 -0500 (EST) , Message-ID: <9611011130.AA13388=jack@schelvis.cwi.nl> Recently, "Steven D. Majewski" said: > > Anyone tried to write a Drag and Drop applet in Mac Python ? > > My guess is that it can be done using the MacOS high level > event functions, but I haven't yet figured it out. If anyone > has already done this and has an example at hand, please post! > > I'ld like to convert one of my file conversion scripts so I can > just drop a folder full of files onto it. This is simple. Just give your applet a BNDL resource containing (at least) the types of files you're willing to handle (use '****' to handle any file, 'fldr' for folders, etc, see Inside Mac for details). Dropping a file on your applet will give you the filename in sys.argv. EditPythonPrefs uses this (and I think that one of the examples in the Demo folder explains this too, but I will check). If you want more control over the startup appleevents (Open App, Open Doc, etc) you can completely disable python's argv processing with a startup option, but then you will have to write your own high-level event handling loop (or use MiniAEFrame). The "cgi" example in Demo explains about 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 ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Fri Nov 1 11:43:59 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Fri, 01 Nov 1996 12:43:59 +0100 Subject: [PYTHONMAC-SIG] MacPython 1.4 & Numeric Python In-Reply-To: Message by Rob Managan , Tue, 29 Oct 1996 16:35:30 +0100 , Message-ID: <9611011144.AA13420=jack@schelvis.cwi.nl> Recently, Rob Managan said: > Has anyone built version 1.4 from the source? > > I have had a few problems. the file macgetpath.c references > GUSILoadConfiguration which is not resolved. I guess this means that Jack > modified the standard GUSI distribution since this routine is not in the > CWGUSI distribution. Ah, you're one of those people who don't read the documentation:-) Demo:building.html has the details on this. You either need to modify CWGUSI (the modified files are supplied with the python distribution) or strip out the call to GUSILoadConfiguration (and possibly one other routine). > I do have NumPy working with the 1.4b3 release if anyone wants it. I've also done this (it turned out to be almost trivial, with the exception of one or two minor changes to the numpy stuff due to incorrect declarations in the metrowerks header files), if you mail me your stuff I'll compare the two and pack up a distribution. What I have done is put NumPy in Extensions and created projects for the cfm68k and ppc shared libraries. The one thing I still need to do is to write an "install" script (that will do nothing more than add the correct path components to your preferences file). I would like to make this the standard form for adding packages (PIL coming up, maybe WxPyMac, possibly I'll also start distributing img as an extension). What do people think of the following layout for extensions: Extensions:foo:foo.ppc.slb foo.CFM68K.slb Lib instalfoo.py where instalfoo adds the current folder and the Lib folder to the sys.path initialization (preferrably after checking whether the $(PYTHON) prefix can be used). Exact details may differ (for instance for NumPy, which doesn't have a Lib directory but uses ni and would only need Extensions:foo in sys.path). -- 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 - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jeff@cynapses.com Fri Nov 1 17:25:33 1996 From: jeff@cynapses.com (jeffrey P. Shell) Date: Fri, 01 Nov 1996 10:25:33 -0700 Subject: [PYTHONMAC-SIG] found the .pyc bug (1.4) Message-ID: <327A328D.6D0A@cynapses.com> regarding the 1.4 .pyc bug i reported earlier: it happens when you have an Alias in the sys.path. My main project folder started out as a cgi-bin folder when i was experimenting with MacHTTP, and has been in my HTML projects folder ever since with an Alias from my Python folder. This has worked fine with both 1.3.3 and 1.4b3 (CFM68k). I switched the original and the alias so that the original cgi-bin folder is now in the Python folder and the alias is in my HTML folder. Now everything works fine. but it IS an annoying little bug. So, is SIOUX sped up in 1.4final? or is everything sped up? i've been really impressed with how much faster text is displayed in the SIOUX window (i'm getting a HUUUGE speed increase over 1.4b3 and 1.3.3). -- .jPS || jeff@cynapses.com || http://www.cynapses.com/ry/ ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Sat Nov 2 00:17:22 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Sat, 02 Nov 1996 01:17:22 +0100 Subject: [PYTHONMAC-SIG] found the .pyc bug (1.4) In-Reply-To: Message by "jeffrey P. Shell" , Fri, 01 Nov 1996 10:25:33 -0700 , <327A328D.6D0A@cynapses.com> Message-ID: <9611020017.AA17667=jack@schelvis.cwi.nl> Recently, "jeffrey P. Shell" said: > regarding the 1.4 .pyc bug i reported earlier: it happens when you have > an Alias in the sys.path. My main project folder started out as a > cgi-bin folder when i was experimenting with MacHTTP, and has been in my > HTML projects folder ever since with an Alias from my Python folder. > This has worked fine with both 1.3.3 and 1.4b3 (CFM68k). I switched the > original and the alias so that the original cgi-bin folder is now in the > Python folder and the alias is in my HTML folder. Now everything works > fine. but it IS an annoying little bug. Again, I can't reproduce this. Could you give an exact example of where the files, aliases and directories in question are? (As an aside: I am also suddenly experiencing problems with aliases appearing to be treated differently than they were before, so it could be that there is a change in CWGUSI that somehow causes this). > So, is SIOUX sped up in 1.4final? or is everything sped up? i've been > really impressed with how much faster text is displayed in the SIOUX > window (i'm getting a HUUUGE speed increase over 1.4b3 and 1.3.3). This *might* have to do with the fact that I disabled the gazillions of debug options in malloc for the distribution, something I overlooked for all previous distributions (>blush<). I've also carefully examined the optimization settings for all projects, also done sloppily previously. -- 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 - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From tomf59@sgi.net Sun Nov 3 08:31:06 1996 From: tomf59@sgi.net (Tom Fetherston) Date: Sun, 3 Nov 1996 03:31:06 -0500 Subject: [PYTHONMAC-SIG] New Python Mode for Alpha Editor Message-ID: Hello all! I just downloaded the Python app and joined this list last week. One of the things I was interested to see was if anyone was using Alpha to edit code and interact with Python. I saw from the mailing-list archives that a few of you did but that no one really knew Alpha well enough to write a good, customized mode for Python. Well, I have been writing a Alpha mode for SuperCard, so I thought I would take a crack at this. I'am hoping to release a first version of this early this week. If you are interested, send me email and I will give you a copy of this when it is ready. Enclose any features that you might like to have and I'll see what I can do. Now, I still know practically no Python (most of the time has gone into writing this mode :) ), and I may have some of the stuff wrong, so your comments would be appreciated. There is still a lot of enhancements that can be added once I know a little more about Python. Thanks to Rob Managan for providing the existing version of the Python mode for Alpha that I used as a base. Thanks also to Just van Rossum for his Python slave that allows python code to be run via appleEvents. To use this mode, you will need a copy of Alpha (current released version is 6.5). This is a shareware editor ($30). A fully functional version of it can be retrieved via links off Alpha's home page: http://www.cs.umd.edu/~keleher/alpha.html Below are some excerpts from the Python Mode Help File. It lists most of what I've got working (or hope to have working) in this first release. Note: The Python mode will be freeware. Sincerely, Tom Fetherston Pittsburgh, PA (USA) ######################## Python Support in Alpha ######################## Introduction =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This document describes the use of the Python menu in Alpha. The Python menu was written to allow Alpha to act as a front end for Just's slave Python application and to make it possible to "attach" Python scripts to Alpha. It provides a number of features designed to make the use and development of Python scripts on the Mac more convenient. These are detailed in the rest of this document (most easily navigated using the "M" menu on the sidebar), but here's a quick overview: Editing Python scripts... * Python keywords and special variables are colorized in Python mode. * For entering code, this mode automatically detects colons that require indentation of the next line of code and does the indentation for you when you enter a return. To facilitate "dedenting", "cmd-" puts the next line out one level, while "opt->return>" brings you flush to the left margin. * A Python "man page" is provided as an on-line reference, available as the file "Python Commands" in Alpha's Help menu; it has been colorized and indexed to make it easy to read and navigate. * The man page can be referenced by command-double-clicking a highlighted Python keyword or other special words in your Python script. Running Python Scripts... * Python scripts can be run directly from Alpha - a script can be a text window in Alpha, a highlighted selection from a window, or a disk file. Python Mode =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Python mode is entered automatically whenever you open a file with a ".py" or ".pyc" suffix; you can also invoke it explicitly using the modes menu pop-up in the status bar at the bottom of the screen. Python mode offers a number of features supporting the editing and debugging of Python scripts: Basic language support ---------------------- * Python keywords are colored blue in Python mode. * Comments are colored in a light brown. * To enhance visibility, certain punctuation is shown in red. * Double-quote enclosed strings are colored green. (note: Alpha is not able to detect and color the other types of strings) * Whenever you save a python script with the keyboard shortcut, "cmnd-s", its end-of-line characters will be changed to those used on the Mac, and its creator will be set to "Pyth". Saving via the save command in the "File" menu does not apply the above changes. * A single line or a selected block of lines may be commented out by using the "Comment Line" command under the "Text" menu. Lines are uncommented using "Uncomment Line", which appears in the "Text" menu when the option key is held down. * Alpha will create an index of all classes and def's in your Python script when you click the "{}" button on the sidebar. This index is re-computed whenever you have made changes and click on the "{}" button. The index is maintained in alphabetical order. * Alpha will create an index of all classes and def's in your Python script when you select "Mark File" from the Marks menu on the sidebar (the "M" button). The index is in the order of appearance. Once created, whenever you save your file, this index is saved with it. When you open a Python script that hasn't already been "Mark-indexed", an index is automatically created. * Both of the above indices indicate the number and kind of parameters that each "def" takes. These are shown within paren's, the symbols and what they represent are: "*" - regular parameter "=BF" - optional parameter that has a default value "=8A" - parameter that will "absorb" any additional arguments Command-double-clicking (almost) ----------------------- A simple form of hypertext help is invoked by double-clicking on certain pieces of text while the command key is held down: * The online man page can be referenced by command-double-clicking a highlighted Python keyword or special variable in your Python script. Most of the clickable keywords and variables will be colored blue. Special variables containing alphabetic characters, .e.g. @ARGV, are also clickable but are not colored. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Tue Nov 5 22:10:08 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Tue, 5 Nov 1996 17:10:08 -0500 (EST) Subject: [PYTHONMAC-SIG] Drag & Drop ? In-Reply-To: <9611011130.AA13388=jack@schelvis.cwi.nl> Message-ID: On Fri, 1 Nov 1996, Jack Jansen wrote: > This is simple. Just give your applet a BNDL resource containing (at > least) the types of files you're willing to handle (use '****' to > handle any file, 'fldr' for folders, etc, see Inside Mac for > details). Dropping a file on your applet will give you the filename in > sys.argv. EditPythonPrefs uses this (and I think that one of the > examples in the Demo folder explains this too, but I will check). Thanks -- I flailed away at trying to patch the BNDL resources with ResEdit for a while, before I reread part of Inside Mac to try to figure out what I was missing. I saw the note about how the BNDL info is loaded into the file catalog, and the problem appeared to be that it was ignoring the edited info once the original info was loaded into the catalog. I tried modifying the resource in the applet template file before I got around to searching thru the source and documentation and found that what I needed to do was create a .rsrc file with the same name as my app with the extra resources to be added. Gee Jack -- It really works nicely once I read the instructions! :-> [ Maybe I'll write up the steps for an example and post it to one of the comp.sys.mac groups to show off how easy the drag and drop is. ] ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Tue Nov 5 22:13:14 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Tue, 5 Nov 1996 17:13:14 -0500 (EST) Subject: [PYTHONMAC-SIG] Mac Python .html docs In-Reply-To: Message-ID: BTW: Are the Mac .html docs you have in the Mac:Demo folder online anywhere -- either cwi or python.org ? ( If I write up some further examples, I'ld like to reference them. ) ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jstrout@ucsd.edu Tue Nov 5 23:33:34 1996 From: jstrout@ucsd.edu (Joseph Strout) Date: Tue, 5 Nov 1996 15:33:34 -0800 (PST) Subject: [PYTHONMAC-SIG] stdwin gone? Message-ID: I haven't had a chance to download 1.4 yet, but I recommended it (MacPython) to someone interested in speech synthesis. I told him about the Holy Grail demo, and he was quite excited -- but it apparently no longer works, because it requires stdwin, which is no longer included (?). Is this true? If so, it really ought to be fixed, by either putting stdwin back in the distribution, or changing the demo so that it doesn't need it. ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jstrout@ucsd.edu Tue Nov 5 23:33:34 1996 From: jstrout@ucsd.edu (Joseph Strout) Date: Tue, 5 Nov 1996 15:33:34 -0800 (PST) Subject: [PYTHONMAC-SIG] stdwin gone? Message-ID: I haven't had a chance to download 1.4 yet, but I recommended it (MacPython) to someone interested in speech synthesis. I told him about the Holy Grail demo, and he was quite excited -- but it apparently no longer works, because it requires stdwin, which is no longer included (?). Is this true? If so, it really ought to be fixed, by either putting stdwin back in the distribution, or changing the demo so that it doesn't need it. ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Wed Nov 6 10:50:30 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 06 Nov 1996 11:50:30 +0100 Subject: [PYTHONMAC-SIG] stdwin gone? In-Reply-To: Message by Joseph Strout , Tue, 5 Nov 1996 15:33:34 -0800 (PST) , Message-ID: <9611061050.AA28236=jack@schelvis.cwi.nl> > I haven't had a chance to download 1.4 yet, but I recommended it > (MacPython) to someone interested in speech synthesis. I told him about > the Holy Grail demo, and he was quite excited -- but it apparently no > longer works, because it requires stdwin, which is no longer included (?). > > Is this true? If so, it really ought to be fixed, by either putting > stdwin back in the distribution, or changing the demo so that it doesn't > need it. Grmpf, you're right, I had never thought about the Holy Grail demo anymore. Is anyone willing to look at it and convert it to use Tkinter or textedit or waste or something? Otherwise I will do it at some point (but it will be a while). -- 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 - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Wed Nov 6 22:51:37 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 06 Nov 1996 23:51:37 +0100 Subject: [PYTHONMAC-SIG] Anyone using $(APPLICATION) in sys.path preferences? Message-ID: <9611062251.AA02948=jack@schelvis.cwi.nl> Would anyone be bothered if I removed the special case of using $(APPLICATION) in sys.path? The intention of it is that you can add named "PYC " resources to your application file and import these, but it turns out that this solution is not the optimal one, and I am planning to replace it with a similar but better one. For those interested in the details: I would like to add a special case $(RESOURCE) which would search for a named PYC resource in the current resource chain. It turns out that the $(APPLICATION) solution opens the file for each pyc module imported, and this is extremely slow if the application resides on a cdrom. If people have other uses for this feature I'll leave it in, but I have this vague feeling that nobody would be bothered if I did replace it with the one sketched, and less code is always better... -- 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 - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From tomf59@sgi.net Fri Nov 8 20:42:53 1996 From: tomf59@sgi.net (Tom Fetherston) Date: Fri, 8 Nov 1996 15:42:53 -0500 Subject: [PYTHONMAC-SIG] Re: Python Mode is Here! Message-ID: Hello all, Thanks to Rob Managan: >My first minor fix. In Pythonmode.tcl I changed this line so it specifies >the pythonKeys.tcl file relative to the Alpha application. > >source "$HOME:Tcl:Modes:PythonKeys.tcl" > this is at line 576 of the above mentioned file. This is why no colorizing occurred as note by Guido van Rossum in his note. Oops, I thought that doing a complete install of alpha and then instaling the mode would catch stuff like this, oh well. Tom ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Fri Nov 8 21:16:44 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Fri, 8 Nov 1996 16:16:44 -0500 (EST) Subject: [PYTHONMAC-SIG] Re: Python Mode is Here! In-Reply-To: Message-ID: Thanks and Good Work, Tom! It's nice to have the syntax coloring -- a little garish and startling, but I can change my color settings easily enough! One minor bug noted: It' doesn't work on triple quoted strings. I was talking up the joys of CyberDog to Guido over dinner at SPAM -- more testimonials: MIME mail enclosures used to be such a pain until I got CyberDog. Instead of Eudora dropping things in folders without telling me, I can just drag the .sit file out of the message onto my desktop or wherever it belongs! ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From tomf59@sgi.net Sat Nov 9 11:17:26 1996 From: tomf59@sgi.net (Tom Fetherston) Date: Sat, 9 Nov 1996 06:17:26 -0500 Subject: [PYTHONMAC-SIG] More bug fixes for Pythmode Message-ID: --============_-1364584251==_============ Content-Type: text/plain; charset="us-ascii" 1) The command double click help-system has a couple of problems: The help files are supposed to open up in a "read-only" mode, in order to cause this lines 807 and 958 (editMark...) need to have a " -r", (-r), appended to them. After you are done looking at the information in "Python Commands" that Command-double-clicked to get at, you are supposed to be able to just hit the return key to get back to editting you source. This file has to be in the read-only mode, (which the above fixes), and the return key has to be bound to a special routine. That routine and binding are in the file TextPref.tcl (in the mode distribution. The installer was supposed to put this file in the "Alpha" folder in the system's preference file. I am not sure that it got there. If it did not, just move a copy in there. 2) Guido van Rossum pointed out some problems with the way indentation is handled when you hit return. The return key is bound to the procedure "PythCarriageReturn" while you are in the Pyth mode (you can see this by by pressing F7, then the return key whil in "Pyth"). Ive re-written that routine and have attached it. Just open up the "pythonMode.tcl" file (easy if you use the "double-doc-icon"->Modes->..." menu choice), go to the procedure via the {} function button, and replace with the new procedure. I kept the number of lines in the new version so that a careful replacement should not get your line numbers out of sync with everyone else. Note: this routine tries to be smart about indention, a statement that ends in in a ":", adds a level of indentation when you hit the return. [Q]: would it be a good idea to add a couple of spaces to the indent when the new line is a continuation line? 3) An other file that may not have gotten to where it is supposed to be is "wordCombCompletion.tcl", this is supposed to be in the :Alpha:Tcl:UserCode: direcotry, (check via "double-doc-icon"->User... ). If you don't want to use the finder to get these files in the proper locations, you can just use the "Save as" options while you have the file open, and just navigate via the file dialog to wher you need the file saved at. Alpha needs to update its database that indexes all the function locations after all this, so, while you are in the Tcl mode, choose "Rebuilt Tcl Indices" from the {} menubar icon ( only vissble if you are in Tcl mode). Tom --============_-1364584251==_============ Content-Type: application/mac-binhex40; name="PYTHcrReplacement.tcl.sit" Content-Disposition: attachment; filename="PYTHcrReplacement.tcl.sit" (This file must be converted with BinHex 4.0) :'9"C9%KMFP*PF'aK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I"ULrUMZ*qbC*9RS)HHU2IP0K1N&#[HkS(QMDI1eAM#*X2`# UiJ!!: --============_-1364584251==_============-- ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From tomf59@sgi.net Tue Nov 12 02:03:54 1996 From: tomf59@sgi.net (Tom Fetherston) Date: Mon, 11 Nov 1996 21:03:54 -0500 Subject: [PYTHONMAC-SIG] Re: Python Mode is Here! Message-ID: Hi Robin, >Tried it this weekend. Thanks for doing all this neat stuff. >I must say though the coloring is a bit much. I was able to >change things though, however I couldn't find where you >specify coloring for punctuation. (I really don't think it's >needed). Can you tell me how to turn it off? > In the file PythonKeys.tcl in the Modes scubdirectory are the commands that set up what color variable name is assign to each set of keywords/punctuation. To do what you want just rmove the the last backslash continuation of the first regModeKeywords command, I.e. remove: \ -i {[} -i {]} -i {,} -i {(} -i {)} -i {:} -i {'} -i {.} -I red the above starts at line 404. Put in a blank line so the line numbers for the file remain the same in case I need to cite futere change suggestions in this file. Either quit Alpha and restart, or just reload the file (cmd-L --if you have already gone into the Pyth mode, just go into Pyth if you have'nt). Future versions should incorporate the ability to just set most of this stuff in the mode flags --kind of preferences for the mode. All the coloring is really just an offshoot of the grouping of terms into sets that are covered in the same section of the "Python Commands" document. Cmd-dbl-clicking on colored terms should get you to an explanation in that document (however, this still is not complete as some of the lookups fail due to the parsing of the clicked text). Tom ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jeff@cynapses.com Tue Nov 12 15:01:56 1996 From: jeff@cynapses.com (jeffrey P. Shell) Date: Tue, 12 Nov 1996 08:01:56 -0700 Subject: [PYTHONMAC-SIG] regarding sys.path (was: Anyone using $(APPLICATION) in sys.path preferences?) References: <9611062251.AA02948=jack@schelvis.cwi.nl> Message-ID: <32889164.5A90@cynapses.com> I didn't even know $(APPLICATION) existed in sys.path. :) but i do have some problems/questions about the Path setting in Python's Prefs: is there a way around the limit (which seems to be @ 256 chars)? i'm getting a fair amount of folders in my MacPython folder, but i often can't add some to the Path in the prefs file because it runs out of room. I've been able to add some with no problem, but after a while one gets cut off. -- .jPS || jeff@cynapses.com || http://www.cynapses.com/ry/ ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Tue Nov 12 15:46:30 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 12 Nov 1996 16:46:30 +0100 Subject: [PYTHONMAC-SIG] regarding sys.path (was: Anyone using $(APPLICATION) in sys.path preferences?) In-Reply-To: Message by "jeffrey P. Shell" , Tue, 12 Nov 1996 08:01:56 -0700 , <32889164.5A90@cynapses.com> Message-ID: <9611121546.AA03224=jack@schelvis.cwi.nl> > I didn't even know $(APPLICATION) existed in sys.path. :) but i do have > some problems/questions about the Path setting in Python's Prefs: is > there a way around the limit (which seems to be @ 256 chars)? i'm > getting a fair amount of folders in my MacPython folder, but i often > can't add some to the Path in the prefs file because it runs out of > room. I've been able to add some with no problem, but after a while one > gets cut off. Hmm, there shouldn't be a limit to the total length of sys.path... There *is* a limit to the length of a single sys.path item, which is 256 chars. This maximum pathname (now using "path" in a different sense) is prevalent throughout macintosh software, and very difficult to get around. If you send me what your sys.path looks like, and some cookbook instructions on how to make new path components disappear I'll investigate... -- 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 - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jeff@cynapses.com Tue Nov 12 16:00:58 1996 From: jeff@cynapses.com (jeffrey P. Shell) Date: Tue, 12 Nov 1996 09:00:58 -0700 Subject: [PYTHONMAC-SIG] regarding sys.path (was: Anyone using $(APPLICATION) in sys.path preferences?) References: <9611121546.AA03224=jack@schelvis.cwi.nl> Message-ID: <32889F3A.6CD8@cynapses.com> : $(PYTHON) $(PYTHON):Lib $(PYTHON):Lib:mac $(PYTHON):Lib:mac:toolbox $(PYTHON):PlugIns $(PYTHON):Lib:tkinter $(PYTHON):gendoc $(PYTHON):Mac:Lib $(PYTHON):Mac:Lib:toolbox $(PYTHON):Lib:test $(PYTHON):cgi-bin $(PYTHON):webtools after having a few entries like this in the EditPythonPrefs window, the following happens: $(PYTHON):cgi-bin:myde cutting off :mydemo. Unless this has gone away in 1.4.. i've gotten rid of a few items like the path to stdwin since it doesn't work anymore. i can append stuff to sys.path from a script or from the interpreter, but after a certain point i can't add any more inside EditPythonPrefs -- .jPS || jeff@cynapses.com || http://www.cynapses.com/ry/ ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Tue Nov 12 21:39:12 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 12 Nov 1996 22:39:12 +0100 Subject: [PYTHONMAC-SIG] regarding sys.path (was: Anyone using $(APPLICATION) in sys.path preferences?) In-Reply-To: Message by "jeffrey P. Shell" , Tue, 12 Nov 1996 09:00:58 -0700 , <32889F3A.6CD8@cynapses.com> Message-ID: <9611122139.AA06063=jack@schelvis.cwi.nl> Recently, "jeffrey P. Shell" said: > [on losing parts of sys.path set through EditPythonPrefs] > > i can append stuff to sys.path from a script or from the interpreter, > but after a certain point i can't add any more inside EditPythonPrefs Found it! It turns out that SetDialogItemText() cannot handle more than 255 chars, which is to be expected but which I forgot. The workaround, for now: if you need more than 255 chars in your sys.path initializer use ResEdit to edit "Python 1.4 Preferences" by hand, and modify the STR# resource. For the future I will implement a different EditPythonPrefs. Some time ago Just sent me a first stab at a much nicer EditPythonPrefs, and I also want to make the functionality available to python programs anyway so this is probably the moment to do the rewrite. -- 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 - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From gandreas@skypoint.com Tue Nov 12 22:41:41 1996 From: gandreas@skypoint.com (Glenn Andreas) Date: Tue, 12 Nov 1996 16:41:41 -0600 (CST) Subject: [PYTHONMAC-SIG] regarding sys.path (was: Anyone using $(APPLICATION) in sys.path preferences?) In-Reply-To: <9611122139.AA06063=jack@schelvis.cwi.nl> from "Jack Jansen" at Nov 12, 96 10:39:12 pm Message-ID: > > > Recently, "jeffrey P. Shell" said: > > [on losing parts of sys.path set through EditPythonPrefs] > > > > i can append stuff to sys.path from a script or from the interpreter, > > but after a certain point i can't add any more inside EditPythonPrefs > > Found it! It turns out that SetDialogItemText() cannot handle more > than 255 chars, which is to be expected but which I forgot. > If you do a "GetDialogItem()" call on that item, the handle that you get back is a handle to the text (of whatever size), which you can directly manipulate (though this is best done before the dialog is shown and that field selected, otherwise the TERecord can get out of sync). ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Wed Nov 13 13:22:31 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 13 Nov 1996 14:22:31 +0100 Subject: [PYTHONMAC-SIG] regarding sys.path (was: Anyone using $(APPLICATION) in sys.path preferences?) In-Reply-To: Message by gandreas@skypoint.com (Glenn Andreas) , Tue, 12 Nov 1996 16:41:41 -0600 (CST) , Message-ID: <9611131322.AA12224=jack@schelvis.cwi.nl> This is a multipart MIME message. --===_0_Wed_Nov_13_14:20:56_MET_1996 Content-Type: text/plain; charset=us-ascii > > Found it! It turns out that SetDialogItemText() cannot handle more > > than 255 chars, which is to be expected but which I forgot. > > > > If you do a "GetDialogItem()" call on that item, the handle that you get > back is a handle to the text (of whatever size), which you can directly > manipulate (though this is best done before the dialog is shown and that > field selected, otherwise the TERecord can get out of sync). Thanks! It wasn't as simple as this, but by using a few SelectDialogItemText calls I managed to convince TE about the new contents of the resource. Appended are EditPythonPrefs.py and EditPythonPrefs.rsrc.hqx with the workaround. -- 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 --===_0_Wed_Nov_13_14:20:56_MET_1996 Content-Type: text/plain; charset=us-ascii Content-Description: EditPythonPrefs.py """Edit the Python Preferences file.""" # # This program is getting more and more clunky. It should really # be rewritten in a modeless way some time soon. from Dlg import * from Events import * from Res import * import string import struct import macfs import MacOS import os import sys import Res # For Res.Error # Resource in the Python resource chain PREFNAME_NAME="PythonPreferenceFileName" # resource IDs in our own resources (dialogs, etc) MESSAGE_ID = 256 DIALOG_ID = 511 TEXT_ITEM = 1 OK_ITEM = 2 CANCEL_ITEM = 3 DIR_ITEM = 4 TITLE_ITEM = 5 OPTIONS_ITEM = 7 # The options dialog. There is a correspondence between # the dialog item numbers and the option. OPT_DIALOG_ID = 510 # 1 thru 9 are the options # The GUSI creator/type and delay-console OD_CREATOR_ITEM = 10 OD_TYPE_ITEM = 11 OD_DELAYCONSOLE_ITEM = 12 OD_OK_ITEM = 13 OD_CANCEL_ITEM = 14 # Resource IDs in the preferences file PATH_STRINGS_ID = 128 DIRECTORY_ID = 128 OPTIONS_ID = 128 GUSI_ID = 10240 # Override IDs (in the applet) OVERRIDE_PATH_STRINGS_ID = 129 OVERRIDE_DIRECTORY_ID = 129 OVERRIDE_OPTIONS_ID = 129 OVERRIDE_GUSI_ID = 10241 # Things we know about the GUSI resource. Note the code knows these too. GUSIPOS_TYPE=0 GUSIPOS_CREATOR=4 GUSIPOS_SKIP=8 GUSIPOS_FLAGS=9 GUSIPOS_VERSION=10 GUSIVERSION='0181' GUSIFLAGS_DELAY=0x20 # Mask READ = 1 WRITE = 2 smAllScripts = -3 kOnSystemDisk = 0x8000 def restolist(data): """Convert STR# resource data to a list of strings""" if not data: return [] num, = struct.unpack('h', data[:2]) data = data[2:] rv = [] for i in range(num): strlen = ord(data[0]) if strlen < 0: strlen = strlen + 256 str = data[1:strlen+1] data = data[strlen+1:] rv.append(str) return rv def listtores(list): """Convert a list of strings to STR# resource data""" rv = struct.pack('h', len(list)) for str in list: rv = rv + chr(len(str)) + str return rv def message(str = "Hello, world!", id = MESSAGE_ID): """Show a simple alert with a text message""" d = GetNewDialog(id, -1) d.SetDialogDefaultItem(1) tp, h, rect = d.GetDialogItem(2) SetDialogItemText(h, str) while 1: n = ModalDialog(None) if n == 1: break def optinteract((options, creator, type, delaycons)): """Let the user interact with the options dialog""" old_options = (options[:], creator, type, delaycons) d = GetNewDialog(OPT_DIALOG_ID, -1) tp, h, rect = d.GetDialogItem(OD_CREATOR_ITEM) SetDialogItemText(h, creator) tp, h, rect = d.GetDialogItem(OD_TYPE_ITEM) SetDialogItemText(h, type) d.SetDialogDefaultItem(OD_OK_ITEM) d.SetDialogCancelItem(OD_CANCEL_ITEM) while 1: for i in range(len(options)): tp, h, rect = d.GetDialogItem(i+1) h.as_Control().SetControlValue(options[i]) tp, h, rect = d.GetDialogItem(OD_DELAYCONSOLE_ITEM) h.as_Control().SetControlValue(delaycons) n = ModalDialog(None) if n == OD_OK_ITEM: tp, h, rect = d.GetDialogItem(OD_CREATOR_ITEM) ncreator = GetDialogItemText(h) tp, h, rect = d.GetDialogItem(OD_TYPE_ITEM) ntype = GetDialogItemText(h) if len(ncreator) == 4 and len(ntype) == 4: return options, ncreator, ntype, delaycons else: sys.stderr.write('\007') elif n == OD_CANCEL_ITEM: return old_options elif n in (OD_CREATOR_ITEM, OD_TYPE_ITEM): pass elif n == OD_DELAYCONSOLE_ITEM: delaycons = (not delaycons) elif 1 <= n <= len(options): options[n-1] = (not options[n-1]) def interact(list, pythondir, options, title): """Let the user interact with the dialog""" opythondir = pythondir try: # Try to go to the "correct" dir for GetDirectory os.chdir(pythondir.as_pathname()) except os.error: pass d = GetNewDialog(DIALOG_ID, -1) tp, h, rect = d.GetDialogItem(TITLE_ITEM) SetDialogItemText(h, title) tp, h, rect = d.GetDialogItem(TEXT_ITEM) ## SetDialogItemText(h, string.joinfields(list, '\r')) h.data = string.joinfields(list, '\r') d.SelectDialogItemText(TEXT_ITEM, 0, 32767) d.SelectDialogItemText(TEXT_ITEM, 0, 0) ## d.SetDialogDefaultItem(OK_ITEM) d.SetDialogCancelItem(CANCEL_ITEM) d.GetDialogWindow().ShowWindow() d.DrawDialog() while 1: n = ModalDialog(None) if n == OK_ITEM: break if n == CANCEL_ITEM: return None ## if n == REVERT_ITEM: ## return [], pythondir if n == DIR_ITEM: fss, ok = macfs.GetDirectory('Select python home folder:') if ok: pythondir = fss if n == OPTIONS_ITEM: options = optinteract(options) tmp = string.splitfields(h.data, '\r') rv = [] for i in tmp: if i: rv.append(i) return rv, pythondir, options def getprefpath(id): # Load the path and directory resources try: sr = GetResource('STR#', id) except (MacOS.Error, Res.Error): return None, None d = sr.data l = restolist(d) return l, sr def getprefdir(id): try: dr = GetResource('alis', id) fss, fss_changed = macfs.RawAlias(dr.data).Resolve() except (MacOS.Error, Res.Error): return None, None, 1 return fss, dr, fss_changed def getoptions(id): try: opr = GetResource('Popt', id) except (MacOS.Error, Res.Error): return [0]*9, None options = map(lambda x: ord(x), opr.data) while len(options) < 9: options = options + [0] return options, opr def getgusioptions(id): try: opr = GetResource('GU\267I', id) except (MacOS.Error, Res.Error): return '????', '????', 0, None data = opr.data type = data[GUSIPOS_TYPE:GUSIPOS_TYPE+4] creator = data[GUSIPOS_CREATOR:GUSIPOS_CREATOR+4] flags = ord(data[GUSIPOS_FLAGS]) version = data[GUSIPOS_VERSION:GUSIPOS_VERSION+4] if version <> GUSIVERSION: message('GU\267I resource version "%s", fixing to "%s"'%(version, GUSIVERSION)) flags = 0 delay = (not not (flags & GUSIFLAGS_DELAY)) return creator, type, delay, opr def setgusioptions(opr, creator, type, delay): data = opr.data flags = ord(data[GUSIPOS_FLAGS]) version = data[GUSIPOS_VERSION:GUSIPOS_VERSION+4] if version <> GUSIVERSION: flags = 0x88 version = GUSIVERSION if delay: flags = flags | GUSIFLAGS_DELAY else: flags = flags & ~GUSIFLAGS_DELAY data = type + creator + data[GUSIPOS_SKIP] + chr(flags) + GUSIVERSION + data[GUSIPOS_VERSION+4:] return data def openpreffile(rw): # Find the preferences folder and our prefs file, create if needed. vrefnum, dirid = macfs.FindFolder(kOnSystemDisk, 'pref', 0) try: pnhandle = GetNamedResource('STR ', PREFNAME_NAME) except Res.Error: message("No %s resource (old Python?)"%PREFNAME_NAME) sys.exit(1) prefname = pnhandle.data[1:] preff_fss = macfs.FSSpec((vrefnum, dirid, prefname)) try: preff_handle = FSpOpenResFile(preff_fss, rw) except Res.Error: # Create it message('No preferences file, creating one...') FSpCreateResFile(preff_fss, 'Pyth', 'pref', smAllScripts) preff_handle = FSpOpenResFile(preff_fss, rw) return preff_handle def openapplet(name): fss = macfs.FSSpec(name) try: app_handle = FSpOpenResFile(fss, WRITE) except Res.Error: message('File does not have a resource fork.') sys.exit(0) return app_handle def edit_preferences(): preff_handle = openpreffile(WRITE) l, sr = getprefpath(PATH_STRINGS_ID) if l == None: message('Cannot find any sys.path resource! (Old python?)') sys.exit(0) fss, dr, fss_changed = getprefdir(DIRECTORY_ID) if fss == None: fss = macfs.FSSpec(os.getcwd()) fss_changed = 1 options, opr = getoptions(OPTIONS_ID) saved_options = options[:] creator, type, delaycons, gusi_opr = getgusioptions(GUSI_ID) saved_gusi_options = creator, type, delaycons # Let the user play away result = interact(l, fss, (options, creator, type, delaycons), 'System-wide preferences') # See what we have to update, and how if result == None: sys.exit(0) pathlist, nfss, (options, creator, type, delaycons) = result if nfss != fss: fss_changed = 1 if fss_changed: alias = nfss.NewAlias() if dr: dr.data = alias.data dr.ChangedResource() else: dr = Resource(alias.data) dr.AddResource('alis', DIRECTORY_ID, '') if pathlist != l: if pathlist == []: if sr.HomeResFile() == preff_handle: sr.RemoveResource() elif sr.HomeResFile() == preff_handle: sr.data = listtores(pathlist) sr.ChangedResource() else: sr = Resource(listtores(pathlist)) sr.AddResource('STR#', PATH_STRINGS_ID, '') if options != saved_options: newdata = reduce(lambda x, y: x+chr(y), options, '') if opr and opr.HomeResFile() == preff_handle: opr.data = newdata opr.ChangedResource() else: opr = Resource(newdata) opr.AddResource('Popt', OPTIONS_ID, '') if (creator, type, delaycons) != saved_gusi_options: newdata = setgusioptions(gusi_opr, creator, type, delaycons) if gusi_opr.HomeResFile() == preff_handle: gusi_opr.data = newdata gusi_opr.ChangedResource() else: ngusi_opr = Resource(newdata) ngusi_opr.AddResource('GU\267I', GUSI_ID, '') CloseResFile(preff_handle) def edit_applet(name): pref_handle = openpreffile(READ) app_handle = openapplet(name) notfound = '' l, sr = getprefpath(OVERRIDE_PATH_STRINGS_ID) if l == None: notfound = 'path' l, dummy = getprefpath(PATH_STRINGS_ID) if l == None: message('Cannot find any sys.path resource! (Old python?)') sys.exit(0) fss, dr, fss_changed = getprefdir(OVERRIDE_DIRECTORY_ID) if fss == None: if notfound: notfound = notfound + ', directory' else: notfound = 'directory' fss, dummy, dummy2 = getprefdir(DIRECTORY_ID) if fss == None: fss = macfs.FSSpec(os.getcwd()) fss_changed = 1 options, opr = getoptions(OVERRIDE_OPTIONS_ID) if not opr: if notfound: notfound = notfound + ', options' else: notfound = 'options' options, dummy = getoptions(OPTIONS_ID) saved_options = options[:] creator, type, delaycons, gusi_opr = getgusioptions(OVERRIDE_GUSI_ID) if not gusi_opr: if notfound: notfound = notfound + ', GUSI options' else: notfound = 'GUSI options' creator, type, delaycons, gusi_opr = getgusioptions(GUSI_ID) saved_gusi_options = creator, type, delaycons dummy = dummy2 = None # Discard them. if notfound: message('Warning: initial %s taken from system-wide defaults'%notfound) # Let the user play away print 'DBG interaction' result = interact(l, fss, (options, creator, type, delaycons), name) # See what we have to update, and how if result == None: sys.exit(0) pathlist, nfss, (options, creator, type, delaycons) = result if nfss != fss: fss_changed = 1 if fss_changed: alias = nfss.NewAlias() if dr: dr.data = alias.data dr.ChangedResource() else: dr = Resource(alias.data) dr.AddResource('alis', OVERRIDE_DIRECTORY_ID, '') if pathlist != l: if pathlist == []: if sr.HomeResFile() == app_handle: sr.RemoveResource() elif sr and sr.HomeResFile() == app_handle: sr.data = listtores(pathlist) sr.ChangedResource() else: sr = Resource(listtores(pathlist)) sr.AddResource('STR#', OVERRIDE_PATH_STRINGS_ID, '') if options != saved_options: newdata = reduce(lambda x, y: x+chr(y), options, '') if opr and opr.HomeResFile() == app_handle: opr.data = newdata opr.ChangedResource() else: opr = Resource(newdata) opr.AddResource('Popt', OVERRIDE_OPTIONS_ID, '') if (creator, type, delaycons) != saved_gusi_options: newdata = setgusioptions(gusi_opr, creator, type, delaycons) id, type, name = gusi_opr.GetResInfo() if gusi_opr.HomeResFile() == app_handle and id == OVERRIDE_GUSI_ID: gusi_opr.data = newdata gusi_opr.ChangedResource() else: ngusi_opr = Resource(newdata) ngusi_opr.AddResource('GU\267I', OVERRIDE_GUSI_ID, '') CloseResFile(app_handle) def main(): try: h = OpenResFile('EditPythonPrefs.rsrc') except Res.Error: pass # Assume we already have acces to our own resource if len(sys.argv) <= 1: edit_preferences() else: for appl in sys.argv[1:]: edit_applet(appl) if __name__ == '__main__': main() --===_0_Wed_Nov_13_14:20:56_MET_1996 Content-Type: text/plain; charset=us-ascii Content-Description: EditPythonPrefs.rsrc.hqx (This file must be converted with BinHex 4.0) :&%9NDA43HA4SEfj3FQ9QFbjbFh*M!(*cFQ058d9%!3#3"`m+@DJ!N!3"!!!!$FN !!!c*!!!"36B8)&3JD!!8)&"p%E"S%3!k!@FQ%Lm-6VS#$!`k!&Tj&%9NDA43HA4 SEfj3FQ9QFbjbFh*MC3)!!!"bFh*M8P-!!(*cFQ058d9%!3!!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Z!# J!-J!ka!!N!E-!+!!h!$V%!#3"3%)!!S"'J%,"5&%C@aKH5"MEfjcEfaP)(GTEQ4 [Gb"eER4TE#"ZC@9NC@3!N!8"(`$9!6-"$`3#6dX!N!3"(`!+!6-!4`3'3f&ZBf9 X!*!&"J!Q!"F!lSJD8(PdD'pZ)'PZG'9bF(*PG'9b)'p`G'P[ER-!N!@-!!S!R!% ,L"T,C@9`)(0dC'P[)(GTEQ4[Gb"[F'9Z)'pZ1J#3"EJ!#J$*!*H)&84PCQ&eE(3 JCQPXC5"MFQ9KG'pb1Q8!N!A-!!S!h3#AL"*%C@CKG@ad)'CTE'8JG(P`C6S!!!% !!!!0b3!!$-N!!!&"!l,8G#8B!!!!(!%b!!Y#6N4-!!!!BNP$6L-!!!"Z8dPD43! !!(T'8N9'!!%!KQPMFb-!!!#HD@0X1!!!!+TTBh-i!!!!YQPMFc3!!!$#D@0X0!! !!-j%6%p(!!%!fN4*9%`!!3$b8(Pd-!!!!3S!J2rr!!!*'J#3"!%Xrrm!N!MrN!3 !!!%%!*!&J2rr!!!"%J#3"B(rr`!!#3m!N!3",2rr!!!"(3#3"!%Xrrm!!!&K!*! %!5crr`!!"@8!N!3",2rr!!!'D3#3"!%Xrrm!!!EY!*!%!Irrr`!!#2%$XY0-!Il rr`!!#P!$XY*!!Irrr`!!#8)!N!3"r[rr!!!+D3#3#JN+!*!%$NphEQ9b)(*PFfp eFQ0P6JF: --===_0_Wed_Nov_13_14:20:56_MET_1996-- ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From bko@netcom.com Thu Nov 14 18:40:25 1996 From: bko@netcom.com (Ben Ko) Date: Thu, 14 Nov 1996 14:40:25 -0400 Subject: [PYTHONMAC-SIG] Looking for TIFF parsing routines Message-ID: Can anyone recommend a python lib to parse TIFF files? I'm looking to create a droplet-type runtime on the Mac that i can drop TIFFs (or EPSes) on, which will then generate reports of - image width and height - image color mode - image resolution which i will then write to a text file creating special typesetting codes. I wrote a Perl script to do this for EPSes but am not savvy enough to handle TIFFs (based on what i've read and seen/heard of TIFF file format so far). The lib would have to handle various TIFF formats (from TIFFs produced by Photoshop to UNIX OPI systems). TIA for any recommendations or pointers. NOTE: I've never used Python; only (to a limited degree) Perl. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@elvis.med.virginia.edu Sat Nov 16 17:39:01 1996 From: sdm7g@elvis.med.virginia.edu (Majewski) Date: 16 Nov 96 12:39:01 -0500 Subject: [PYTHONMAC-SIG] Default BNDL's for mkapplet Message-ID: I raised the question to Jack of whether the default BNDLs in the template for mkapplet should be 'TEXT' ( as they are now ) or ['****','fold','disk'] so that any file type and/or folders can be dropped on an applet. He said to see what the list thinks. Personally, it doesn't make a difference to me -- I can change the defaults on my own copy easily enough -- but it does make a difference in posting examples and tutorials if there is the added complication that someone has to run ResEdit to get the examples to work. The other argument is that, even if you only want to handle TEXT files, if you want to handle and expand *Folders* of TEXT files, then you still need to add some sort of folder expansion and file type filtering, so I don't think this is adding any more complexity for typical usage. Along with that change, I'ld like to see standard higher level functions to handle the filtering and expansion. I don't think the example I posted is quite "IT" yet, in particular, I don't like that it takes several seconds for a large expansion before ANYTHING starts to happen - but it's a start in the right direction. ( I'ld also like to have an easy hook into the progress bar in Easy Dialogs. ) [ The example code and previous discussion didn't make it onto the PYTHONMAC-SIG mailing list,as I had too much MIME CyberCrud attached for the mailing list software to handle. Sorry -- I've been having fun with CyberDog lately, and I got carried away ( plus, I haven't figured out exactly how it chooses how to encode various attachments, so I can't predict how it will come out on the other end. ) The previous message DID go out on comp.lang.python, so you can read it there, or ask me to forward a un-MIME-ed version. ] - Steve Majewski --------------------------------------------------------- Cyberdog ---A Product of Apple Computer, Inc. --------------------------------------------------------- ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@elvis.med.virginia.edu Sat Nov 16 17:56:36 1996 From: sdm7g@elvis.med.virginia.edu (Majewski) Date: 16 Nov 96 12:56:36 -0500 Subject: [PYTHONMAC-SIG] Window Cleanup in FrameWork Message-ID: I've been trying out some of the Mac/Demos and the FrameWork code. Both versions of PICTbrowse crash on occasion, leaving 'dead' windows on the screen. I don't care much about the problem with the Demo, but the strange state the interpreter was left in after the crash appeared to be due to a FrameWork bug, so I was trying to track that down. I could not find any live references to the windows -- I even typed a couple of syntax errors to make sure they weren't being help by the sys traceback objects. I then suspected that the problem was lower, but the Win interface seems to work properly. At first I couldn't find an explicit DisposeWindow or CloseWindow, but when I del a window object, those methods appeare to be properly called to clean up. Anyone have any ideas what holding onto the windows reference and preventing it's deletion ? Steve Majewski ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From juha.savola@vtt.fi Mon Nov 18 09:17:32 1996 From: juha.savola@vtt.fi (Juha Savola) Date: Mon, 18 Nov 1996 12:17:32 +0300 Subject: [PYTHONMAC-SIG] Mailing list Message-ID: I want to join the Python Mac mailing list. __________________________________________________________________ Juha Savola VTT INFORMATION TECHNOLOGY P.O. Box 1201 FIN-02044 VTT Finland Tel. +358 9 456 6038, Telefax +358 9 456 6027 Internet: juha.savola@vtt.fi ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Nov 18 12:12:46 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 18 Nov 1996 13:12:46 +0100 Subject: [PYTHONMAC-SIG] Missent... Message-ID: <9611181212.AA02539=jack@schelvis.cwi.nl> This was missent to the owner-pythonmac-sig address... ------- Forwarded Message Date: Fri, 15 Nov 1996 16:41:53 -0500 To: owner-pythonmac-sig@python.org From: tomf59@sgi.net (Tom Fetherston) Subject: Python and Super/Hyper Card Hi all, I still am spending more time writting Tcl code for the Python mode than I am writting Python, but I am getting a better hang of what is going on in the language. (new version soon, I hope). Anyway, I have a couple of ideas that I thought I would float for comment. Both HyperCard and SuperCard support the use of code resources know as xcmd's and xfnc/s. There are a lot of these out there that do stuff that would be useful in a mac-python app. Has anybody wriiten anything to take advantage of them? I think that this should be doable in straight mac python from what I've seen of it. The other idea is a bit more complicated. It seems to me that it should be possible to make an xcmd out of python itself. such an xcmd would allow you to make an embeded application in HyperCard or SuperCard (or any application that can use xcmds) just by importing the python xcmd "resource". I can't do this as I lack the knowledge (and the CodeWarrior compiler), however, I would like to do this someday unless someone else beats me to it (which would be welcomed). The marriage of Python and SuperCard would be a particularly powerful one, much like tkinker, only with a better Mac look and feel. Tom Fetherston ------- End of Forwarded Message ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Nov 18 13:20:11 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 18 Nov 1996 14:20:11 +0100 Subject: [PYTHONMAC-SIG] Re: Python and Super/hypercard In-Reply-To: Message by Jack Jansen , Mon, 18 Nov 1996 13:12:46 +0100 , <9611181212.AA02539=jack@schelvis.cwi.nl> Message-ID: <9611181320.AA03536=jack@schelvis.cwi.nl> > Both HyperCard and SuperCard support the use of code resources know as > xcmd's and xfnc/s. There are a lot of these out there that do stuff that > would be useful in a mac-python app. Has anybody wriiten anything to take > advantage of them? > > I think that this should be doable in straight mac python from what I've > seen of it. This would be very nice. It has been on my wishlist for a number of years already, but I've never had a real application for it so it didn't get done yet. If someone is willing to look into it it would be nice to have. > The other idea is a bit more complicated. It seems to me that it should be > possible to make an xcmd out of python itself. such an xcmd would allow you > to make an embeded application in HyperCard or SuperCard (or any > application that can use xcmds) just by importing the python xcmd > "resource". This is impossible. Or, let me state that differently: I wouldn't know how to do this. Python needs lots of code and dataspace, and code resources are too cramped. -- 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 - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Steven D. Majewski" Message-ID: As Jack noted, Python has too much state to fit into an XCMD, but there might be some other ways to integrate Python and Hypercard. The current HyperCard has some integration with AppleScript, doesn't it ? I assume that this is via OSA. It might be possible to make Python an alternate scriping engine for HyperCard. You could also give Mac Python the ability to import XCMDs and XFCNs, but I'm not sure where that would get you. ( However, as I've lately been writing NIH-Image plugin's and NIST-DTSA plugin's and extension modules for XlispStat, and now starting on extension modules for Mac Python, I'ld love to see a unified way of doing this sort of thing! Now that MW and others are supporting Direct-to-SOM, I'm going to try to learn enough SOM to see if that is a good direction to go. If you are interested in learning more, THE book ( besides Inside Mac ) to learn about XFCNs, Plugin's, etc. ( except for SOM which is not covered ) is "A Fragment of your Imagination" by Joe Zobkiw. As is typical with Mac programming books these days, there is a CD-ROM of Code Warrior Lite with the book, and the CodeWarrior Gold CDs have the book and examples on the reference CD. ) Better integration with SOM & OSA is something I've been interested in for a while, but I've only just now gotten to a project where I can actually justify spending some time getting up to speed on this stuff, but I'm still trying to catch up with all the stuff Jack has already added to MacPython. ( To paraphrase Don Beaudry: "So much documentation, so little time!" ;-) ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Mon Nov 18 18:35:07 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Mon, 18 Nov 1996 13:35:07 -0500 (EST) Subject: [PYTHONMAC-SIG] EasyDialogs.ProgressBar() crashes and fix Message-ID: Using EsayDialogs.ProgressBar() works as long as it's update calls are in a loop that doesn't allow any other interaction, however, it's pretty unsafe in interactive mode. If I type, interactively: p = EasyDialogs.ProgressBar() and then type: p.set( 10 ) or click on the dialog window, Python crashes with a bus error. I tried adding the line: self.d.BringToFront() to the top of the _update method, and this seems to fix the problem. [ I'm not enough of a Mac wizzard to know if this is THE fix, but it seems to be *A* fix. ] BTW: Are most Mac Python folk out there using Tk or the native toolbox or something else ? ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Mon Nov 18 20:07:46 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: 18 Nov 96 20:07:46 +0000 Subject: [PYTHONMAC-SIG] EasyDialogs.ProgressBar Message-ID: One other minor bug to EasyDialogs.ProgressBar : Method 'set' doesn't update self.curval, so it's always = -1. I noticed this when I tried to add an 'inc' method so I wouldn't have to track the numbers myself. ( Those changes and the previous fix are included below) Re: previous note about adding 'BringToFront' : I assume that problem is due to using what is supposed to be a Modal Dialog in a basically un-Modal way from Python. ( Thus my comment that this seemed to be "A solution" but perhaps not "THE solution" ) After stumbling over that one, I'm actually surprised that it isn't a more frequent problem ( or *IS* it? ) - Steve Majewski class ProgressBar: def __init__(self, label="Working...", maxval=100): self.label = label self.maxval = maxval self.curval = -1 self.d = GetNewDialog(259, -1) tp, text_h, rect = self.d.GetDialogItem(2) SetDialogItemText(text_h, label) self._update(0) def _update(self, value): self.d.BringToFront() # sdm7g -- this seems to cure Modal bus-error crash tp, h, bar_rect = self.d.GetDialogItem(3) Qd.SetPort(self.d) Qd.FrameRect(bar_rect) # Draw outline inner_rect = Qd.InsetRect(bar_rect, 1, 1) l, t, r, b = inner_rect Qd.ForeColor(QuickDraw.blackColor) Qd.BackColor(QuickDraw.blackColor) Qd.PaintRect((l, t, int(l + (r-l)*value/self.maxval), b)) # Draw bar Qd.ForeColor(QuickDraw.whiteColor) Qd.BackColor(QuickDraw.whiteColor) Qd.PaintRect((int(l + (r-l)*value/self.maxval), t, r, b)) # Clear rest # Restore settings Qd.ForeColor(QuickDraw.blackColor) Qd.BackColor(QuickDraw.whiteColor) # Test for cancel button if ModalDialog(_ProgressBar_filterfunc) == 1: raise KeyboardInterrupt def set(self, value): if value < 0: value = 0 if value > self.maxval: value = self.maxval self.curval = value # sdm7g -- didn't update curval self._update(value) def inc( self, *n ): # sdm7g if not n: n = 1 else: n = n[0] self.set( self.curval + n ) ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Wed Nov 20 21:06:31 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Wed, 20 Nov 1996 16:06:31 -0500 (EST) Subject: [PYTHONMAC-SIG] Window Cleanup in FrameWork In-Reply-To: <9611201413.AA24993=jack@schelvis.cwi.nl> Message-ID: [ Jack -- I'm cc-ing this to the list. Does anyone else have trouble demonstrating this bug ? If I'm not the only one seeing it, I'm going to have to start removing extensions or look for other reasons my machine may be different. ] On Wed, 20 Nov 1996, Jack Jansen wrote: > > Steve, > I can't reproduce this (and, hence, I can't investigate whether there's a bug > in framework somewhere). Could you please give me a more detailed description > of how you made pictbrowse (or pictbrowse2) crash? It didn't always happen in the same place, so it took a little probing before I could figure out how to reproduce it. This last bunch of tests was with PICTbrowse, but I've gotten similar problems before with PICTbrowse2. [1] You have to select and view an item more than once -- double click and close the resulting window for several id's in the list view, then go back to the beginning and try the same ones again. [2] Sometimes, the second time I select an item, it pops up with a very small empty window -- definitely not the window I saw the first time thru. [3] Sometimes it will crash with a exception from struct, trying to unpack the resource. [4] I don't always get a crash or an empty window on the first retry, but then again, I've never had to go thru the entire list twice trying for a crash. In this latest test, I went thru the same half dozen items not more than 2 or 3 times to get a crash. ( Could it be some resource or pointer that is supposed to be locked and sometimes gets moved around ? ) [5] After it crashes, I can't quit Python from the Menu ( Or else something else strange happens to cause a complete machine crash. ) I *DO* have the listener window to the interpreter, and I can call sys.exit: displays on the window, but the List window from PICTbrowse is still on screen, and I can't get the program to quit and cleanup. ( I have my options set to keep the main python window alive after termination -- which I typically want so I can read output in that window before a program dies and disappears. But I assume changing that option is only covering up the problem. ) I can ALWAYS generate the window-won't-die problem independently of that bug: run python import os os.chdir to the PICTbrowse directory ( ':Mac:Demo:PICTbrowse' ) import PICTbrowse now do QUIT from the menu before doing anything that might crash the script. The List window doesn't go away. I can't find anything in any namespace that looks like it might be holding the window / dialog or other object. Everything in the PICTbrowse name space is either a Class, a function, another module, or an integer -- there are no window or dialog or other objects live and visible. I have also generated a couple of errors with statements like "1 + ''", just to make sure that there is nothing being kept live in the exception variables ( sys.last_traceback, etc. ) The is no window or dialog variable to 'del', so I can't try that explicitly. I can call PICTbrowse.main() and get a new list window to pop up on top of the old one, if I move the new one to uncover the old one, the old window, of course, does not get updated. ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jdunning@mfactory.com Thu Nov 21 00:44:58 1996 From: jdunning@mfactory.com (John Dunning) Date: Wed, 20 Nov 1996 16:44:58 -0800 Subject: [PYTHONMAC-SIG] Re: Python and Super/hypercard In-Reply-To: <9611181320.AA03536=jack@schelvis.cwi.nl> References: Message by Jack Jansen , Mon, 18 Nov 1996 13:12:46 +0100 , <9611181212.AA02539=jack@schelvis.cwi.nl> Message-ID: At 5:20 AM -0800 on 11/18/96, Jack Jansen wrote: > > The other idea is a bit more complicated. It seems to me that it should be > > possible to make an xcmd out of python itself. such an xcmd would allow you > > to make an embeded application in HyperCard or SuperCard (or any > > application that can use xcmds) just by importing the python xcmd > > "resource". > > This is impossible. Or, let me state that differently: I wouldn't know >how to > do this. Python needs lots of code and dataspace, and code resources are too > cramped. Why are code resources too cramped? Are code fragments or shared libraries better? I'm interested in putting the Python interpreter into a shared library that will then be loaded as a component into another application. Is this possible? Has anyone had experience embedding Python into a Mac app? I've read the chapter in Internet Programming with Python about embedding Python into the Netscape server, but I would expect there to be many Mac-specific pitfalls. John ______________________________________________________________________________ John Dunning Interface Designer jdunning@mfactory.com ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Thu Nov 21 01:56:40 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Wed, 20 Nov 1996 20:56:40 -0500 (EST) Subject: [PYTHONMAC-SIG] Re: Python and Super/hypercard In-Reply-To: Message-ID: On Wed, 20 Nov 1996, John Dunning wrote: > Why are code resources too cramped? Are code fragments or shared libraries > better? Yes. Code resources ( well -- on 68K almost all code is in a code-resource, but typically, when you're talking about code resources, you mean independent little pieces of code that may be system-y things like window or control definitions, or may be application type things like plug-in's ( like NIH-Image or Photoshop uses ), but which both have quite a few restrictions about what you can and cannot do ( or some special tricks like creating A5 worlds, etc. to get things to work. ) The code fragment manager gets rid of some of these problems. You can do shared libraries with CFM. ASLM - Apple Shared Library Manager is still kicking around and is still used by some software, but it's been declared obsolete technology -- the official word from Apple is use CFM or SOM if you want it to work sometime in the future. There is a "Shared Library Statement of Directions" or some such title document on Apple's developer web site. IBM's System Object Model has been ported to the Mac and is built on top of CFM. DLLs and shared libraries work fine for procedural code, but they started to fall apart when C++ and objects were added. There was no standard way to store objects -- even among different C++ compilers, let alone cross language. Thus came COM, SOM and ILU -- trying to solve that problems in somewhat different ways. ( All the distributed object stuff came later, but they all started off trying to be dynamic, cross-language object libraries. COM is a bit more limited, being mostly a standardization of C++ object layout, and without inheritence -- typically, you have to write some wrapper code to integrate COM objects fully into another languages object hierarchy. Not too disimilar to how you have to write a wrapper around Python's built-in list types so you can then write an extended list class -- you can't directly inherit the list implementation.) > I'm interested in putting the Python interpreter into a shared library that > will then be loaded as a component into another application. Is this > possible? Has anyone had experience embedding Python into a Mac app? I've > read the chapter in Internet Programming with Python about embedding Python > into the Netscape server, but I would expect there to be many Mac-specific > pitfalls. > The core of Python is already in a shared library ( at least on the PPC Macs and the 69K machines with CFM68K support. ) Did you copy a Python-CORE extension file into your system extension folder when you installed it ? That's the shared library. Many of the toolbox modules, and a few others are also shared libraries. ( "What exactly is where" is largely what I meant when I said I needed to catch up with what Jack has done to MacPython in the last couple of releases! The other bit is what you ask -- how exactly to embed it and what missing pieces you need to supply, etc. ) If you do the embedding in the normal, portable way, I don't think you will run into much Mac-specific pitfalls. ( I may be wrong -- I haven't tried it yet, and 'not much' includes the typical Mac-isms that we all complain about! ;-) Re: my references to OSA support: There is also some support of AppleEvents in Python, so you can write Python code that scripts other OSA scriptable applications, or send MacPython AppleEvents from another app. Full OSA support basically means turning Python into a Scripting Component -- which DEFINITELY includes dealing with a whole n'other layer of Mac-isms -- but which possibly gets you most of the way to where you first said you wanted to be: to make Python an alternate scripting language for Hypercard. [ This is also documentation I'm still digesting in between more urgent projects, so I could have some fatal misconceptions somewhere here. ] This would be embedding it "the Mac Way". Adding SOM support to Python could go in two directions: [1] Python objects CAN be in DLL's because Python is written in C, not C++, and it provides its own runtime protocol for registering objects and their method tables -- you don't even need a very sophisticated DLL ( at least for the MODULE end ), because you only need a single entry point to the module/object initialization routine. You could give Python the ability to import directly from SOM libraries -- basically write one module that translates from SOMs object protocol to Python's protocol, so you can import any SOM library without having to make a separate wrapper. With C++ compilers on the Mac now supporting Direct-to-SOM, this could be a big plus on the Mac. ( Same caveat applies here -- if I absolutely knew what I was talking about, I would have DONE it by now! ) [2] You could also wrap Python and it's object system up into SOM. I haven't the *SLIGHTEST* idea how to do this one, or exactly what it gets you that you don't already get by embedding Python the usual way and using the new Abstract Object Interface from C code. I just have a inherent desire for symmetry. ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Fri Nov 22 02:18:38 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Thu, 21 Nov 1996 21:18:38 -0500 (EST) Subject: [PYTHONMAC-SIG] time.sleep() not multifinder friendly ? Message-ID: I haven't deciphered the sources yet, but from it's behavior, I suspect that time.sleep() in MacPython is not very multi-finder friendly. I added some sleep calls in a loop in a program I was testing so that I could slow it down enough to see what was happening, and I was unable to switch to another app while this was running. A sleep() that gave back some cycles by calling DoIdle() would be much more usable. BTW: I made another change do EasyDialogs: ProgressBar.label( text ) is now a method, instead of a variable. bar._label is the instance variable that holds the text. A call to label() changes the text in the dialog window. EasyDialogs.test() was also modified to demonstrate this behaviour by cycling thru a list of progress messages while incrementing the progress bar. [ I'm using this in my new drag&drop file util to display the file names as they are processed. ] I'll wait a bit before posting yet another version to wait and see if I find the need for any other fixes or additions. ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Fri Nov 22 02:30:43 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Thu, 21 Nov 1996 21:30:43 -0500 (EST) Subject: [PYTHONMAC-SIG] time.sleep() not multifinder friendly ? In-Reply-To: Message-ID: ... On the other hand, when I just do: for n in range( 300 ): print time.ctime(time.time()) time.sleep(0.2) I don't seem to have any problem switching to another app. So I'm not sure what's going on. ( Back to the test bench... ) ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Fri Nov 22 02:42:04 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Thu, 21 Nov 1996 21:42:04 -0500 (EST) Subject: [PYTHONMAC-SIG] time.sleep() not multifinder friendly ? In-Reply-To: Message-ID: Sorry to pester the list with ANOTHER message ( a sure sign that I should have stopped hacking and gone home an hour ago! ) but my other messages get anyone hunting for the problem... Nevermind! The problem appears to be the BringToFront that I had to add to ProgressBar to fix another problem. [not sleep!] It doesn't want to switch while the dialog is frontmost. If the sleep call is long enough to switch to the Python Listener window first, then I can switch to another app. Sorry. I'll go home now before I call another snark hunt! ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Sat Nov 23 07:16:44 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Sat, 23 Nov 1996 02:16:44 -0500 (EST) Subject: [PYTHONMAC-SIG] MacPython 1.4, Tk4.2 and ColorPickerLib Message-ID: FYI: Python 1.4 will build on the Mac ( at least PPC Mac ) with Tk4.2 if you add ColorPickerLib to the project. The new Tk for Mac adds a couple of new routines, some of which call the native Standard File Dialogs, and one of which 'tk_chooseColor', uses the ColorPickerLib. It's a shared library using a 'weak link" in the Tk CW project, so it does not get included in the the TK libraries. Even though there is no Python Tkinter binding to these calls, and they are not used, you will get a link error if you try to link without adding ColorPickerLib. ---| 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 |--- By doing just a little every day, you can gradually let the task completely overwhelm you. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org =================