summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-03-10 14:42:57 (GMT)
committerGuido van Rossum <guido@python.org>1995-03-10 14:42:57 (GMT)
commit227a4232e6580891d3ee74b25888685a3c436fe2 (patch)
tree91b47c2e4b16996cb95836cb5223a87474c1992b /Mac
parentfc8a01fc5a2890b24ca044f3d00a5139a13e40b2 (diff)
downloadcpython-227a4232e6580891d3ee74b25888685a3c436fe2.zip
cpython-227a4232e6580891d3ee74b25888685a3c436fe2.tar.gz
cpython-227a4232e6580891d3ee74b25888685a3c436fe2.tar.bz2
the usual
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Lib/test/echo.py48
-rw-r--r--Mac/Lib/toolbox/AppleEvents.py1
-rw-r--r--Mac/Lib/toolbox/Controls.py1
-rw-r--r--Mac/Lib/toolbox/Dialogs.py1
-rw-r--r--Mac/Lib/toolbox/Events.py1
-rw-r--r--Mac/Lib/toolbox/Resources.py1
-rw-r--r--Mac/Lib/toolbox/Sound.py1
-rw-r--r--Mac/Lib/toolbox/Windows.py1
-rw-r--r--Mac/Modules/ae/aegen.py1
-rw-r--r--Mac/Modules/ctl/ctlgen.py1
-rw-r--r--Mac/Modules/evt/evtgen.py3
-rw-r--r--Mac/Modules/menu/Menumodule.c2
-rw-r--r--Mac/Modules/menu/menugen.py1
-rw-r--r--Mac/Modules/res/Resmodule.c2
-rw-r--r--Mac/Modules/res/resgen.py1
-rw-r--r--Mac/Modules/res/resscan.py3
-rw-r--r--Mac/Modules/snd/sndgen.py1
17 files changed, 57 insertions, 13 deletions
diff --git a/Mac/Lib/test/echo.py b/Mac/Lib/test/echo.py
index 616f712..20b1d77 100644
--- a/Mac/Lib/test/echo.py
+++ b/Mac/Lib/test/echo.py
@@ -11,6 +11,8 @@ addpack.addpack('Demo')
addpack.addpack('bgen')
addpack.addpack('ae')
addpack.addpack('evt')
+#addpack.addpack('menu')
+addpack.addpack('win')
import sys
sys.stdout = sys.stderr
@@ -20,18 +22,25 @@ import AE
from AppleEvents import *
import Evt
from Events import *
+import Menu
+import Dlg
+import Win
+from Windows import *
+import Qd
+
import aetools
+import EasyDialogs
kHighLevelEvent = 23 # Not defined anywhere for Python yet?
def main():
echo = EchoServer()
- MacOS.EnableAppswitch(0) # Disable Python's own "event handling"
+ yield = MacOS.EnableAppswitch(-1) # Disable Python's own "event handling"
try:
- echo.mainloop()
+ echo.mainloop(everyEvent, 0)
finally:
- MacOS.EnableAppswitch(1) # Let Python have a go at events
+ MacOS.EnableAppswitch(yield) # Let Python have a go at events
echo.close()
@@ -44,6 +53,13 @@ class EchoServer:
for suite in self.suites:
AE.AEInstallEventHandler(suite, typeWildCard, self.aehandler)
self.active = 1
+ self.appleid = 1
+ Menu.ClearMenuBar()
+ self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024")
+ applemenu.AppendMenu("All about echo...;(-")
+ applemenu.AddResMenu('DRVR')
+ applemenu.InsertMenu(0)
+ Menu.DrawMenuBar()
def __del__(self):
self.close()
@@ -64,22 +80,38 @@ class EchoServer:
self.lowlevelhandler(event)
def lowlevelhandler(self, event):
- what, message, when, (h, v), modifiers = event
+ what, message, when, where, modifiers = event
+ h, v = where
if what == kHighLevelEvent:
- print "High Level Event:", `code(message)`, `code(h | (v<<16))`
+ msg = "High Level Event: %s %s" % \
+ (`code(message)`, `code(h | (v<<16))`)
try:
AE.AEProcessAppleEvent(event)
- except AE.Error, msg:
- print "AEProcessAppleEvent error:"
+ except AE.Error, err:
+ EasyDialogs.Message(msg + "\015AEProcessAppleEvent error: %s" % str(err))
traceback.print_exc()
+ else:
+ EasyDialogs.Message(msg + "\015OK!")
elif what == keyDown:
c = chr(message & charCodeMask)
if c == '.' and modifiers & cmdKey:
raise KeyboardInterrupt, "Command-period"
MacOS.HandleEvent(event)
+ elif what == mouseDown:
+ partcode, window = Win.FindWindow(where)
+ if partcode == inMenuBar:
+ result = Menu.MenuSelect(where)
+ id = (result>>16) & 0xffff # Hi word
+ item = result & 0xffff # Lo word
+ if id == self.appleid:
+ if item == 1:
+ EasyDialogs.Message("Echo -- echo AppleEvents")
+ elif item > 1:
+ name = self.applemenu.GetItem(item)
+ Qd.OpenDeskAcc(name)
elif what <> autoKey:
print "Event:", (eventname(what), message, when, (h, v), modifiers)
- MacOS.HandleEvent(event)
+## MacOS.HandleEvent(event)
def aehandler(self, request, reply):
print "Apple Event",
diff --git a/Mac/Lib/toolbox/AppleEvents.py b/Mac/Lib/toolbox/AppleEvents.py
index b3780d0..0e1e069 100644
--- a/Mac/Lib/toolbox/AppleEvents.py
+++ b/Mac/Lib/toolbox/AppleEvents.py
@@ -1,4 +1,5 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:AppleEvents.h'
+
typeBoolean = 'bool'
typeChar = 'TEXT'
typeSMInt = 'shor'
diff --git a/Mac/Lib/toolbox/Controls.py b/Mac/Lib/toolbox/Controls.py
index c95ea11..0686580 100644
--- a/Mac/Lib/toolbox/Controls.py
+++ b/Mac/Lib/toolbox/Controls.py
@@ -1,4 +1,5 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Controls.h'
+
pushButProc = 0
checkBoxProc = 1
radioButProc = 2
diff --git a/Mac/Lib/toolbox/Dialogs.py b/Mac/Lib/toolbox/Dialogs.py
index 297568c..c31bfbe 100644
--- a/Mac/Lib/toolbox/Dialogs.py
+++ b/Mac/Lib/toolbox/Dialogs.py
@@ -1,4 +1,5 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Dialogs.h'
+
ctrlItem = 4
btnCtrl = 0
chkCtrl = 1
diff --git a/Mac/Lib/toolbox/Events.py b/Mac/Lib/toolbox/Events.py
index ac32c3f..943c9e5 100644
--- a/Mac/Lib/toolbox/Events.py
+++ b/Mac/Lib/toolbox/Events.py
@@ -1,4 +1,5 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Events.h'
+
nullEvent = 0
mouseDown = 1
mouseUp = 2
diff --git a/Mac/Lib/toolbox/Resources.py b/Mac/Lib/toolbox/Resources.py
index 743c656..e2ed97a 100644
--- a/Mac/Lib/toolbox/Resources.py
+++ b/Mac/Lib/toolbox/Resources.py
@@ -1,4 +1,5 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Resources.h'
+
resSysHeap = 64
resPurgeable = 32
resLocked = 16
diff --git a/Mac/Lib/toolbox/Sound.py b/Mac/Lib/toolbox/Sound.py
index 600adcd..a65c652 100644
--- a/Mac/Lib/toolbox/Sound.py
+++ b/Mac/Lib/toolbox/Sound.py
@@ -1,4 +1,5 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Sound.h'
+
swMode = -1
ftMode = 1
ffMode = 0
diff --git a/Mac/Lib/toolbox/Windows.py b/Mac/Lib/toolbox/Windows.py
index 5d5bd7a..037000f 100644
--- a/Mac/Lib/toolbox/Windows.py
+++ b/Mac/Lib/toolbox/Windows.py
@@ -1,4 +1,5 @@
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Windows.h'
+
documentProc = 0
dBoxProc = 1
plainDBox = 2
diff --git a/Mac/Modules/ae/aegen.py b/Mac/Modules/ae/aegen.py
index ea9b3b6..221ef97 100644
--- a/Mac/Modules/ae/aegen.py
+++ b/Mac/Modules/ae/aegen.py
@@ -312,3 +312,4 @@ f = AEFunction(OSErr, 'AEManagerInfo',
(long, 'result', OutMode),
)
functions.append(f)
+
diff --git a/Mac/Modules/ctl/ctlgen.py b/Mac/Modules/ctl/ctlgen.py
index fcbf0f4..0a355cf 100644
--- a/Mac/Modules/ctl/ctlgen.py
+++ b/Mac/Modules/ctl/ctlgen.py
@@ -170,3 +170,4 @@ f = Method(short, 'GetCVariant',
(ControlHandle, 'theControl', InMode),
)
methods.append(f)
+
diff --git a/Mac/Modules/evt/evtgen.py b/Mac/Modules/evt/evtgen.py
index ff30b8d..fd61c4d 100644
--- a/Mac/Modules/evt/evtgen.py
+++ b/Mac/Modules/evt/evtgen.py
@@ -42,6 +42,3 @@ f = Function(void, 'GetKeys',
)
functions.append(f)
-f = Function(long, 'TickCount',
-)
-functions.append(f)
diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c
index 78c4f60..a1308f9 100644
--- a/Mac/Modules/menu/Menumodule.c
+++ b/Mac/Modules/menu/Menumodule.c
@@ -50,7 +50,7 @@ typedef struct MenuObject {
} MenuObject;
PyObject *MenuObj_New(itself)
- const MenuHandle itself;
+ MenuHandle itself;
{
MenuObject *it;
it = PyObject_NEW(MenuObject, &Menu_Type);
diff --git a/Mac/Modules/menu/menugen.py b/Mac/Modules/menu/menugen.py
index 30315b8..2be4504 100644
--- a/Mac/Modules/menu/menugen.py
+++ b/Mac/Modules/menu/menugen.py
@@ -240,3 +240,4 @@ f = Function(void, 'DelMCEntries',
(short, 'menuItem', InMode),
)
functions.append(f)
+
diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c
index a0e487c..aeb7958 100644
--- a/Mac/Modules/res/Resmodule.c
+++ b/Mac/Modules/res/Resmodule.c
@@ -50,7 +50,7 @@ typedef struct ResourceObject {
} ResourceObject;
PyObject *ResObj_New(itself)
- const Handle itself;
+ Handle itself;
{
ResourceObject *it;
if (itself == NULL) return PyMac_Error(resNotFound);
diff --git a/Mac/Modules/res/resgen.py b/Mac/Modules/res/resgen.py
index 3716e9e..9d817a3 100644
--- a/Mac/Modules/res/resgen.py
+++ b/Mac/Modules/res/resgen.py
@@ -269,3 +269,4 @@ f = ResMethod(void, 'SetResourceSize',
(long, 'newSize', InMode),
)
resmethods.append(f)
+
diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py
index 42bb389..d45d69e 100644
--- a/Mac/Modules/res/resscan.py
+++ b/Mac/Modules/res/resscan.py
@@ -38,6 +38,9 @@ class ResourcesScanner(Scanner):
return [
"ReadPartialResource",
"WritePartialResource",
+## "RmveResource", # RemoveResource
+## "SizeResource", # GetResourceSizeOnDisk
+## "MaxSizeRsrc", # GetMaxResourceSize
]
def makerepairinstructions(self):
diff --git a/Mac/Modules/snd/sndgen.py b/Mac/Modules/snd/sndgen.py
index 2c77a1f..8e02f29 100644
--- a/Mac/Modules/snd/sndgen.py
+++ b/Mac/Modules/snd/sndgen.py
@@ -129,3 +129,4 @@ f = SndFunction(void, 'Exp1to6',
(unsigned_long, 'whichChannel', InMode),
)
functions.append(f)
+