diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-27 06:47:38 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-05-27 06:47:38 (GMT) |
commit | 985ef280545912b1a76d1980c27a33e0ee7eaf0a (patch) | |
tree | eeaaaa1d96110340130d89095781a23d51042868 /Lib/idlelib/keybindingDialog.py | |
parent | 7e19b60daeb18c3295dd19ce53bb55328bc5cb3c (diff) | |
download | cpython-985ef280545912b1a76d1980c27a33e0ee7eaf0a.zip cpython-985ef280545912b1a76d1980c27a33e0ee7eaf0a.tar.gz cpython-985ef280545912b1a76d1980c27a33e0ee7eaf0a.tar.bz2 |
Issue #21477: Idle htest: modify run; add more tests.
Patch by Saimadhav Heblikar. 2.7 backport of 90829, d7eea8f608c2.
Diffstat (limited to 'Lib/idlelib/keybindingDialog.py')
-rw-r--r-- | Lib/idlelib/keybindingDialog.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py index 58d7ed5..4d32ca9 100644 --- a/Lib/idlelib/keybindingDialog.py +++ b/Lib/idlelib/keybindingDialog.py @@ -7,12 +7,13 @@ import string import sys class GetKeysDialog(Toplevel): - def __init__(self,parent,title,action,currentKeySequences): + def __init__(self,parent,title,action,currentKeySequences,_htest=False): """ action - string, the name of the virtual event these keys will be mapped to currentKeys - list, a list of all key sequence lists currently mapped to virtual events, for overlap checking + _htest - bool, change box location when running htest """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) @@ -38,11 +39,14 @@ class GetKeysDialog(Toplevel): self.LoadFinalKeyList() self.withdraw() #hide while setting geometry self.update_idletasks() - 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 + 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) + ) ) #centre dialog over parent (or below htest box) self.deiconify() #geometry set, unhide self.wait_window() @@ -258,11 +262,5 @@ class GetKeysDialog(Toplevel): return keysOK if __name__ == '__main__': - #test the dialog - root=Tk() - def run(): - keySeq='' - dlg=GetKeysDialog(root,'Get Keys','find-again',[]) - print dlg.result - Button(root,text='Dialog',command=run).pack() - root.mainloop() + from idlelib.idle_test.htest import run + run(GetKeysDialog) |