Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef5cd05

Browse files
committed
Calling Application._quit() is now preferred over raising self.
1 parent 4cb9454 commit ef5cd05

11 files changed

Lines changed: 14 additions & 20 deletions

File tree

Mac/Demo/PICTbrowse/PICTbrowse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def makeusermenus(self):
4747
self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
4848

4949
def quit(self, *args):
50-
raise self
50+
self._quit()
5151

5252
def showPICT(self, resid):
5353
w = PICTwindow(self)

Mac/Demo/PICTbrowse/PICTbrowse2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def makeusermenus(self):
5151
self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
5252

5353
def quit(self, *args):
54-
raise self
54+
self._quit()
5555

5656
def showPICT(self, resid):
5757
w = PICTwindow(self)

Mac/Demo/cgi.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ <h2>AppleEvent servers</h2>
3030
MiniApplication is a tiny replacement for <code>FrameWork.Application</code>,
3131
suitable if your application does not need windows and such.
3232

33-
<blockquote>Actually, Framework.Application has a problem for AE Servers,
34-
due to the way it expects to be quit through an exception, and raising an exception
35-
while inside an Apple Event handler is a very bad idea. This will be fixed.
36-
</blockquote>
37-
3833
AEServer is a bit of glue that does part of the appleevent decoding for you. You
3934
call <code>installaehandler</code> passing it the class and id (4-char strings)
4035
of the event you have a handler for and the handler callback routine. When the
@@ -45,7 +40,7 @@ <h2>AppleEvent servers</h2>
4540

4641
You can test AEServer by double-clicking it. It will react to the standard
4742
run/open/print/quit OSA commands. If it is running as a normal python script and you
48-
drag a file onto the interpreter the script will tell you what event is got. <p>
43+
drag a file onto the interpreter the script will tell you what event it got. <p>
4944

5045
<h2>A Minimal CGI script</h2>
5146

Mac/Demo/example2.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ <H2>A modeless dialog application using FrameWork</H2>
8585
menu bar and the main event loop and event dispatching. In the
8686
<CODE>__init__</CODE> routine we first let the base class initialize
8787
itself, then we create our modeless dialog and finally we jump into
88-
the main loop. The main loop continues until <CODE>self</CODE> is
89-
raised, which we will do when the user selects "quit". When we create
88+
the main loop. The main loop continues until we call <CODE>self._quit</CODE>,
89+
which we will do when the user selects "quit". When we create
9090
the instance of <CODE>MyDialog</CODE> (which inherits
9191
<CODE>DialogWindow</CODE>, which inherits <CODE>Window</CODE>) we pass
9292
a reference to the application object, this reference is used to tell
@@ -97,8 +97,8 @@ <H2>A modeless dialog application using FrameWork</H2>
9797
The <CODE>makeusermenus()</CODE> method (which is called sometime
9898
during the Application <CODE>__init__</CODE> routine) creates a File
9999
menu with a Quit command (shortcut command-Q), which will callback to
100-
our quit() method. <CODE>Quit()</CODE>, in turn, raises 'self' which
101-
causes the mainloop to terminate. <p>
100+
our quit() method. <CODE>Quit()</CODE>, in turn, calls <CODE>_quit</CODE> which
101+
causes the mainloop to terminate at a convenient time. <p>
102102

103103
Application provides a standard about box, but we override this by
104104
providing our own <CODE>do_about()</CODE> method which shows an about

Mac/Demo/example2/InterslipControl-2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def makeusermenus(self):
5151
self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
5252

5353
def quit(self, *args):
54-
raise self
54+
self._quit()
5555

5656
def do_about(self, *args):
5757
f = Dlg.GetNewDialog(ID_ABOUT, -1)

Mac/Demo/imgbrowse/imgbrowse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def makeusermenus(self):
8181
self.quititem = FrameWork.MenuItem(m, "Quit", "Q", self.quit)
8282

8383
def quit(self, *args):
84-
raise self
84+
self._quit()
8585

8686
def opendoc(self, *args):
8787
fss, ok = macfs.StandardGetFile() # Any file type

Mac/Demo/textedit.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ <H2>A sample text editor</H2>
108108

109109
Oh yes: the <code>quit</code> callback does a little magic too. It closes all windows, and only if this
110110
succeeds it actually quits. This gives the user a chance to cancel the operation if some files are unsaved.
111-
Quitting itself is also a bit strange: you raise <code>self</code> to break out of the main loop. This bit
112-
of idiom was invented by Guido, so blame him:-). <p>
111+
<p>
113112

114113
Lastly, there is the <code>idle</code> method, called by the Application base class when no event
115114
is available. It is forwarded to the active window, so it can blink the text caret. <p>

Mac/Demo/textedit/ped.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def quit(self, *args):
295295
w.close()
296296
if self._windows:
297297
return
298-
raise self
298+
self._quit()
299299

300300
#
301301
# Edit menu

Mac/Demo/waste/htmled.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def quit(self, *args):
730730
w.close()
731731
if self._windows:
732732
return
733-
raise self
733+
self._quit()
734734

735735
#
736736
# Edit menu

Mac/Demo/waste/swed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def quit(self, *args):
558558
w.close()
559559
if self._windows:
560560
return
561-
raise self
561+
self._quit()
562562

563563
#
564564
# Edit menu

0 commit comments

Comments
 (0)