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
a498af26
Kaydet (Commit)
a498af26
authored
Şub 01, 2002
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
more work on configuration saving
üst
11bd9944
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
34 deletions
+57
-34
config-keys.def
Lib/idlelib/config-keys.def
+6
-6
configDialog.py
Lib/idlelib/configDialog.py
+23
-24
configHandler.py
Lib/idlelib/configHandler.py
+28
-4
No files found.
Lib/idlelib/config-keys.def
Dosyayı görüntüle @
a498af26
...
@@ -6,9 +6,9 @@
...
@@ -6,9 +6,9 @@
# single 'emacs style' multi-keystoke binding.
# single 'emacs style' multi-keystoke binding.
[IDLE Classic Windows]
[IDLE Classic Windows]
C
opy=<Control-c> <Control-C>
c
opy=<Control-c> <Control-C>
C
ut=<Control-x> <Control-X>
c
ut=<Control-x> <Control-X>
P
aste=<Control-v> <Control-V>
p
aste=<Control-v> <Control-V>
beginning-of-line=<Control-a> <Home>
beginning-of-line=<Control-a> <Home>
center-insert=<Control-l>
center-insert=<Control-l>
close-all-windows=<Control-q>
close-all-windows=<Control-q>
...
@@ -40,9 +40,9 @@ replace=<Control-h>
...
@@ -40,9 +40,9 @@ replace=<Control-h>
goto-line=<Alt-g>
goto-line=<Alt-g>
[IDLE Classic Unix]
[IDLE Classic Unix]
C
opy=<Alt-w> <Meta-w>
c
opy=<Alt-w> <Meta-w>
C
ut=<Control-w>
c
ut=<Control-w>
P
aste=<Control-y>
p
aste=<Control-y>
beginning-of-line=<Control-a> <Home>
beginning-of-line=<Control-a> <Home>
center-insert=<Control-l>
center-insert=<Control-l>
close-all-windows=<Control-x><Control-c>
close-all-windows=<Control-x><Control-c>
...
...
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
a498af26
...
@@ -36,16 +36,7 @@ class ConfigDialog(Toplevel):
...
@@ -36,16 +36,7 @@ class ConfigDialog(Toplevel):
'Shell Normal Text'
:(
'console'
,
'09'
),
'Shell Normal Text'
:(
'console'
,
'09'
),
'Shell Stdout Text'
:(
'stdout'
,
'10'
),
'Shell Stdout Text'
:(
'stdout'
,
'10'
),
'Shell Stderr Text'
:(
'stderr'
,
'11'
)}
'Shell Stderr Text'
:(
'stderr'
,
'11'
)}
#changedItems. When any config item is changed in this dialog, an entry
self
.
ResetChangedItems
()
#load initial values in changed items dict
#should be made in the relevant section (config type) of this
#dictionary. The key should be the config file section name and the
#value a dictionary, whose key:value pairs are item=value pairs for
#that config file section.
self
.
changedItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
# #defaultItems. This dictionary is loaded with the values from the
# #default config files. It is used for comparison with self.changedItems
# #to decide which changed items actually need saving.
# self.defaultItems=self.GetDefaultItems()
self
.
CreateWidgets
()
self
.
CreateWidgets
()
self
.
resizable
(
height
=
FALSE
,
width
=
FALSE
)
self
.
resizable
(
height
=
FALSE
,
width
=
FALSE
)
self
.
transient
(
parent
)
self
.
transient
(
parent
)
...
@@ -444,15 +435,19 @@ class ConfigDialog(Toplevel):
...
@@ -444,15 +435,19 @@ class ConfigDialog(Toplevel):
theme
=
self
.
customTheme
.
get
()
theme
=
self
.
customTheme
.
get
()
element
=
self
.
themeElements
[
self
.
highlightTarget
.
get
()][
0
]
element
=
self
.
themeElements
[
self
.
highlightTarget
.
get
()][
0
]
self
.
AddChangedItem
(
'highlight'
,
theme
,
element
,
value
)
self
.
AddChangedItem
(
'highlight'
,
theme
,
element
,
value
)
print
params
def
VarChanged_keyBinding
(
self
,
*
params
):
def
VarChanged_keyBinding
(
self
,
*
params
):
value
=
self
.
keyBinding
.
get
()
value
=
self
.
keyBinding
.
get
()
keySet
=
self
.
customKeys
.
get
()
keySet
=
self
.
customKeys
.
get
()
event
=
self
.
listBindings
.
get
(
ANCHOR
)
.
split
()[
0
]
event
=
self
.
listBindings
.
get
(
ANCHOR
)
.
split
()[
0
]
self
.
AddChangedItem
(
'keys'
,
keySet
,
event
,
value
)
if
idleConf
.
IsCoreBinding
(
event
):
print
params
#this is a core keybinding
self
.
AddChangedItem
(
'keys'
,
keySet
,
event
,
value
)
else
:
#this is an extension key binding
extName
=
idleConf
.
GetExtnNameForEvent
(
event
)
extKeybindSection
=
extName
+
'_cfgBindings'
self
.
AddChangedItem
(
'extensions'
,
extKeybindSection
,
event
,
value
)
def
VarChanged_winWidth
(
self
,
*
params
):
def
VarChanged_winWidth
(
self
,
*
params
):
value
=
self
.
winWidth
.
get
()
value
=
self
.
winWidth
.
get
()
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'width'
,
value
)
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'width'
,
value
)
...
@@ -471,12 +466,19 @@ class ConfigDialog(Toplevel):
...
@@ -471,12 +466,19 @@ class ConfigDialog(Toplevel):
extension
=
self
.
listExt
.
get
(
ANCHOR
)
extension
=
self
.
listExt
.
get
(
ANCHOR
)
self
.
AddChangedItem
(
'extensions'
,
extension
,
'enabled'
,
value
)
self
.
AddChangedItem
(
'extensions'
,
extension
,
'enabled'
,
value
)
def
ResetChangedItems
(
self
):
#changedItems. When any config item is changed in this dialog, an entry
#should be made in the relevant section (config type) of this
#dictionary. The key should be the config file section name and the
#value a dictionary, whose key:value pairs are item=value pairs for
#that config file section.
self
.
changedItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
def
AddChangedItem
(
self
,
type
,
section
,
item
,
value
):
def
AddChangedItem
(
self
,
type
,
section
,
item
,
value
):
value
=
str
(
value
)
#make sure we use a string
value
=
str
(
value
)
#make sure we use a string
if
not
self
.
changedItems
[
type
]
.
has_key
(
section
):
if
not
self
.
changedItems
[
type
]
.
has_key
(
section
):
self
.
changedItems
[
type
][
section
]
=
{}
self
.
changedItems
[
type
][
section
]
=
{}
self
.
changedItems
[
type
][
section
][
item
]
=
value
self
.
changedItems
[
type
][
section
][
item
]
=
value
print
type
,
section
,
item
,
value
def
GetDefaultItems
(
self
):
def
GetDefaultItems
(
self
):
dItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
dItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
...
@@ -552,18 +554,17 @@ class ConfigDialog(Toplevel):
...
@@ -552,18 +554,17 @@ class ConfigDialog(Toplevel):
keySetName
=
self
.
builtinKeys
.
get
()
keySetName
=
self
.
builtinKeys
.
get
()
else
:
else
:
keySetName
=
self
.
customKeys
.
get
()
keySetName
=
self
.
customKeys
.
get
()
prevKeySet
=
idleConf
.
GetKeySet
(
keySetName
)
#add the new key set to changedItems
#add the new key set to changedItems
for
event
in
prevKeySet
.
keys
():
prevCoreKeys
=
idleConf
.
GetCoreKeys
(
keySetName
)
for
event
in
prevCoreKeys
.
keys
():
#add core key set to changed items
eventName
=
event
[
2
:
-
2
]
#trim off the angle brackets
eventName
=
event
[
2
:
-
2
]
#trim off the angle brackets
self
.
AddChangedItem
(
'keys'
,
newKeySetName
,
eventName
,
self
.
AddChangedItem
(
'keys'
,
newKeySetName
,
eventName
,
prevKeySet
[
event
]
)
string
.
join
(
prevCoreKeys
[
event
])
)
#change gui over to the new key set
#change gui over to the new key set
customKeyList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
customKeyList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
for
newName
in
self
.
changedItems
[
'keys'
]
.
keys
():
for
newName
in
self
.
changedItems
[
'keys'
]
.
keys
():
if
newName
not
in
customKeyList
:
customKeyList
.
append
(
newName
)
if
newName
not
in
customKeyList
:
customKeyList
.
append
(
newName
)
customKeyList
.
sort
()
customKeyList
.
sort
()
print
newKeySetName
,
customKeyList
,
self
.
changedItems
[
'keys'
][
newKeySetName
]
self
.
optMenuKeysCustom
.
SetMenu
(
customKeyList
,
newKeySetName
)
self
.
optMenuKeysCustom
.
SetMenu
(
customKeyList
,
newKeySetName
)
self
.
keysAreDefault
.
set
(
0
)
self
.
keysAreDefault
.
set
(
0
)
self
.
SetKeysType
()
self
.
SetKeysType
()
...
@@ -610,7 +611,6 @@ class ConfigDialog(Toplevel):
...
@@ -610,7 +611,6 @@ class ConfigDialog(Toplevel):
for
newName
in
self
.
changedItems
[
'highlight'
]
.
keys
():
for
newName
in
self
.
changedItems
[
'highlight'
]
.
keys
():
if
newName
not
in
customThemeList
:
customThemeList
.
append
(
newName
)
if
newName
not
in
customThemeList
:
customThemeList
.
append
(
newName
)
customThemeList
.
sort
()
customThemeList
.
sort
()
print
newThemeName
,
customThemeList
,
newTheme
self
.
optMenuThemeCustom
.
SetMenu
(
customThemeList
,
newThemeName
)
self
.
optMenuThemeCustom
.
SetMenu
(
customThemeList
,
newThemeName
)
self
.
themeIsBuiltin
.
set
(
0
)
self
.
themeIsBuiltin
.
set
(
0
)
self
.
SetThemeType
()
self
.
SetThemeType
()
...
@@ -760,7 +760,7 @@ class ConfigDialog(Toplevel):
...
@@ -760,7 +760,7 @@ class ConfigDialog(Toplevel):
self
.
customKeys
.
set
(
'- no custom keys -'
)
self
.
customKeys
.
set
(
'- no custom keys -'
)
else
:
else
:
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
else
:
#user
theme
selected
else
:
#user
key set
selected
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
.
sort
()
itemList
.
sort
()
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
currentOption
)
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
currentOption
)
...
@@ -813,7 +813,6 @@ class ConfigDialog(Toplevel):
...
@@ -813,7 +813,6 @@ class ConfigDialog(Toplevel):
self
.
LoadGeneralCfg
()
self
.
LoadGeneralCfg
()
def
SetUserValue
(
self
,
configType
,
section
,
item
,
value
):
def
SetUserValue
(
self
,
configType
,
section
,
item
,
value
):
print
idleConf
.
defaultCfg
[
configType
]
.
Get
(
section
,
item
),
value
if
idleConf
.
defaultCfg
[
configType
]
.
has_option
(
section
,
item
):
if
idleConf
.
defaultCfg
[
configType
]
.
has_option
(
section
,
item
):
if
idleConf
.
defaultCfg
[
configType
]
.
Get
(
section
,
item
)
==
value
:
if
idleConf
.
defaultCfg
[
configType
]
.
Get
(
section
,
item
)
==
value
:
#the setting equals a default setting, remove it from user cfg
#the setting equals a default setting, remove it from user cfg
...
@@ -830,12 +829,12 @@ class ConfigDialog(Toplevel):
...
@@ -830,12 +829,12 @@ class ConfigDialog(Toplevel):
for
section
in
self
.
changedItems
[
configType
]
.
keys
():
for
section
in
self
.
changedItems
[
configType
]
.
keys
():
for
item
in
self
.
changedItems
[
configType
][
section
]
.
keys
():
for
item
in
self
.
changedItems
[
configType
][
section
]
.
keys
():
value
=
self
.
changedItems
[
configType
][
section
][
item
]
value
=
self
.
changedItems
[
configType
][
section
][
item
]
print
configType
,
section
,
item
,
value
if
self
.
SetUserValue
(
configType
,
section
,
item
,
value
):
if
self
.
SetUserValue
(
configType
,
section
,
item
,
value
):
cfgTypeHasChanges
=
1
cfgTypeHasChanges
=
1
if
cfgTypeHasChanges
:
if
cfgTypeHasChanges
:
idleConf
.
userCfg
[
configType
]
.
Save
()
idleConf
.
userCfg
[
configType
]
.
Save
()
self
.
ResetChangedItems
()
#clear the changed items dict
def
Cancel
(
self
):
def
Cancel
(
self
):
self
.
destroy
()
self
.
destroy
()
...
...
Lib/idlelib/configHandler.py
Dosyayı görüntüle @
a498af26
...
@@ -346,11 +346,27 @@ class IdleConf:
...
@@ -346,11 +346,27 @@ class IdleConf:
del
(
names
[
index
])
del
(
names
[
index
])
return
names
return
names
def
GetExtnNameForEvent
(
self
,
virtualEvent
):
"""
Returns the name of the extension that virtualEvent is bound in, or
None if not bound in any extension.
virtualEvent - string, name of the virtual event to test for, without
the enclosing '<< >>'
"""
extName
=
None
vEvent
=
'<<'
+
virtualEvent
+
'>>'
for
extn
in
self
.
GetExtensions
(
activeOnly
=
0
):
for
event
in
self
.
GetExtensionKeys
(
extn
)
.
keys
():
if
event
==
vEvent
:
extName
=
extn
print
extName
return
extName
def
GetExtensionKeys
(
self
,
extensionName
):
def
GetExtensionKeys
(
self
,
extensionName
):
"""
"""
returns a dictionary of the configurable keybindings for a particular
returns a dictionary of the configurable keybindings for a particular
extension,as they exist in the dictionary returned by GetCurrentKeySet;
extension,as they exist in the dictionary returned by GetCurrentKeySet;
that is, where previously
re-
used bindings are disabled.
that is, where previously used bindings are disabled.
"""
"""
keysName
=
extensionName
+
'_cfgBindings'
keysName
=
extensionName
+
'_cfgBindings'
activeKeys
=
self
.
GetCurrentKeySet
()
activeKeys
=
self
.
GetCurrentKeySet
()
...
@@ -432,6 +448,14 @@ class IdleConf:
...
@@ -432,6 +448,14 @@ class IdleConf:
keySet
[
event
]
=
extKeys
[
event
]
#add binding
keySet
[
event
]
=
extKeys
[
event
]
#add binding
return
keySet
return
keySet
def
IsCoreBinding
(
self
,
virtualEvent
):
"""
returns true if the virtual event is bound in the core idle keybindings.
virtualEvent - string, name of the virtual event to test for, without
the enclosing '<< >>'
"""
return
(
'<<'
+
virtualEvent
+
'>>'
)
in
self
.
GetCoreKeys
()
.
keys
()
def
GetCoreKeys
(
self
,
keySetName
=
None
):
def
GetCoreKeys
(
self
,
keySetName
=
None
):
"""
"""
returns the requested set of core keybindings, with fallbacks if
returns the requested set of core keybindings, with fallbacks if
...
@@ -442,9 +466,9 @@ class IdleConf:
...
@@ -442,9 +466,9 @@ class IdleConf:
defined here.
defined here.
"""
"""
keyBindings
=
{
keyBindings
=
{
'<<
C
opy>>'
:
[
'<Control-c>'
,
'<Control-C>'
],
'<<
c
opy>>'
:
[
'<Control-c>'
,
'<Control-C>'
],
'<<
C
ut>>'
:
[
'<Control-x>'
,
'<Control-X>'
],
'<<
c
ut>>'
:
[
'<Control-x>'
,
'<Control-X>'
],
'<<
P
aste>>'
:
[
'<Control-v>'
,
'<Control-V>'
],
'<<
p
aste>>'
:
[
'<Control-v>'
,
'<Control-V>'
],
'<<beginning-of-line>>'
:
[
'<Control-a>'
,
'<Home>'
],
'<<beginning-of-line>>'
:
[
'<Control-a>'
,
'<Home>'
],
'<<center-insert>>'
:
[
'<Control-l>'
],
'<<center-insert>>'
:
[
'<Control-l>'
],
'<<close-all-windows>>'
:
[
'<Control-q>'
],
'<<close-all-windows>>'
:
[
'<Control-q>'
],
...
...
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