]> granicus.if.org Git - python/commitdiff
Added an optional debug handler that traps and prints all unknown appleevents.
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 20 Jun 2000 22:01:04 +0000 (22:01 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 20 Jun 2000 22:01:04 +0000 (22:01 +0000)
13 files changed:
Mac/Demo/PICTbrowse/ICONbrowse.py
Mac/Demo/PICTbrowse/PICTbrowse.py
Mac/Demo/PICTbrowse/PICTbrowse.rsrc
Mac/Demo/PICTbrowse/PICTbrowse2.py
Mac/Demo/PICTbrowse/cicnbrowse.py
Mac/Demo/PICTbrowse/oldPICTbrowse.rsrc
Mac/Demo/cgi/realcgitest.py
Mac/Demo/example1/dnslookup-1.py
Mac/Demo/example1/dnslookup-1.rsrc
Mac/Demo/example2/dnslookup-2.py
Mac/Demo/example2/dnslookup-2.rsrc
Mac/Demo/waste/htmled.py
Mac/Demo/waste/swed.py

index 4e20b7f37a5617ae5221ab6c91d1a089abb54114..fe28564bf98dc99e5298df2f8f3c65c6c1e0518f 100644 (file)
@@ -30,7 +30,7 @@ def main():
                dummy = Res.GetResource('DLOG', ID_MAIN)
        except Res.Error:
                try:
-                       Res.OpenResFile("PICTbrowse.rsrc")
+                       Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
                except Res.Error, arg:
                        EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
                        sys.exit(1)     
index 653dd5d12d594a5f21ea5f838c3b0964d1283a10..07719918f7ec826e7acc6bc517f95644924b7be4 100644 (file)
@@ -25,7 +25,7 @@ def main():
                dummy = Res.GetResource('DLOG', ID_MAIN)
        except Res.Error:
                try:
-                       Res.OpenResFile("PICTbrowse.rsrc")
+                       Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
                except Res.Error, arg:
                        EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
                        sys.exit(1)     
index aae379bf09fb7c0bb565d589e4290c6ed6d8a870..526ff522aa7b108bad8f9ceafabc2aa178be3dd8 100644 (file)
Binary files a/Mac/Demo/PICTbrowse/PICTbrowse.rsrc and b/Mac/Demo/PICTbrowse/PICTbrowse.rsrc differ
index 31169eea54b02a1d936b5807a4ab7ea35f2e21c6..c78960cc29b0c2ce469852f6ebf82d09f29e9e95 100644 (file)
@@ -29,7 +29,7 @@ def main():
                dummy = Res.GetResource('DLOG', ID_MAIN)
        except Res.Error:
                try:
-                       Res.OpenResFile("PICTbrowse.rsrc")
+                       Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
                except Res.Error, arg:
                        EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
                        sys.exit(1)     
index 67ec355fc15daf8ec916a8fef89b9580e3e9b16c..b56cd134298d5e72b22d385fef6494ca28e8a66b 100644 (file)
@@ -30,7 +30,7 @@ def main():
                dummy = Res.GetResource('DLOG', ID_MAIN)
        except Res.Error:
                try:
-                       Res.OpenResFile("PICTbrowse.rsrc")
+                       Res.FSpOpenResFile("PICTbrowse.rsrc", 1)
                except Res.Error, arg:
                        EasyDialogs.Message("Cannot open PICTbrowse.rsrc: "+arg[1])
                        sys.exit(1)     
index 6745d2f46312571af880ddc34c63228e622e041c..fb7a192df2c096f2781a2475aafcf06f6eea0932 100644 (file)
Binary files a/Mac/Demo/PICTbrowse/oldPICTbrowse.rsrc and b/Mac/Demo/PICTbrowse/oldPICTbrowse.rsrc differ
index a91771a83f111b8359792e5f6830948164bc1eb5..e51cb9782079ae07e84b7f6885581236f7cd11f3 100644 (file)
@@ -4,6 +4,8 @@
 from MiniAEFrame import AEServer, MiniApplication
 import MacOS
 
+debug=1
+
 class CGITest(AEServer, MiniApplication):
        
        def __init__(self):
@@ -12,6 +14,8 @@ class CGITest(AEServer, MiniApplication):
                self.installaehandler('aevt', 'oapp', self.open_app)
                self.installaehandler('aevt', 'quit', self.quit)
                self.installaehandler('WWW\275', 'sdoc', self.cgihandler)
+               if debug:
+                       self.installaehandler('****', '****', self.otherhandler)
                oldparams = MacOS.SchedParams(0, 0)
                self.mainloop()
                apply(MacOS.SchedParams, oldparams)
@@ -21,8 +25,15 @@ class CGITest(AEServer, MiniApplication):
                
        def open_app(self, **args):
                pass
-                               
+       
+       def otherhandler(self, *args, **kwargs):
+               print 'Unknown AppleEvent'
+               print 'args', args
+               print 'kwargs', kwargs
+               
        def cgihandler(self, pathargs, **args):
+               if debug:
+                       print 'CGI request', pathargs, args
                rv = """HTTP/1.0 200 OK
 Server: Unknown; python-cgi-script
 MIME-Version: 1.0
index a59fb8ee990a7f4c786767c03b5133b9bff0ab4b..294faad3630c672323b149e53c5d07259616a002 100644 (file)
@@ -20,7 +20,7 @@ ITEM_QUIT_BUTTON=4
 def main():
     """Main routine: open resource file, call dialog handler"""
     try:
-        Res.OpenResFile("dnslookup-1.rsrc")
+        Res.FSpOpenResFile("dnslookup-1.rsrc", 1)
     except Res.Error:
         EasyDialogs.Message("Cannot open dnslookup-1.rsrc")
         sys.exit(1) 
index 2514f5604fe80376e72897bd4a7ee8851789c548..6cf9fe98884e2cc8a872bd5fcaef62122d958ba5 100644 (file)
Binary files a/Mac/Demo/example1/dnslookup-1.rsrc and b/Mac/Demo/example1/dnslookup-1.rsrc differ
index 970b2abcdd6bd80c312a30ad186dd3a3765b1c09..82568d0ca80370b6497de0fcc3348ce718ce4b3f 100644 (file)
@@ -19,7 +19,7 @@ def main():
         dummy = Res.GetResource('DLOG', ID_MAIN)
     except Res.Error:
         try:
-            Res.OpenResFile("dnslookup-2.rsrc")
+            Res.FSpOpenResFile("dnslookup-2.rsrc", 1)
         except Res.Error:
             EasyDialogs.Message("Cannot open dnslookup-2.rsrc")
             sys.exit(1) 
index 5276ee2f93d783f95a019228c9edca26195091d3..17b22d94c57c3b85803572cf121cd3b63a095e6e 100644 (file)
Binary files a/Mac/Demo/example2/dnslookup-2.rsrc and b/Mac/Demo/example2/dnslookup-2.rsrc differ
index 5aa0207267281cfffe87c68ca9e65d5f8faf927b..c6ae2e73a2c49bc04909aa291f0efdbc390bb9f9 100644 (file)
@@ -72,7 +72,7 @@ class WasteWindow(ScrolledWindow):
                        return None, None
                oldrf = Res.CurResFile()
                try:
-                       rf = Res.OpenResFile(self.path)
+                       rf = Res.FSpOpenResFile(self.path, 1)
                except Res.Error:
                        return None, None
                try:
@@ -241,10 +241,10 @@ class WasteWindow(ScrolledWindow):
                #
                oldresfile = Res.CurResFile()
                try:
-                       rf = Res.OpenResFile(self.path)
+                       rf = Res.FSpOpenResFile(self.path, 3)
                except Res.Error:
                        Res.CreateResFile(self.path)
-                       rf = Res.OpenResFile(self.path)
+                       rf = Res.FSpOpenResFile(self.path, 3)
                styles = Res.Resource('')
                soup = Res.Resource('')
                self.ted.WECopyRange(0, 0x3fffffff, None, styles, soup)
index 83f29b7f9d70a69b80da23263232d2886178bf63..473d777bc1724e61f1e019f2cb01fee59e62af6e 100644 (file)
@@ -59,7 +59,7 @@ class WasteWindow(ScrolledWindow):
                        return None, None
                oldrf = Res.CurResFile()
                try:
-                       rf = Res.OpenResFile(self.path)
+                       rf = Res.FSpOpenResFile(self.path, 1)
                except Res.Error:
                        return None, None
                try:
@@ -210,10 +210,10 @@ class WasteWindow(ScrolledWindow):
                #
                oldresfile = Res.CurResFile()
                try:
-                       rf = Res.OpenResFile(self.path)
+                       rf = Res.FSpOpenResFile(self.path, 3)
                except Res.Error:
                        Res.CreateResFile(self.path)
-                       rf = Res.OpenResFile(self.path)
+                       rf = Res.FSpOpenResFile(self.path, 3)
                styles = Res.Resource('')
                soup = Res.Resource('')
                self.ted.WECopyRange(0, 0x3fffffff, None, styles, soup)