Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
facfc093
Kaydet (Commit)
facfc093
authored
Ock 19, 2002
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
keybinding configuration
üst
d45a5434
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
72 deletions
+110
-72
config-keys.def
Lib/idlelib/config-keys.def
+0
-2
configDialog.py
Lib/idlelib/configDialog.py
+52
-33
configHandler.py
Lib/idlelib/configHandler.py
+0
-1
dynOptionMenuWidget.py
Lib/idlelib/dynOptionMenuWidget.py
+0
-6
keybindingDialog.py
Lib/idlelib/keybindingDialog.py
+58
-30
No files found.
Lib/idlelib/config-keys.def
Dosyayı görüntüle @
facfc093
...
...
@@ -13,7 +13,6 @@ beginning-of-line=<Control-a> <Home>
center-insert=<Control-l>
close-all-windows=<Control-q>
close-window=<Alt-F4>
dump-undo-state=<Control-backslash>
end-of-file=<Control-d>
python-docs=<F1>
python-context-help=<Shift-F1>
...
...
@@ -49,7 +48,6 @@ center-insert=<Control-l>
close-all-windows=<Control-x><Control-c>
close-window=<Control-x><Control-0> <Control-x><Key-0>
do-nothing=<Control-x>
dump-undo-state=<Control-backslash>
end-of-file=<Control-d>
history-next=<Alt-n> <Meta-n>
history-previous=<Alt-p> <Meta-p>
...
...
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
facfc093
...
...
@@ -3,10 +3,12 @@ configuration dialog
"""
from
Tkinter
import
*
import
tkMessageBox
,
tkColorChooser
,
tkFont
import
string
from
configHandler
import
idleConf
from
dynOptionMenuWidget
import
DynOptionMenu
from
tabpage
import
TabPageSet
from
keybindingDialog
import
GetKeysDialog
class
ConfigDialog
(
Toplevel
):
"""
...
...
@@ -354,20 +356,17 @@ class ConfigDialog(Toplevel):
frameKeySets
=
Frame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
)
#frameCustom
frameTarget
=
Frame
(
frameCustom
)
frameSet
=
Frame
(
frameCustom
)
labelCustomTitle
=
Label
(
frameCustom
,
text
=
'Set Custom Key Bindings'
)
labelTargetTitle
=
Label
(
frameTarget
,
text
=
'Action'
)
scrollTarget
=
Scrollbar
(
frameTarget
)
listTarget
=
Listbox
(
frameTarget
)
scrollTarget
.
config
(
command
=
listTarget
.
yview
)
listTarget
.
config
(
yscrollcommand
=
scrollTarget
.
set
)
labelKeyBindTitle
=
Label
(
frameSet
,
text
=
'Binding'
)
labelModifierTitle
=
Label
(
frameSet
,
text
=
'Modifier:'
)
checkCtrl
=
Checkbutton
(
frameSet
,
text
=
'Ctrl'
)
checkAlt
=
Checkbutton
(
frameSet
,
text
=
'Alt'
)
checkShift
=
Checkbutton
(
frameSet
,
text
=
'Shift'
)
labelKeyEntryTitle
=
Label
(
frameSet
,
text
=
'Key:'
)
entryKey
=
Entry
(
frameSet
,
width
=
4
)
labelTargetTitle
=
Label
(
frameTarget
,
text
=
'Action - Key(s)'
)
scrollTargetY
=
Scrollbar
(
frameTarget
)
scrollTargetX
=
Scrollbar
(
frameTarget
,
orient
=
HORIZONTAL
)
self
.
listBindings
=
Listbox
(
frameTarget
)
scrollTargetY
.
config
(
command
=
self
.
listBindings
.
yview
)
scrollTargetX
.
config
(
command
=
self
.
listBindings
.
xview
)
self
.
listBindings
.
config
(
yscrollcommand
=
scrollTargetY
.
set
)
self
.
listBindings
.
config
(
xscrollcommand
=
scrollTargetX
.
set
)
buttonNewKeys
=
Button
(
frameCustom
,
text
=
'Get New Keys for Selection'
,
command
=
self
.
GetNewKeys
)
buttonSaveCustomKeys
=
Button
(
frameCustom
,
text
=
'Save as a Custom Key Set'
)
#frameKeySets
labelKeysTitle
=
Label
(
frameKeySets
,
text
=
'Select a Key Set'
)
...
...
@@ -388,18 +387,15 @@ class ConfigDialog(Toplevel):
#frameCustom
labelCustomTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
buttonSaveCustomKeys
.
pack
(
side
=
BOTTOM
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
frameTarget
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
frameSet
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
labelTargetTitle
.
pack
(
side
=
TOP
,
anchor
=
W
)
scrollTarget
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
fill
=
Y
)
listTarget
.
pack
(
side
=
TOP
,
anchor
=
W
,
expand
=
TRUE
,
fill
=
BOTH
)
labelKeyBindTitle
.
pack
(
side
=
TOP
,
anchor
=
W
)
labelModifierTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
pady
=
5
)
checkCtrl
.
pack
(
side
=
TOP
,
anchor
=
W
)
checkAlt
.
pack
(
side
=
TOP
,
anchor
=
W
,
pady
=
2
)
checkShift
.
pack
(
side
=
TOP
,
anchor
=
W
)
labelKeyEntryTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
pady
=
5
)
entryKey
.
pack
(
side
=
TOP
,
anchor
=
W
)
buttonNewKeys
.
pack
(
side
=
BOTTOM
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
frameTarget
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
#frame target
frameTarget
.
columnconfigure
(
0
,
weight
=
1
)
frameTarget
.
rowconfigure
(
1
,
weight
=
1
)
labelTargetTitle
.
grid
(
row
=
0
,
column
=
0
,
columnspan
=
2
,
sticky
=
W
)
self
.
listBindings
.
grid
(
row
=
1
,
column
=
0
,
sticky
=
NSEW
)
scrollTargetY
.
grid
(
row
=
1
,
column
=
1
,
sticky
=
NS
)
scrollTargetX
.
grid
(
row
=
2
,
column
=
0
,
sticky
=
EW
)
#frameKeySets
labelKeysTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelTypeTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
...
...
@@ -432,7 +428,6 @@ class ConfigDialog(Toplevel):
value
=
1
,
command
=
self
.
SetKeysType
,
text
=
'in a Separate Process'
)
#frameWinSize
labelWinSizeTitle
=
Label
(
frameWinSize
,
text
=
'Initial Window Size'
)
buttonWinSizeSet
=
Button
(
frameWinSize
,
text
=
'Set to current window size'
)
labelWinWidthTitle
=
Label
(
frameWinSize
,
text
=
'Width'
)
entryWinWidth
=
Entry
(
frameWinSize
,
textvariable
=
self
.
winWidth
,
width
=
3
)
...
...
@@ -467,12 +462,11 @@ class ConfigDialog(Toplevel):
radioRunInternal
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioRunSeparate
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
#frameWinSize
labelWinSizeTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
buttonWinSizeSet
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelWinWidthTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
entryWinWidth
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelWinHeightTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
entryWinHeight
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelWinSizeTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
entryWinHeight
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
labelWinHeightTitle
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
pady
=
5
)
entryWinWidth
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
labelWinWidthTitle
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
pady
=
5
)
#frameExt
labelExtTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
frameExtSet
.
pack
(
side
=
RIGHT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
...
...
@@ -588,7 +582,31 @@ class ConfigDialog(Toplevel):
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'keys'
)
self
.
optMenuKeysBuiltin
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
SetKeysType
()
##load keyset element option menu
##load keyset element list
keySet
=
idleConf
.
GetKeys
(
currentOption
)
bindNames
=
keySet
.
keys
()
bindNames
.
sort
()
for
bindName
in
bindNames
:
key
=
string
.
join
(
keySet
[
bindName
])
#make key(s) into a string
bindName
=
bindName
[
2
:
-
2
]
#trim off the angle brackets
self
.
listBindings
.
insert
(
END
,
bindName
+
' - '
+
key
)
def
GetNewKeys
(
self
):
listIndex
=
self
.
listBindings
.
index
(
ANCHOR
)
binding
=
self
.
listBindings
.
get
(
listIndex
)
bindName
=
binding
.
split
()[
0
]
#first part, up to first space
newKeys
=
GetKeysDialog
(
self
,
'Get New Keys'
,
bindName
)
print
newKeys
.
result
if
newKeys
.
result
:
#new keys were specified
self
.
listBindings
.
delete
(
listIndex
)
self
.
listBindings
.
insert
(
listIndex
,
bindName
+
' - '
+
newKeys
.
result
)
self
.
listBindings
.
select_set
(
listIndex
)
def
LoadGeneralCfg
(
self
):
#initial window size
self
.
winWidth
.
set
(
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
'width'
))
self
.
winHeight
.
set
(
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
'height'
))
def
LoadConfigs
(
self
):
"""
...
...
@@ -604,6 +622,7 @@ class ConfigDialog(Toplevel):
self
.
LoadKeyCfg
()
### help page
### general page
self
.
LoadGeneralCfg
()
def
SaveConfigs
(
self
):
"""
...
...
Lib/idlelib/configHandler.py
Dosyayı görüntüle @
facfc093
...
...
@@ -257,7 +257,6 @@ class IdleConf:
'<<center-insert>>'
:
[
'<Control-l>'
],
'<<close-all-windows>>'
:
[
'<Control-q>'
],
'<<close-window>>'
:
[
'<Alt-F4>'
],
'<<dump-undo-state>>'
:
[
'<Control-backslash>'
],
'<<end-of-file>>'
:
[
'<Control-d>'
],
'<<python-docs>>'
:
[
'<F1>'
],
'<<python-context-help>>'
:
[
'<Shift-F1>'
],
...
...
Lib/idlelib/dynOptionMenuWidget.py
Dosyayı görüntüle @
facfc093
##---------------------------------------------------------------------------##
##
## idle - modified OptionMenu widget
## elguavas
##
##---------------------------------------------------------------------------##
"""
OptionMenu widget modified to allow dynamic menu reconfiguration
and setting of highlightthickness
...
...
Lib/idlelib/keybindingDialog.py
Dosyayı görüntüle @
facfc093
...
...
@@ -5,8 +5,8 @@ from Tkinter import *
import
tkMessageBox
import
string
,
os
class
Get
Accel
Dialog
(
Toplevel
):
def
__init__
(
self
,
parent
,
title
,
action
,
keySequenceStr
):
class
Get
Keys
Dialog
(
Toplevel
):
def
__init__
(
self
,
parent
,
title
,
action
):
Toplevel
.
__init__
(
self
,
parent
)
self
.
configure
(
borderwidth
=
5
)
self
.
resizable
(
height
=
FALSE
,
width
=
FALSE
)
...
...
@@ -16,7 +16,7 @@ class GetAccelDialog(Toplevel):
self
.
protocol
(
"WM_DELETE_WINDOW"
,
self
.
Cancel
)
self
.
parent
=
parent
self
.
action
=
action
self
.
keySequenceStr
=
keySequenceStr
self
.
result
=
''
self
.
keyString
=
StringVar
(
self
)
self
.
keyString
.
set
(
''
)
self
.
keyCtrl
=
StringVar
(
self
)
...
...
@@ -107,13 +107,12 @@ class GetAccelDialog(Toplevel):
command
=
self
.
listKeysFinal
.
yview
)
self
.
listKeysFinal
.
config
(
yscrollcommand
=
scrollKeysFinal
.
set
)
scrollKeysFinal
.
grid
(
row
=
0
,
column
=
5
,
rowspan
=
4
,
sticky
=
NS
)
self
.
buttonAddNew
=
Button
(
self
.
frameControlsBasic
,
text
=
'Accept Key Sequence'
,
width
=
25
,
command
=
None
)
self
.
buttonAddNew
.
grid
(
row
=
2
,
column
=
0
,
columnspan
=
4
)
self
.
buttonClearLast
=
Button
(
self
.
frameControlsBasic
,
text
=
'Clear Last Key Sequence'
,
width
=
25
,
command
=
self
.
ClearLastKeySeq
)
self
.
buttonClearLast
.
grid
(
row
=
3
,
column
=
0
,
columnspan
=
4
)
# self.buttonAddNew=Button(self.frameControlsBasic,
# text='Accept Key Sequence',width=25,command=None)
# self.buttonAddNew.grid(row=2,column=0,columnspan=4)
self
.
buttonClear
=
Button
(
self
.
frameControlsBasic
,
text
=
'Clear Keys'
,
command
=
self
.
ClearKeySeq
)
self
.
buttonClear
.
grid
(
row
=
2
,
column
=
0
,
columnspan
=
4
)
labelTitleAdvanced
=
Label
(
self
.
frameKeySeqAdvanced
,
justify
=
LEFT
,
text
=
"Enter new binding(s) for '"
+
self
.
action
+
"' :
\n
"
+
"(will not be checked for validity)"
)
...
...
@@ -133,11 +132,13 @@ class GetAccelDialog(Toplevel):
def
ToggleLevel
(
self
):
if
self
.
buttonLevel
.
cget
(
'text'
)[:
8
]
==
'Advanced'
:
self
.
ClearKeySeq
()
self
.
buttonLevel
.
config
(
text
=
'<< Basic Key Binding Entry'
)
self
.
frameKeySeqAdvanced
.
lift
()
self
.
frameHelpAdvanced
.
lift
()
self
.
entryKeysAdvanced
.
focus_set
()
else
:
self
.
ClearKeySeq
()
self
.
buttonLevel
.
config
(
text
=
'Advanced Key Binding Entry >>'
)
self
.
frameKeySeqBasic
.
lift
()
self
.
frameControlsBasic
.
lift
()
...
...
@@ -147,8 +148,7 @@ class GetAccelDialog(Toplevel):
def
BuildKeyString
(
self
):
keyList
=
[]
modifiers
=
self
.
GetModifiers
(
self
.
keyCtrl
.
get
(),
self
.
keyAlt
.
get
(),
self
.
keyShift
.
get
())
modifiers
=
self
.
GetModifiers
()
finalKey
=
self
.
listKeysFinal
.
get
(
ANCHOR
)
if
modifiers
:
modifiers
[
0
]
=
'<'
+
modifiers
[
0
]
keyList
=
keyList
+
modifiers
...
...
@@ -160,39 +160,67 @@ class GetAccelDialog(Toplevel):
keyStr
=
string
.
join
(
keyList
,
'-'
)
self
.
keyString
.
set
(
keyStr
)
# if (finalKey not in self.functionKeys) and (not modifiers):
# tkMessageBox.showerror(title='Key Binding Error',
# message='At least one modifier key should be specified.')
# return
def
GetModifiers
(
self
,
ctrl
,
alt
,
shift
):
def
GetModifiers
(
self
):
modList
=
[]
ctrl
=
self
.
keyCtrl
.
get
()
alt
=
self
.
keyAlt
.
get
()
shift
=
self
.
keyShift
.
get
()
if
ctrl
:
modList
.
append
(
ctrl
)
if
alt
:
modList
.
append
(
alt
)
if
shift
:
modList
.
append
(
shift
)
return
modList
def
ClearLastKeySeq
(
self
):
pass
def
ClearKeySeq
(
self
):
self
.
listKeysFinal
.
select_clear
(
0
,
END
)
self
.
listKeysFinal
.
yview
(
MOVETO
,
'0.0'
)
self
.
keyCtrl
.
set
(
''
)
self
.
keyAlt
.
set
(
''
),
self
.
keyShift
.
set
(
''
)
self
.
keyString
.
set
(
''
)
def
LoadFinalKeyList
(
self
):
#
make a tuple of most of the useful common 'final' key
s
#
these tuples are also available for use in validity check
s
self
.
functionKeys
=
(
'F1'
,
'F2'
,
'F2'
,
'F4'
,
'F5'
,
'F6'
,
'F7'
,
'F8'
,
'F9'
,
'F10'
,
'F11'
,
'F12'
)
keys
=
(
tuple
(
string
.
ascii_lowercase
+
string
.
digits
+
'~!@#
%
^&*()_-+={}[]|;:,./?'
)
+
(
'tab'
,
'space'
)
+
self
.
functionKeys
)
self
.
punctuationKeys
=
tuple
(
'~!@#
%
^&*()_-+={}[]|;:,./?'
)
self
.
specialKeys
=
(
'tab'
,
'space'
)
self
.
alphanumKeys
=
tuple
(
string
.
ascii_lowercase
+
string
.
digits
)
#make a tuple of most of the useful common 'final' keys
keys
=
(
self
.
alphanumKeys
+
self
.
punctuationKeys
+
self
.
specialKeys
+
self
.
functionKeys
)
apply
(
self
.
listKeysFinal
.
insert
,
(
END
,)
+
keys
)
def
KeysOk
(
self
):
#simple validity check
keysOk
=
1
keys
=
self
.
keyString
.
get
()
keys
.
strip
()
finalKey
=
self
.
listKeysFinal
.
get
(
ANCHOR
)
modifiers
=
self
.
GetModifiers
()
if
not
keys
:
#no keys specified
tkMessageBox
.
showerror
(
title
=
'Key Sequence Error'
,
message
=
'No keys specified.'
)
keysOk
=
0
elif
not
keys
.
endswith
(
'>'
):
#no final key specified
tkMessageBox
.
showerror
(
title
=
'Key Sequence Error'
,
message
=
'No final key specified.'
)
keysOk
=
0
elif
(
modifiers
==
[
'Shift'
])
and
(
finalKey
not
in
self
.
functionKeys
):
#shift alone is only a useful modifier with a function key
tkMessageBox
.
showerror
(
title
=
'Key Sequence Error'
,
message
=
'Shift alone is only a useful modifier '
+
'when used with a function key.'
)
keysOk
=
0
return
keysOk
def
Ok
(
self
,
event
=
None
):
if
self
.
KeysOk
():
self
.
keySequenceStr
=
self
.
keyDisplay
.
get
()
self
.
result
=
self
.
keyString
.
get
()
self
.
destroy
()
def
Cancel
(
self
,
event
=
None
):
self
.
keySequenceStr
=
''
self
.
result
=
''
self
.
destroy
()
if
__name__
==
'__main__'
:
...
...
@@ -202,7 +230,7 @@ if __name__ == '__main__':
#import aboutDialog
#aboutDialog.AboutDialog(root,'About')
keySeq
=
''
GetAccelDialog
(
root
,
'Get Keys'
,
'find-again'
,
keySeq
)
print
keySeq
dlg
=
GetKeysDialog
(
root
,
'Get Keys'
,
'find-again'
)
print
dlg
.
result
Button
(
root
,
text
=
'Dialog'
,
command
=
run
)
.
pack
()
root
.
mainloop
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment