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
68d7336c
Kaydet (Commit)
68d7336c
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
facfc093
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
13 deletions
+31
-13
configDialog.py
Lib/idlelib/configDialog.py
+3
-2
keybindingDialog.py
Lib/idlelib/keybindingDialog.py
+28
-11
No files found.
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
68d7336c
...
...
@@ -595,8 +595,9 @@ class ConfigDialog(Toplevel):
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
currentKeySet
=
idleConf
.
CurrentKeys
()
currentKeySequences
=
idleConf
.
GetKeys
(
currentKeySet
)
.
values
()
newKeys
=
GetKeysDialog
(
self
,
'Get New Keys'
,
bindName
,
currentKeySequences
)
if
newKeys
.
result
:
#new keys were specified
self
.
listBindings
.
delete
(
listIndex
)
self
.
listBindings
.
insert
(
listIndex
,
bindName
+
' - '
+
newKeys
.
result
)
...
...
Lib/idlelib/keybindingDialog.py
Dosyayı görüntüle @
68d7336c
...
...
@@ -6,7 +6,13 @@ import tkMessageBox
import
string
,
os
class
GetKeysDialog
(
Toplevel
):
def
__init__
(
self
,
parent
,
title
,
action
):
def
__init__
(
self
,
parent
,
title
,
action
,
currentKeySequences
):
"""
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
"""
Toplevel
.
__init__
(
self
,
parent
)
self
.
configure
(
borderwidth
=
5
)
self
.
resizable
(
height
=
FALSE
,
width
=
FALSE
)
...
...
@@ -16,6 +22,7 @@ class GetKeysDialog(Toplevel):
self
.
protocol
(
"WM_DELETE_WINDOW"
,
self
.
Cancel
)
self
.
parent
=
parent
self
.
action
=
action
self
.
currentKeySequences
=
currentKeySequences
self
.
result
=
''
self
.
keyString
=
StringVar
(
self
)
self
.
keyString
.
set
(
''
)
...
...
@@ -191,6 +198,15 @@ class GetKeysDialog(Toplevel):
apply
(
self
.
listKeysFinal
.
insert
,
(
END
,)
+
keys
)
def
Ok
(
self
,
event
=
None
):
if
self
.
KeysOk
():
self
.
result
=
self
.
keyString
.
get
()
self
.
destroy
()
def
Cancel
(
self
,
event
=
None
):
self
.
result
=
''
self
.
destroy
()
def
KeysOk
(
self
):
#simple validity check
keysOk
=
1
...
...
@@ -198,6 +214,7 @@ class GetKeysDialog(Toplevel):
keys
.
strip
()
finalKey
=
self
.
listKeysFinal
.
get
(
ANCHOR
)
modifiers
=
self
.
GetModifiers
()
keySequence
=
keys
.
split
()
#make into a key sequence list for overlap check
if
not
keys
:
#no keys specified
tkMessageBox
.
showerror
(
title
=
'Key Sequence Error'
,
message
=
'No keys specified.'
)
...
...
@@ -206,23 +223,23 @@ class GetKeysDialog(Toplevel):
tkMessageBox
.
showerror
(
title
=
'Key Sequence Error'
,
message
=
'No final key specified.'
)
keysOk
=
0
elif
(
not
modifiers
)
and
(
finalKey
not
in
self
.
functionKeys
):
#modifier required if not a function key
tkMessageBox
.
showerror
(
title
=
'Key Sequence Error'
,
message
=
'No modifier key(s) 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
elif
keySequence
in
self
.
currentKeySequences
:
#keys combo already in use
tkMessageBox
.
showerror
(
title
=
'Key Sequence Error'
,
message
=
'This key combination is already in use.'
)
keysOk
=
0
return
keysOk
def
Ok
(
self
,
event
=
None
):
if
self
.
KeysOk
():
self
.
result
=
self
.
keyString
.
get
()
self
.
destroy
()
def
Cancel
(
self
,
event
=
None
):
self
.
result
=
''
self
.
destroy
()
if
__name__
==
'__main__'
:
#test the dialog
root
=
Tk
()
...
...
@@ -230,7 +247,7 @@ if __name__ == '__main__':
#import aboutDialog
#aboutDialog.AboutDialog(root,'About')
keySeq
=
''
dlg
=
GetKeysDialog
(
root
,
'Get Keys'
,
'find-again'
)
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