[2.7] bpo-34120: fix IDLE freezing after closing dialogs (GH-8603)

Added missing .grab_release() calls to all places where we call .grab_set().

(cherry picked from commit 10ea9409ce)
This commit is contained in:
Tal Einat 2018-08-02 10:21:49 +03:00 committed by GitHub
parent 48c8bf21f9
commit 894940b109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 1 deletions

View File

@ -141,6 +141,7 @@ class AboutDialog(Toplevel):
textView.view_file(self, title, fn, encoding)
def Ok(self, event=None):
self.grab_release()
self.destroy()
if __name__ == '__main__':

View File

@ -1197,10 +1197,12 @@ class ConfigDialog(Toplevel):
instance.reset_help_menu_entries()
def Cancel(self):
self.grab_release()
self.destroy()
def Ok(self):
self.Apply()
self.grab_release()
self.destroy()
def Apply(self):

View File

@ -155,10 +155,12 @@ class GetHelpSourceDialog(Toplevel):
# Mac Safari insists on using the URI form for local files
self.result = list(self.result)
self.result[1] = "file://" + path
self.grab_release()
self.destroy()
def Cancel(self, event=None):
self.result = None
self.grab_release()
self.destroy()
if __name__ == '__main__':

View File

@ -80,10 +80,13 @@ class GetCfgSectionNameDialog(Toplevel):
name = self.name_ok()
if name:
self.result = name
self.grab_release()
self.destroy()
def Cancel(self, event=None):
self.result = ''
self.grab_release()
self.destroy()
if __name__ == '__main__':
import unittest
unittest.main('idlelib.idle_test.test_config_name', verbosity=2, exit=False)

View File

@ -15,6 +15,8 @@ class Dummy_name_dialog(object):
name = Var()
result = None
destroyed = False
def grab_release(self):
pass
def destroy(self):
self.destroyed = True

View File

@ -217,10 +217,12 @@ class GetKeysDialog(Toplevel):
def OK(self, event=None):
if self.advanced or self.KeysOK(): # doesn't check advanced string yet
self.result=self.keyString.get()
self.grab_release()
self.destroy()
def Cancel(self, event=None):
self.result=''
self.grab_release()
self.destroy()
def KeysOK(self):

View File

@ -39,7 +39,8 @@ class TextViewer(Toplevel):
self.textView.insert(0.0, text)
self.textView.config(state=DISABLED)
if modal:
self.is_modal = modal
if self.is_modal:
self.transient(parent)
self.grab_set()
self.wait_window()
@ -62,6 +63,8 @@ class TextViewer(Toplevel):
frameText.pack(side=TOP,expand=TRUE,fill=BOTH)
def Ok(self, event=None):
if self.is_modal:
self.grab_release()
self.destroy()

View File

@ -0,0 +1 @@
Fix unresponsiveness after closing certain windows and dialogs.