bpo-34120: fix text viewer to call grab_release() only when needed (GH-8616)

(cherry picked from commit dd74369cb7)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-08-02 00:52:22 -07:00 committed by GitHub
parent d9fc795487
commit 60586de02d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -83,7 +83,8 @@ class ViewWindow(Toplevel):
command=self.ok, takefocus=False) command=self.ok, takefocus=False)
self.viewframe.pack(side='top', expand=True, fill='both') self.viewframe.pack(side='top', expand=True, fill='both')
if modal: self.is_modal = modal
if self.is_modal:
self.transient(parent) self.transient(parent)
self.grab_set() self.grab_set()
if not _utest: if not _utest:
@ -91,7 +92,8 @@ class ViewWindow(Toplevel):
def ok(self, event=None): def ok(self, event=None):
"""Dismiss text viewer dialog.""" """Dismiss text viewer dialog."""
self.grab_release() if self.is_modal:
self.grab_release()
self.destroy() self.destroy()