mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Use MacOS.KeepConsole to always exit if the program calls FrameWork._quit(). Overridable with a class variable keepconsole.
This commit is contained in:
parent
6433fdf1fe
commit
f2bd9ee357
1 changed files with 6 additions and 2 deletions
|
@ -147,9 +147,15 @@ class Application:
|
||||||
# (XXX I'm not sure if using default parameter values is the right
|
# (XXX I'm not sure if using default parameter values is the right
|
||||||
# way to define the mask and wait time passed to WaitNextEvent.)
|
# way to define the mask and wait time passed to WaitNextEvent.)
|
||||||
|
|
||||||
|
schedparams = (0, 0) # By default disable Python's event handling
|
||||||
|
|
||||||
|
keepconsole = 0 # By default don't keep console window open
|
||||||
|
|
||||||
def mainloop(self, mask = everyEvent, wait = 0):
|
def mainloop(self, mask = everyEvent, wait = 0):
|
||||||
self.quitting = 0
|
self.quitting = 0
|
||||||
saveparams = apply(MacOS.SchedParams, self.schedparams)
|
saveparams = apply(MacOS.SchedParams, self.schedparams)
|
||||||
|
if self.keepconsole != None:
|
||||||
|
MacOS.KeepConsole(self.keepconsole)
|
||||||
try:
|
try:
|
||||||
while not self.quitting:
|
while not self.quitting:
|
||||||
try:
|
try:
|
||||||
|
@ -162,8 +168,6 @@ class Application:
|
||||||
finally:
|
finally:
|
||||||
apply(MacOS.SchedParams, saveparams)
|
apply(MacOS.SchedParams, saveparams)
|
||||||
|
|
||||||
schedparams = (0, 0) # By default disable Python's event handling
|
|
||||||
|
|
||||||
def dopendingevents(self, mask = everyEvent):
|
def dopendingevents(self, mask = everyEvent):
|
||||||
"""dopendingevents - Handle all pending events"""
|
"""dopendingevents - Handle all pending events"""
|
||||||
while self.do1event(mask, wait=0):
|
while self.do1event(mask, wait=0):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue