◐ Shell
reader mode source ↗
Skip to content
Merged
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
11 changes: 6 additions & 5 deletions Lib/idlelib/idle_test/test_searchbase.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

import unittest
from test.support import requires
from tkinter import Tk
from tkinter.ttk import Frame
from idlelib import searchengine as se
from idlelib import searchbase as sdb
Expand Down Expand Up @@ -47,14 +47,15 @@ def test_open_and_close(self):
# 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')
self.assertEqual(self.dialog.top.state(), 'normal')
self.dialog.close()
self.assertEqual(self.dialog.top.state(), 'withdrawn')

self.dialog.open('text', searchphrase="hello")
self.assertEqual(self.dialog.ent.get(), 'hello')
self.dialog.close()

Expand Down
2 changes: 2 additions & 0 deletions Lib/idlelib/searchbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def open(self, text, searchphrase=None):
else:
self.top.deiconify()
self.top.tkraise()
if searchphrase:
self.ent.delete(0,"end")
self.ent.insert("end",searchphrase)
Expand All @@ -66,6 +67,7 @@ def close(self, event=None):
"Put dialog away for later use."
if self.top:
self.top.grab_release()
self.top.withdraw()

def create_widgets(self):
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Toggle all file notes Toggle all file annotations