Commit 1b57ab5c authored by Tal Einat's avatar Tal Einat Committed by GitHub

[2.7] bpo-37177: make IDLE's search dialogs transient (GH-13869)

This avoids the search dialogs being hidden behind the editor window.

(cherry picked from commit 554450fb)
parent 20093b3a
......@@ -52,6 +52,7 @@ class SearchDialogBase:
else:
self.top.deiconify()
self.top.tkraise()
self.top.transient(text.winfo_toplevel())
if searchphrase:
self.ent.delete(0,"end")
self.ent.insert("end",searchphrase)
......@@ -64,6 +65,7 @@ class SearchDialogBase:
"Put dialog away for later use."
if self.top:
self.top.grab_release()
self.top.transient('')
self.top.withdraw()
def create_widgets(self):
......
......@@ -6,7 +6,7 @@ testing skipping of suite when self.needwrapbutton is false.
'''
import unittest
from test.test_support import requires
from Tkinter import Tk, Toplevel, Frame ## BooleanVar, StringVar
from Tkinter import Text, Tk, Toplevel, Frame ## BooleanVar, StringVar
from idlelib import SearchEngine as se
from idlelib import SearchDialogBase as sdb
from idlelib.idle_test.mock_idle import Func
......@@ -45,14 +45,15 @@ class SearchDialogBaseTest(unittest.TestCase):
# open calls create_widgets, which needs default_command
self.dialog.default_command = None
# Since text parameter of .open is not used in base class,
# pass dummy 'text' instead of tk.Text().
self.dialog.open('text')
toplevel = Toplevel(self.root)
self.addCleanup(toplevel.destroy)
text = Text(toplevel)
self.dialog.open(text)
self.assertEqual(self.dialog.top.state(), 'normal')
self.dialog.close()
self.assertEqual(self.dialog.top.state(), 'withdrawn')
self.dialog.open('text', searchphrase="hello")
self.dialog.open(text, searchphrase="hello")
self.assertEqual(self.dialog.ent.get(), 'hello')
self.dialog.close()
......
Properly 'attach' search dialogs to their main window so that they behave
like other dialogs and do not get hidden behind their main window.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment