diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-24 22:48:03 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-24 22:48:03 (GMT) |
commit | 62012fc719818b6087b01c93fcc1cd0d2b4d8932 (patch) | |
tree | 5104802fce85d89b4f2d186d38ec0b579f486237 /Lib/idlelib/configHelpSourceEdit.py | |
parent | d383bafa556de686be4898d6544ce998a0812532 (diff) | |
download | cpython-62012fc719818b6087b01c93fcc1cd0d2b4d8932.zip cpython-62012fc719818b6087b01c93fcc1cd0d2b4d8932.tar.gz cpython-62012fc719818b6087b01c93fcc1cd0d2b4d8932.tar.bz2 |
Issue #21477: Idle htest: merge and modify run and runall; add many tests.
Patch by Saimadhav Heblikar
Diffstat (limited to 'Lib/idlelib/configHelpSourceEdit.py')
-rw-r--r-- | Lib/idlelib/configHelpSourceEdit.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/Lib/idlelib/configHelpSourceEdit.py b/Lib/idlelib/configHelpSourceEdit.py index 6611621..5816449 100644 --- a/Lib/idlelib/configHelpSourceEdit.py +++ b/Lib/idlelib/configHelpSourceEdit.py @@ -8,13 +8,14 @@ import tkMessageBox import tkFileDialog class GetHelpSourceDialog(Toplevel): - def __init__(self, parent, title, menuItem='', filePath=''): + def __init__(self, parent, title, menuItem='', filePath='', _htest=False): """Get menu entry and url/ local file location for Additional Help User selects a name for the Help resource and provides a web url or a local file as its source. The user can enter a url or browse for the file. + _htest - bool, change box location when running htest """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) @@ -31,12 +32,14 @@ class GetHelpSourceDialog(Toplevel): self.withdraw() #hide while setting geometry #needs to be done here so that the winfo_reqwidth is valid self.update_idletasks() - #centre dialog over parent: - self.geometry("+%d+%d" % - ((parent.winfo_rootx() + ((parent.winfo_width()/2) - -(self.winfo_reqwidth()/2)), - parent.winfo_rooty() + ((parent.winfo_height()/2) - -(self.winfo_reqheight()/2))))) + #centre dialog over parent. below parent if running htest. + self.geometry( + "+%d+%d" % ( + parent.winfo_rootx() + + (parent.winfo_width()/2 - self.winfo_reqwidth()/2), + parent.winfo_rooty() + + ((parent.winfo_height()/2 - self.winfo_reqheight()/2) + if not _htest else 150))) self.deiconify() #geometry set, unhide self.bind('<Return>', self.Ok) self.wait_window() @@ -159,11 +162,5 @@ class GetHelpSourceDialog(Toplevel): self.destroy() if __name__ == '__main__': - #test the dialog - root = Tk() - def run(): - keySeq = '' - dlg = GetHelpSourceDialog(root, 'Get Help Source') - print dlg.result - Button(root,text='Dialog', command=run).pack() - root.mainloop() + from idlelib.idle_test.htest import run + run(GetHelpSourceDialog) |