No subject

billpy@mousa.demon.co.uk billpy@mousa.demon.co.uk
Mon, 16 Sep 1996 13:14:49 -0400 (EDT)


Reply - To:  
Date: Mon, 16 Sep 1996 00:27:33 +0000
To: pythonmac-sig@python.org
From: Bill Bedford <billpy@mail.demon.net>
Subject: Re:[PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension

--============_-1369288835==_============
Content-Type: text/plain; charset="us-ascii"

At 4:49 pm +0000 on 15/09/96, Joseph Strout wrote:


~In my never-ending quest for a Mac programming language for kids that
~doesn't suck, I've recently been looking at Chipmunk Basic.  It comes with
~a very cool feature: a BBEdit plug-in that adds a "Run as Chipmunk Basic"
~command to the Extensions menu.  You edit your source in BBEdit (Lite),
~pick this off the menu, and poof! the Mac switches to Chipmunk Basic,
~loads your code, and executes it.
~
~In Python, the most efficient paradigm I've come up with is to edit my
~code, save it, then switch to the Finder and drag the file onto the Python
~app.  Then when it's done I have to be sure to quit (Python).  This is not
~terrible, but the BBEdit extension is nicer.

I have 3 Fkey programed with KeyQuencer
F13 is 'import <module name>'
F14 is 'reload(<module name>)'
F15 is '<module name>.Main()'

I write in alpha, switch to Python using the controlstrip and press F14 F15.

OK each time I start work on a new module I have to change the Keyquencer
scripts, but that is no big deal.

I've attatched a simple  alpha python mode file - no doubt someone can
improve it.

--============_-1369288835==_============
Content-Type: text/plain; name="pythonMode.tcl"; charset="us-ascii"
Content-Disposition: attachment; filename="pythonMode.tcl"

#############################################################################
# Python.tcl
#  John Sarapata
#  sarapata_john@jpmorgan.com
#
# Installing:
#	Put AppleScript.tcl in your Usercode folder
#   Put the following line in userstartup.tcl:
#     source $HOME:Tcl:Usercode:AppleScript.tcl
#
# Description:
#	This file implements an AppleScript mode, for people who wish Script
#	Editor had complex functions like search and replace. Currently, it
#	only supports color editing and function finding, but I may extend it.
#
#	I have not found a way to distinguish function definitions from
#	on error constructs, so I assume that any "on name" statements at
#	the beginning of the line are definitions. Script Editor saves files
#	in this format, so you will only need to be careful when creating
#	functions in Alpha.
#############################################################################
	if {$startingUp} {
		addMode Python dummyPython {*.py *.pyc} PythonMenu
		addMenu PythonMenu
		return
	}

#===============================================================================
#	Set up the mode variables
newModeVar	Python 	elecRBrace			{0}	1
newModeVar	Python 	electricSemi		{0}	1
newModeVar	Python	elecLBrace			{0} 1
newModeVar	Python	electricTab			{0} 1
newModeVar	Python	wordWrap			{0} 1
newModeVar	Python	autoMark			{def}	0
newModeVar	Python	prefixString		{#} 0
newModeVar	Python	leftFillColumn 		{3} 0
newModeVar	Python	funcExpr			{^(def)
+([a-zA-Z0-9_]+\(\):)} 0
newModeVar	Python	wordBreak 			{[a-zA-Z0-9_]+} 0
newModeVar	Python	wordBreakPreface 	{[^a-zA-Z0-9_]} 0
newModeVar	Python	stringColor	green	0
newModeVar	Python	commentColor	red	0
newModeVar	Python	keywordColor	blue	0

proc dummyPython {} {}

#===============================================================================
#	Set up comments and keywords
set PythonKeyWords {
	and elif from lambda return break else global not try class
	except if or while continue exec import pass def finally in
	print del for is raise
}
if {[info exists Pythonwords]} {set PythonKeyWords [concat $PythonKeyWords
$Pythonwords]}
regModeKeywords -e {#} -c $PythonmodeVars(commentColor) -k
$PythonmodeVars(keywordColor) Python $PythonKeyWords -s
$PythonmodeVars(stringColor)
unset PythonKeyWords



#===============================================================================
#	File Marking
proc PythonMarkFile {} {
	global PythonmodeVars
	set pos 0
	while {![catch {search -f 1 -r 1 -m 0 -i 1
$PythonmodeVars(funcExpr) $pos} res]} {
		set start [lindex $res 0]
		set end [lindex $res 1]
		set text [lindex [getText $start $end] 1]
		set pos $end
		set inds($text) "$start $end"
	}

	if {[info exists inds]} {
		foreach f [lsort [array names inds]] {
			setNamedMark $f [lineStart [lineStart [lindex
$inds($f) 0]] - 1] [lindex $inds($f) 0] [lindex $inds($f) 1]
		}
	}
}


--============_-1369288835==_============
Content-Type: text/plain; charset="us-ascii"

-----------------------------------------------------------------------
 Bill Bedford                                  Designer of Photo-Etches
 billb@mousa.demon.co.uk


               owner Brit_Rail-L  ---  british railways historical list

 -----------------------------------------------------------------------

--============_-1369288835==_============--

=================
PYTHONMAC-SIG  - SIG on Python for the Apple Macintosh

send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
=================