diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2017-08-27 16:39:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-27 16:39:41 -0400 |
commit | 3457f428964d0fd6ab601272ead276a9bf8b1eaf (patch) | |
tree | 8effc4fc55e8f90e113a868fe3d7bb03c0e35351 /Lib/idlelib/configdialog.py | |
parent | 7028e5986fceeeb73dffb5d5bf8f03d88f73b63d (diff) | |
download | cpython-git-3457f428964d0fd6ab601272ead276a9bf8b1eaf.tar.gz |
bpo-31287: IDLE - do not alter tkinter.messagebox in configdialog tests. (#3220)
Diffstat (limited to 'Lib/idlelib/configdialog.py')
-rw-r--r-- | Lib/idlelib/configdialog.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index ff7b638b51..8afc9e6d69 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -18,7 +18,7 @@ from tkinter.ttk import (Button, Checkbutton, Entry, Frame, Label, LabelFrame, Notebook, Radiobutton, Scrollbar, Style) import tkinter.colorchooser as tkColorChooser import tkinter.font as tkFont -import tkinter.messagebox as tkMessageBox +from tkinter import messagebox from idlelib.config import idleConf, ConfigChanges from idlelib.config_key import GetKeysDialog @@ -1227,6 +1227,10 @@ class HighPage(Frame): value = theme[element] idleConf.userCfg['highlight'].SetOption(theme_name, element, value) + def askyesno(self, *args, **kwargs): + # Make testing easier. Could change implementation. + messagebox.askyesno(*args, **kwargs) + def delete_custom(self): """Handle event to delete custom theme. @@ -1251,7 +1255,7 @@ class HighPage(Frame): """ theme_name = self.custom_name.get() delmsg = 'Are you sure you wish to delete the theme %r ?' - if not tkMessageBox.askyesno( + if not self.askyesno( 'Delete Theme', delmsg % theme_name, parent=self): return self.cd.deactivate_current_config() @@ -1669,6 +1673,10 @@ class KeysPage(Frame): value = keyset[event] idleConf.userCfg['keys'].SetOption(keyset_name, event, value) + def askyesno(self, *args, **kwargs): + # Make testing easier. Could change implementation. + messagebox.askyesno(*args, **kwargs) + def delete_custom_keys(self): """Handle event to delete a custom key set. @@ -1678,7 +1686,7 @@ class KeysPage(Frame): """ keyset_name = self.custom_name.get() delmsg = 'Are you sure you wish to delete the key set %r ?' - if not tkMessageBox.askyesno( + if not self.askyesno( 'Delete Key Set', delmsg % keyset_name, parent=self): return self.cd.deactivate_current_config() |