[Pythonmac-SIG] PyObjC

2005-06-15 Thread Jan Erik Moström
I'm currently looking around for what tools I should use for writing Mac
applications with GUIs. I've previously done this using either Java (no fun
and Swing based programs doesn't look good) or REALbasic, but would like to
use something else.

I've looked at Cocoa and Objective-C (haven't done any programming) but I
don't really like the syntax of Objective-C. So I've been considering using
Python instead, my previous experience of Python is standard shell scripts
and CGI scripts.

This might seem like a really stupid question but since I don't haven't used
Cocoa/Objective-C or PyObCj/Python I would like to ask a question: if I
decide to use Python are there limitations on what I can do? (for example not
being able to use UI widget XXX)

jem
-- 
Jan Erik Moström, www.mostrom.pp.se
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] macspeech for MacOSX

2005-06-15 Thread Noboru Yamamoto

Hi,

Attached file, macspeechX.py, is a replacement for macspeech module 
which used to be included in the Mac-Python distribution.
As name indicates, it works with MacOSX and has similar, if not same, 
interfaces found in the old macspeech module.


It requires ctypes module newer than 0.9.6 and Mac OSX 10.{2,3.4}.
Python interpreter come with MacOSX may not work, at least for me,
so you might need to build and install python from the source code.
Python 2.4.1 and ctypes 0.9.6 should work well.

I hope someone will think it is useful.

Thanks,

Noboru Yamamoto
Accelerator Lab.
KEK, JAPAN
#!/usr/local/bin/python

macspeechX.py ; Python Interface to Speech Syntheis Mangaer on Macintosh OSX.
requires; ctypes module(0.9.6 or later) and latest python interpreter.
Python interpreter pre-installed on OS may not work with latest ctypes module.

macspeechX tryed to simulate old macspeech module bundled with python(in
Pre-MacOSX era). The document for macspeech module should work on macspeechX 
module.

(c) Noboru Yamamoto(KEK,JAPAN),2005

import ctypes
from ctypes import cdll,byref
#load speachSynthesis dll
__SS_Available=None

try:

__ssdll=cdll.LoadLibrary(/System/Library/Frameworks/ApplicationServices.framework/Frameworks/SpeechSynthesis.framework/Versions/Current/SpeechSynthesis)
__SS_Available=1
except:
raise Speech Systheis is not available on this machine

#
def C2PStr(aStr):
return %c%s%(len(aStr),aStr)
#constants
_kNoEndingProsody = 1
_kNoSpeechInterrupt = 2
_kPreflightThenPause = 4

_kNeuter=0
_kMake=1
_kFemale=2

_kImmediate=0
_kEndOfWord=1
_kEndOfSentence=2

# classes
class NumVersion(ctypes.Structure):
_fields_=[(nonRelRev,ctypes.c_ubyte),
  (stage,ctypes.c_byte),
  (minorAndBugRev,ctypes.c_ubyte),
  (majorRev,ctypes.c_ubyte)]

class VoiceSpec(ctypes.Structure):
_fields_=[ (creator,ctypes.c_ulong),
   (id,ctypes.c_ulong),
   ]

class VoiceDescription(ctypes.Structure):
_fields_=[ (length,ctypes.c_long),
   (Voice,VoiceSpec),
   (version,ctypes.c_long),
   (name,ctypes.c_char*64),
   (comment,ctypes.c_char*256),
   (gender,ctypes.c_short),
   (age,ctypes.c_short),
   (script,ctypes.c_short),
   (language,ctypes.c_short),
   (region,ctypes.c_short),
   (reserved,ctypes.c_long*4), 
   ]

class SpeechChannelRecord(ctypes.Structure):
_fields_=[(data,ctypes.c_long*1)]

# classes for macspeech
__ssdll.GetVoiceDescription.argtypes=[VoiceSpec, 
ctypes.POINTER(VoiceDescription) ]

class SpeechChannel:
__ssdll=globals()[__ssdll]
__ssdll.NewSpeechChannel.argtypes=[ctypes.POINTER(VoiceSpec), 
   
ctypes.POINTER(ctypes.POINTER(SpeechChannelRecord))]

def __init__(self,v=None):
if not v:
v=Voice(0)
self.channel=ctypes.pointer(SpeechChannelRecord())

status=SpeechChannel.__ssdll.NewSpeechChannel(byref(v),byref(self.channel))
 
def __del__(self):
SpeechChannel.__ssdll.DisposeSpeechChannel(self.channel)

def SpeakText(self,s):
status=SpeechChannel.__ssdll.SpeakText(self.channel, s, len(s))
return status

def SpeakBuffer(self,  s, l, c=0):
status=SpeechChannel.__ssdll.SpeakText(self.channel, s, 
ctypes.c_ulong(l), ctypes.c_long(c))
return status

def Stop(self):
status=SpeechChannel.__ssdll.StopSpeech(self.channel)
return status

def StopAt(self,where=_kImmediate):
status=SpeechChannel.__ssdll.StopSpeechAt(self.channel,where)
return status

def Pause(self,where=_kImmediate):
status=SpeechChannel.__ssdll.PauseSpeechAt(self.channel,where)
return status

def Continue(self):
status=SpeechChannel.__ssdll.ContinueSpeech(self.channel)
return status

def GetPitch(self):
pitch=ctypes.c_long(0)
status=SpeechChannel.__ssdll.GetSpeechPitch(self.channel, byref(pitch))
self.pitch=pitch.value
return pitch.value

def SetPitch(self, pitch):

status=SpeechChannel.__ssdll.SetSpeechPitch(self.channel,ctypes.c_long(pitch))
self.pitch=pitch
return pitch

def GetRate(self):
rate=ctypes.c_long(0)
status=SpeechChannel.__ssdll.GetSpeechRate(self.channel,byref(rate))
self.rate=rate.value
return self.rate

def SetRate(self,rate):

status=SpeechChannel.__ssdll.SetSpeechRate(self.channel,ctypes.c_long(rate))
self.rate=rate
return rate

class Voice:
__ssdll=globals()[__ssdll]
__ssdll.GetVoiceDescription.argtypes=[ctypes.POINTER(VoiceSpec), 
ctypes.POINTER(VoiceDescription) ]

def __init__(self,ind=1):
self.voice=VoiceSpec()
Voice.__ssdll.GetIndVoice(ind, byref(self.voice))
self.desc=VoiceDescription()

[Pythonmac-SIG] what's the plural of Emacs?

2005-06-15 Thread Charles Hartman
I'd like to reintroduce myself to Emacs, so I went looking for the  
Mac version. There seem to be at least two, maybe more, even just  
from Apple. Can anyone give me the thumbnail version of why I should  
get one or another?

Charles Hartman

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] what's the plural of Emacs?

2005-06-15 Thread Bob Ippolito

On Jun 15, 2005, at 5:38 PM, Charles Hartman wrote:

 I'd like to reintroduce myself to Emacs, so I went looking for the
 Mac version. There seem to be at least two, maybe more, even just
 from Apple. Can anyone give me the thumbnail version of why I should
 get one or another?

Emacsen?

Apple only offers one emacs, the one that ships with Mac OS X, unless  
you're just talking about listings on http://apple.com/downloads/?

I've heard that some people are happy with the Carbonized GNU Emacs  
(I think it can be compiled from CVS, but there are various binaries  
available), and Kevin Walzer is working on an AquaMacs http:// 
www.wordtech-software.com/aquamacs.html distribution, which I've  
heard mixed things about.

-bob

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Aquamacs

2005-06-15 Thread Kevin Walzer
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Charles,

There are indeed various versions of Emacs out there for OS X. You can't
tell the players without a scorecard. Here's the rundown, based on
what's available at
http://www.apple.com/downloads/macosx/unix_open_source/ and elsewhere:

Carbon Emacs Package June '05: As far as I can tell, a well-maintained
build of Emacs from CVS, with the standard Emacs interface. It seems to
be released fairly regularly.

Emacs-on-Aqua: This is a Cocoa binding of Emacs, derived from the old
NeXT port of Emacs. It has a nice Aqua look and feel (unlike standard
Carbon Emacs). Its main drawback is that it's more than a full version
behind current Emacs (20.x, not 22.x). Development on it has just begun
again after being dormant for a couple of years (i.e. it was last
released for Jaguar).

Yaced (Yet Another Carbon Emacs Distribution, at
http://yaced.sourceforge.net): Pretty similar to Carbon Emacs Package
above, with some customizations geared to making it a good editing
environment for LaTeX. The maintainer, Norm Gall, also packages AucTeX.

Aquamacs, which I'm working on with David Reitter: This is a more
radical revision of Emacs: it overrides a lot of the standard Emacs
interface conventions, keyboard shortcuts, etc. and replaces them with
standard Aqua keymappings. i.e., Apple-C is the preferred method to copy
text. This is based on Carbon Emacs. I like the approach that Aquamacs
uses because I no longer have to choose between Emacs' power and
BBEdit/Textwrangler's ease of use.  If you prefer standard Emacs,
Aquamacs will probably drive you crazy.

There are probably other builds that I'm not aware of, but these are the
ones that seem to be most popular.

Let me know if you have other questions.

- --
Cheers,

Kevin Walzer, PhD
WordTech Software--Open Source Applications and Packages for OS X
http://www.wordtech-software.com
http://www.kevin-walzer.com
http://www.smallbizmac.com.
mailto:[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCsOQGJmdQs+6YVcoRAh6aAKCEpNAdyuJ/h9cjy+MhuLAVjrHWlQCdEAoH
LrGOprXPdApArcDD6LTd5d4=
=Lstc
-END PGP SIGNATURE-
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] what's the plural of Emacs?

2005-06-15 Thread Skip Montanaro

Bob I've heard that some people are happy with the Carbonized GNU Emacs
Bob (I think it can be compiled from CVS, but there are various
Bob binaries available), and Kevin Walzer is working on an AquaMacs
Bob http://www.wordtech-software.com/aquamacs.html distribution,
Bob which I've heard mixed things about.

My understanding (completely second-hand, and from the XEmacs gang, no less)
is that the guy that Carbonized (Carbonified?) GNU Emacs got disillusioned
with the GNU folk.  There are enough Mac/GNU Emacs people to keep that
running though, so it should be a reasonable option.  There is a Carbon
patch for XEmacs (contributed by the same guy) that's available as a a
branch on the XEmacs CVS repository.

Skip

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig