Merge pull request #736 from MikeTheWatchGuy/Dev-latest
MORE work on handling window closures. This time for non-blocking (t…
This commit is contained in:
commit
9d46ee9dd4
|
@ -3094,9 +3094,12 @@ class Window:
|
||||||
print("read failed")
|
print("read failed")
|
||||||
# return None, None
|
# return None, None
|
||||||
if self.RootNeedsDestroying:
|
if self.RootNeedsDestroying:
|
||||||
print('*** DESTROYING LATE ***')
|
print('*** DESTROYING LATE ***', self.ReturnValues)
|
||||||
self.TKroot.destroy()
|
self.TKroot.destroy()
|
||||||
_my_windows.Decrement()
|
_my_windows.Decrement()
|
||||||
|
self.Values = None
|
||||||
|
self.LastButtonClicked = None
|
||||||
|
return None, None
|
||||||
return BuildResults(self, False, self)
|
return BuildResults(self, False, self)
|
||||||
|
|
||||||
def Finalize(self):
|
def Finalize(self):
|
||||||
|
@ -3245,16 +3248,18 @@ class Window:
|
||||||
# IT FINALLY WORKED! 29-Oct-2018 was the first time this damned thing got called
|
# IT FINALLY WORKED! 29-Oct-2018 was the first time this damned thing got called
|
||||||
def OnClosingCallback(self):
|
def OnClosingCallback(self):
|
||||||
global _my_windows
|
global _my_windows
|
||||||
|
print('Got closing callback', self.DisableClose)
|
||||||
if self.DisableClose:
|
if self.DisableClose:
|
||||||
return
|
return
|
||||||
# print('Got closing callback')
|
|
||||||
if self.CurrentlyRunningMainloop: # quit if this is the current mainloop, otherwise don't quit!
|
if self.CurrentlyRunningMainloop: # quit if this is the current mainloop, otherwise don't quit!
|
||||||
self.TKroot.quit() # kick the users out of the mainloop
|
self.TKroot.quit() # kick the users out of the mainloop
|
||||||
self.TKroot.destroy() # kick the users out of the mainloop
|
self.TKroot.destroy() # kick the users out of the mainloop
|
||||||
self.RootNeedsDestroying = True
|
self.RootNeedsDestroying = True
|
||||||
|
self.TKrootDestroyed = True
|
||||||
else:
|
else:
|
||||||
|
self.TKroot.destroy() # kick the users out of the mainloop
|
||||||
self.RootNeedsDestroying = True
|
self.RootNeedsDestroying = True
|
||||||
self.TKrootDestroyed = True
|
self.RootNeedsDestroying = True
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -5861,7 +5866,7 @@ def ObjToString(obj, extra=' '):
|
||||||
|
|
||||||
# ----------------------------------- The mighty Popup! ------------------------------------------------------------ #
|
# ----------------------------------- The mighty Popup! ------------------------------------------------------------ #
|
||||||
|
|
||||||
def Popup(*args, title='', button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK,
|
def Popup(*args, title=None, button_color=None, background_color=None, text_color=None, button_type=POPUP_BUTTONS_OK,
|
||||||
auto_close=False, auto_close_duration=None, custom_text=(None, None), non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None,
|
auto_close=False, auto_close_duration=None, custom_text=(None, None), non_blocking=False, icon=DEFAULT_WINDOW_ICON, line_width=None,
|
||||||
font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None)):
|
font=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, location=(None, None)):
|
||||||
"""
|
"""
|
||||||
|
@ -5891,7 +5896,7 @@ def Popup(*args, title='', button_color=None, background_color=None, text_color=
|
||||||
local_line_width = line_width
|
local_line_width = line_width
|
||||||
else:
|
else:
|
||||||
local_line_width = MESSAGE_BOX_LINE_WIDTH
|
local_line_width = MESSAGE_BOX_LINE_WIDTH
|
||||||
title = title if title!='' else args_to_print[0]
|
title = title if title is not None else args_to_print[0]
|
||||||
window = Window(title, auto_size_text=True, background_color=background_color, button_color=button_color,
|
window = Window(title, auto_size_text=True, background_color=background_color, button_color=button_color,
|
||||||
auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font,
|
auto_close=auto_close, auto_close_duration=auto_close_duration, icon=icon, font=font,
|
||||||
no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location)
|
no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top, location=location)
|
||||||
|
|
Loading…
Reference in New Issue