summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/keybindingDialog.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-05-25 22:44:05 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-05-25 22:44:05 (GMT)
commita2fc99eceae7b3dacc1e7280cc01c3b877ce55ab (patch)
treec6593cf545a51196117abd00623081007bf2ce67 /Lib/idlelib/keybindingDialog.py
parente1d54e5f8e63cf8a464a1c4c3d42e4f3a107b83f (diff)
downloadcpython-a2fc99eceae7b3dacc1e7280cc01c3b877ce55ab.zip
cpython-a2fc99eceae7b3dacc1e7280cc01c3b877ce55ab.tar.gz
cpython-a2fc99eceae7b3dacc1e7280cc01c3b877ce55ab.tar.bz2
Issue #21477: Idle htest: modify run; add more tests.
Patch by Saimadhav Heblikar. 2.7 version will follow.
Diffstat (limited to 'Lib/idlelib/keybindingDialog.py')
-rw-r--r--Lib/idlelib/keybindingDialog.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/Lib/idlelib/keybindingDialog.py b/Lib/idlelib/keybindingDialog.py
index db88cb4..e6438bf 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)