@@ -13,9 +13,10 @@ class AboutDialog(Toplevel):
1313 """Modal about dialog for idle
1414
1515 """
16- def __init__ (self , parent , title , _htest = False ):
16+ def __init__ (self , parent , title , _htest = False , _utest = False ):
1717 """
1818 _htest - bool, change box location when running htest
19+ _utest - bool, don't wait_window when running unittest
1920 """
2021 Toplevel .__init__ (self , parent )
2122 self .configure (borderwidth = 5 )
@@ -35,7 +36,12 @@ def __init__(self, parent, title, _htest=False):
3536 self .buttonOk .focus_set ()
3637 self .bind ('<Return>' ,self .Ok ) #dismiss dialog
3738 self .bind ('<Escape>' ,self .Ok ) #dismiss dialog
38- self .wait_window ()
39+ self ._current_textview = None
40+ self ._utest = _utest
41+
42+ if not _utest :
43+ self .deiconify ()
44+ self .wait_window ()
3945
4046 def CreateWidgets (self ):
4147 release = version [:version .index (' ' )]
@@ -80,18 +86,18 @@ def CreateWidgets(self):
8086 labelTkVer .grid (row = 9 , column = 1 , sticky = W , padx = 2 , pady = 0 )
8187 py_button_f = Frame (frameBg , bg = self .bg )
8288 py_button_f .grid (row = 10 , column = 0 , columnspan = 2 , sticky = NSEW )
83- buttonLicense = Button (py_button_f , text = 'License' , width = 8 ,
84- highlightbackground = self .bg ,
85- command = self .ShowLicense )
86- buttonLicense .pack (side = LEFT , padx = 10 , pady = 10 )
87- buttonCopyright = Button (py_button_f , text = 'Copyright' , width = 8 ,
88- highlightbackground = self .bg ,
89- command = self .ShowCopyright )
90- buttonCopyright .pack (side = LEFT , padx = 10 , pady = 10 )
91- buttonCredits = Button (py_button_f , text = 'Credits' , width = 8 ,
92- highlightbackground = self .bg ,
93- command = self .ShowPythonCredits )
94- buttonCredits .pack (side = LEFT , padx = 10 , pady = 10 )
89+ self . buttonLicense = Button (py_button_f , text = 'License' , width = 8 ,
90+ highlightbackground = self .bg ,
91+ command = self .ShowLicense )
92+ self . buttonLicense .pack (side = LEFT , padx = 10 , pady = 10 )
93+ self . buttonCopyright = Button (py_button_f , text = 'Copyright' , width = 8 ,
94+ highlightbackground = self .bg ,
95+ command = self .ShowCopyright )
96+ self . buttonCopyright .pack (side = LEFT , padx = 10 , pady = 10 )
97+ self . buttonCredits = Button (py_button_f , text = 'Credits' , width = 8 ,
98+ highlightbackground = self .bg ,
99+ command = self .ShowPythonCredits )
100+ self . buttonCredits .pack (side = LEFT , padx = 10 , pady = 10 )
95101 Frame (frameBg , borderwidth = 1 , relief = SUNKEN ,
96102 height = 2 , bg = self .bg ).grid (row = 11 , column = 0 , sticky = EW ,
97103 columnspan = 3 , padx = 5 , pady = 5 )
@@ -100,18 +106,18 @@ def CreateWidgets(self):
100106 idle_v .grid (row = 12 , column = 0 , sticky = W , padx = 10 , pady = 0 )
101107 idle_button_f = Frame (frameBg , bg = self .bg )
102108 idle_button_f .grid (row = 13 , column = 0 , columnspan = 3 , sticky = NSEW )
103- idle_about_b = Button (idle_button_f , text = 'README' , width = 8 ,
104- highlightbackground = self .bg ,
105- command = self .ShowIDLEAbout )
106- idle_about_b .pack (side = LEFT , padx = 10 , pady = 10 )
107- idle_news_b = Button (idle_button_f , text = 'NEWS' , width = 8 ,
108- highlightbackground = self .bg ,
109- command = self .ShowIDLENEWS )
110- idle_news_b .pack (side = LEFT , padx = 10 , pady = 10 )
111- idle_credits_b = Button (idle_button_f , text = 'Credits' , width = 8 ,
112- highlightbackground = self .bg ,
113- command = self .ShowIDLECredits )
114- idle_credits_b .pack (side = LEFT , padx = 10 , pady = 10 )
109+ self . idle_about_b = Button (idle_button_f , text = 'README' , width = 8 ,
110+ highlightbackground = self .bg ,
111+ command = self .ShowIDLEAbout )
112+ self . idle_about_b .pack (side = LEFT , padx = 10 , pady = 10 )
113+ self . idle_news_b = Button (idle_button_f , text = 'NEWS' , width = 8 ,
114+ highlightbackground = self .bg ,
115+ command = self .ShowIDLENEWS )
116+ self . idle_news_b .pack (side = LEFT , padx = 10 , pady = 10 )
117+ self . idle_credits_b = Button (idle_button_f , text = 'Credits' , width = 8 ,
118+ highlightbackground = self .bg ,
119+ command = self .ShowIDLECredits )
120+ self . idle_credits_b .pack (side = LEFT , padx = 10 , pady = 10 )
115121
116122 # License, et all, are of type _sitebuiltins._Printer
117123 def ShowLicense (self ):
@@ -137,11 +143,13 @@ def ShowIDLENEWS(self):
137143 def display_printer_text (self , title , printer ):
138144 printer ._Printer__setup ()
139145 text = '\n ' .join (printer ._Printer__lines )
140- textview .view_text (self , title , text )
146+ self ._current_textview = textview .view_text (
147+ self , title , text , _utest = self ._utest )
141148
142149 def display_file_text (self , title , filename , encoding = None ):
143150 fn = os .path .join (os .path .abspath (os .path .dirname (__file__ )), filename )
144- textview .view_file (self , title , fn , encoding )
151+ self ._current_textview = textview .view_file (
152+ self , title , fn , encoding , _utest = self ._utest )
145153
146154 def Ok (self , event = None ):
147155 self .destroy ()
0 commit comments