@@ -13,9 +13,10 @@ class AboutDialog(Toplevel):
13
13
"""Modal about dialog for idle
14
14
15
15
"""
16
- def __init__ (self , parent , title , _htest = False ):
16
+ def __init__ (self , parent , title , _htest = False , _utest = False ):
17
17
"""
18
18
_htest - bool, change box location when running htest
19
+ _utest - bool, don't wait_window when running unittest
19
20
"""
20
21
Toplevel .__init__ (self , parent )
21
22
self .configure (borderwidth = 5 )
@@ -35,7 +36,12 @@ def __init__(self, parent, title, _htest=False):
35
36
self .buttonOk .focus_set ()
36
37
self .bind ('<Return>' ,self .Ok ) #dismiss dialog
37
38
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 ()
39
45
40
46
def CreateWidgets (self ):
41
47
release = version [:version .index (' ' )]
@@ -80,18 +86,18 @@ def CreateWidgets(self):
80
86
labelTkVer .grid (row = 9 , column = 1 , sticky = W , padx = 2 , pady = 0 )
81
87
py_button_f = Frame (frameBg , bg = self .bg )
82
88
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 , <
8000
span class="pl-s1">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 )
95
101
Frame (frameBg , borderwidth = 1 , relief = SUNKEN ,
96
102
height = 2 , bg = self .bg ).grid (row = 11 , column = 0 , sticky = EW ,
97
103
columnspan = 3 , padx = 5 , pady = 5 )
@@ -100,18 +106,18 @@ def CreateWidgets(self):
100
106
idle_v .grid (row = 12 , column = 0 , sticky = W , padx = 10 , pady = 0 )
101
107
idle_button_f = Frame (frameBg , bg = self .bg )
102
108
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 )
115
121
116
122
# License, et all, are of type _sitebuiltins._Printer
117
123
def ShowLicense (self ):
@@ -137,11 +143,13 @@ def ShowIDLENEWS(self):
137
143
def display_printer_text (self , title , printer ):
138
144
printer ._Printer__setup ()
139
145
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 )
141
148
142
149
def display_file_text (self , title , filename , encoding = None ):
143
150
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 )
145
153
146
154
def Ok (self , event = None ):
147
155
self .destroy ()
0 commit comments