]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Calling Application._quit() is now preferred over raising self.
authorJack Jansen <jack.jansen@cwi.nl>
Tue, 17 Sep 1996 12:39:12 +0000 (12:39 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Tue, 17 Sep 1996 12:39:12 +0000 (12:39 +0000)
Mac/Demo/PICTbrowse/PICTbrowse.py
Mac/Demo/PICTbrowse/PICTbrowse2.py
Mac/Demo/cgi.html
Mac/Demo/example2.html
Mac/Demo/example2/InterslipControl-2.py
Mac/Demo/imgbrowse/imgbrowse.py
Mac/Demo/textedit.html
Mac/Demo/textedit/ped.py
Mac/Demo/waste/htmled.py
Mac/Demo/waste/swed.py
Mac/Demo/waste/wed.py

index 4aabf67de7f94056a89a700a29b93b214f5769a9..412716e638c2d3da2d86581fed8960616d43ba49 100644 (file)
@@ -47,7 +47,7 @@ class PICTbrowse(FrameWork.Application):
                self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
        
        def quit(self, *args):
-               raise self
+               self._quit()
                
        def showPICT(self, resid):
                w = PICTwindow(self)
index 588cc0bc879b59c1af9a54a376d778a11b065aad..c2d9c17dda4d824ee165752d5c0b76dd0be32c06 100644 (file)
@@ -51,7 +51,7 @@ class PICTbrowse(FrameWork.Application):
                self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
        
        def quit(self, *args):
-               raise self
+               self._quit()
                
        def showPICT(self, resid):
                w = PICTwindow(self)
index 3932b2842c62ea0a21161846445d7d57617172f9..c2369cf0a768e2dde009e3edb6d8c22cce6cf0a0 100644 (file)
@@ -30,11 +30,6 @@ This file contains two classes, <code>MiniApplication</code> and <code>AEServer<
 MiniApplication is a tiny replacement for <code>FrameWork.Application</code>,
 suitable if your application does not need windows and such. 
 
-<blockquote>Actually, Framework.Application has a problem for AE Servers,
-due to the way it expects to be quit through an exception, and raising an exception
-while inside an Apple Event handler is a very bad idea. This will be fixed.
-</blockquote>
-
 AEServer is a bit of glue that does part of the appleevent decoding for you. You
 call <code>installaehandler</code> passing it the class and id (4-char strings)
 of the event you have a handler for and the handler callback routine. When the
@@ -45,7 +40,7 @@ suites provide. <p>
 
 You can test AEServer by double-clicking it. It will react to the standard
 run/open/print/quit OSA commands. If it is running as a normal python script and you
-drag a file onto the interpreter the script will tell you what event is got. <p>
+drag a file onto the interpreter the script will tell you what event it got. <p>
 
 <h2>A Minimal CGI script</h2>
 
index aebe73d29328912798fd99c364962ca247b4e212..936cfad4912e27c45fb41cf9546e0e3598b5abda 100644 (file)
@@ -85,8 +85,8 @@ Next comes the definition of our main class,
 menu bar and the main event loop and event dispatching. In the
 <CODE>__init__</CODE> routine we first let the base class initialize
 itself, then we create our modeless dialog and finally we jump into
-the main loop. The main loop continues until <CODE>self</CODE> is
-raised, which we will do when the user selects "quit". When we create
+the main loop. The main loop continues until we call <CODE>self._quit</CODE>,
+which we will do when the user selects "quit". When we create
 the instance of <CODE>MyDialog</CODE> (which inherits
 <CODE>DialogWindow</CODE>, which inherits <CODE>Window</CODE>) we pass
 a reference to the application object, this reference is used to tell
@@ -97,8 +97,8 @@ clicks. <p>
 The <CODE>makeusermenus()</CODE> method (which is called sometime
 during the Application <CODE>__init__</CODE> routine) creates a File
 menu with a Quit command (shortcut command-Q), which will callback to
-our quit() method. <CODE>Quit()</CODE>, in turn, raises 'self' which
-causes the mainloop to terminate. <p>
+our quit() method. <CODE>Quit()</CODE>, in turn, calls <CODE>_quit</CODE> which
+causes the mainloop to terminate at a convenient time. <p>
 
 Application provides a standard about box, but we override this by
 providing our own <CODE>do_about()</CODE> method which shows an about
index 49458645045ea35ea7ab8de2010760dcf8b7934e..90d57dd728bbf5e485cbe715510ffa1080b3402e 100644 (file)
@@ -51,7 +51,7 @@ class InterslipControl(FrameWork.Application):
                self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
        
        def quit(self, *args):
-               raise self
+               self._quit()
                
        def do_about(self, *args):
                f = Dlg.GetNewDialog(ID_ABOUT, -1)
index 56d6d3128fbafde3d76112670020c851b87471a5..ff778bf1022f90a899af289bc3cc8e37191752e7 100644 (file)
@@ -81,7 +81,7 @@ class imgbrowse(FrameWork.Application):
                self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
        
        def quit(self, *args):
-               raise self
+               self._quit()
                
        def opendoc(self, *args):
                fss, ok = macfs.StandardGetFile() # Any file type
index d56ea0b5dcf3e93caca698221ef034c21abd3b01..606c668990ddf7e1cbcdfff4fda2778f682b3fef 100644 (file)
@@ -108,8 +108,7 @@ lines. <p>
 
 Oh yes: the <code>quit</code> callback does a little magic too. It closes all windows, and only if this
 succeeds it actually quits. This gives the user a chance to cancel the operation if some files are unsaved.
-Quitting itself is also a bit strange: you raise <code>self</code> to break out of the main loop. This bit
-of idiom was invented by Guido, so blame him:-). <p>
+<p>
 
 Lastly, there is the <code>idle</code> method, called by the Application base class when no event
 is available. It is forwarded to the active window, so it can blink the text caret. <p>
index 3999dae93bd29c1d31afc3858e575957c65a9fbb..5c2d0f6013d07998b35280d9253549ff0e73bbe0 100644 (file)
@@ -295,7 +295,7 @@ class Ped(Application):
                        w.close()
                if self._windows:
                        return
-               raise self
+               self._quit()
                
        #
        # Edit menu
index 15b90352be191bbdcf9c2980f988d1f66ba31e39..e56b607d6f99b00ba1a8c0e8d1b008e017cf007a 100644 (file)
@@ -730,7 +730,7 @@ class Wed(Application):
                        w.close()
                if self._windows:
                        return
-               raise self
+               self._quit()
                
        #
        # Edit menu
index dc5de6a21ea9f5c71343b4dea8311e03509b6c1c..8107434e78045d27e7b09ec18d85cdb6261f2cdb 100644 (file)
@@ -558,7 +558,7 @@ class Wed(Application):
                        w.close()
                if self._windows:
                        return
-               raise self
+               self._quit()
                
        #
        # Edit menu
index d4f08f45928bf22fac7ff6b70670095b8a93be31..6ddb79b6076537be2cefa0963dd904f47df7baed 100644 (file)
@@ -368,7 +368,7 @@ class Wed(Application):
                        w.close()
                if self._windows:
                        return
-               raise self
+               self._quit()
                
        #
        # Edit menu