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
f9bb90e4
Kaydet (Commit)
f9bb90e4
authored
Ock 24, 2002
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
further work on saving configs
üst
813b56e3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
25 deletions
+68
-25
configDialog.py
Lib/idlelib/configDialog.py
+0
-0
configHandler.py
Lib/idlelib/configHandler.py
+68
-23
keybindingDialog.py
Lib/idlelib/keybindingDialog.py
+0
-2
No files found.
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
f9bb90e4
This diff is collapsed.
Click to expand it.
Lib/idlelib/configHandler.py
Dosyayı görüntüle @
f9bb90e4
...
...
@@ -23,7 +23,7 @@ class IdleConfParser(ConfigParser):
self
.
file
=
cfgFile
ConfigParser
.
__init__
(
self
,
defaults
=
cfgDefaults
)
def
Get
(
self
,
section
,
option
,
type
=
None
):
def
Get
(
self
,
section
,
option
,
type
=
None
,
default
=
None
):
"""
Get an option value for given section/option or return default.
If type is specified, return as type.
...
...
@@ -35,8 +35,10 @@ class IdleConfParser(ConfigParser):
else
:
getVal
=
self
.
get
if
self
.
has_option
(
section
,
option
):
#return getVal(section, option, raw, vars)
#return getVal(section, option, raw, vars
, default
)
return
getVal
(
section
,
option
)
else
:
return
default
def
GetOptionList
(
self
,
section
):
"""
...
...
@@ -188,21 +190,63 @@ class IdleConf:
else
:
raise
'Invalid fgBg specified'
def
GetTheme
(
self
,
name
=
None
):
"""
Gets the requested theme or returns a final fallback theme in case
one can't be obtained from either the user or default config files.
"""
pass
def
GetThemeDict
(
self
,
type
,
themeName
):
"""
type - string, 'default' or 'user' theme type
themeName - string, theme name
Returns a dictionary which holds {option:value} for each element
in the specified theme. Values are loaded over a set of ultimate last
fallback defaults to guarantee that all theme elements are present in
a newly created theme.
"""
if
type
==
'user'
:
cfgParser
=
self
.
userCfg
[
'highlight'
]
elif
type
==
'default'
:
cfgParser
=
self
.
defaultCfg
[
'highlight'
]
else
:
raise
'Invalid theme type specified'
#foreground and background values are provded for each theme element
#(apart from cursor) even though all these values are not yet used
#by idle, to allow for their use in the future. Default values are
#generally black and white.
theme
=
{
'normal-foreground'
:
'#000000'
,
'normal-background'
:
'#ffffff'
,
'keyword-foreground'
:
'#000000'
,
'keyword-background'
:
'#ffffff'
,
'comment-foreground'
:
'#000000'
,
'comment-background'
:
'#ffffff'
,
'string-foreground'
:
'#000000'
,
'string-background'
:
'#ffffff'
,
'definition-foreground'
:
'#000000'
,
'definition-background'
:
'#ffffff'
,
'hilite-foreground'
:
'#000000'
,
'hilite-background'
:
'gray'
,
'break-foreground'
:
'#ffffff'
,
'break-background'
:
'#000000'
,
'hit-foreground'
:
'#ffffff'
,
'hit-background'
:
'#000000'
,
'error-foreground'
:
'#ffffff'
,
'error-background'
:
'#000000'
,
#cursor (only foreground can be set)
'cursor-foreground'
:
'#000000'
,
#shell window
'stdout-foreground'
:
'#000000'
,
'stdout-background'
:
'#ffffff'
,
'stderr-foreground'
:
'#000000'
,
'stderr-background'
:
'#ffffff'
,
'console-foreground'
:
'#000000'
,
'console-background'
:
'#ffffff'
}
for
element
in
theme
.
keys
():
colour
=
cfgParser
.
Get
(
type
,
themeName
,
element
,
default
=
theme
[
element
])
theme
[
element
]
=
colour
return
theme
def
CurrentTheme
(
self
):
"""
Returns the name of the currently active theme
"""
return
self
.
GetOption
(
'main'
,
'Theme'
,
'name'
,
default
=
''
)
def
CurrentKeys
(
self
):
"""
Returns the name of the currently active theme
...
...
@@ -299,8 +343,6 @@ class IdleConf:
return
extBinds
def
GetKeyBinding
(
self
,
keySetName
,
eventStr
):
"""
returns the keybinding for a specific event.
...
...
@@ -313,32 +355,35 @@ class IdleConf:
return
binding
def
GetCurrentKeySet
(
self
):
return
self
.
GetKeySet
(
self
.
CurrentKeys
())
def
GetKeySet
(
self
,
keySetName
):
"""
Returns a dictionary of: all
current
core keybindings, plus the
Returns a dictionary of: all
requested
core keybindings, plus the
keybindings for all currently active extensions. If a binding defined
in an extension is already in use, that binding is disabled.
"""
currentKeySet
=
self
.
GetCoreKeys
(
keySetName
=
self
.
CurrentKeys
()
)
keySet
=
self
.
GetCoreKeys
(
keySetName
)
activeExtns
=
self
.
GetExtensions
(
activeOnly
=
1
)
for
extn
in
activeExtns
:
extKeys
=
self
.
__GetRawExtensionKeys
(
extn
)
if
extKeys
:
#the extension defines keybindings
for
event
in
extKeys
.
keys
():
if
extKeys
[
event
]
in
currentK
eySet
.
values
():
if
extKeys
[
event
]
in
k
eySet
.
values
():
#the binding is already in use
extKeys
[
event
]
=
''
#disable this binding
currentK
eySet
[
event
]
=
extKeys
[
event
]
#add binding
return
currentK
eySet
k
eySet
[
event
]
=
extKeys
[
event
]
#add binding
return
k
eySet
def
GetCoreKeys
(
self
,
keySetName
=
None
):
"""
returns the requested set of core keybindings, with fallbacks if
required.
Keybindings loaded from the config file(s) are loaded _over_ these
defaults, so if there is a problem getting any core binding there will
be an 'ultimate last resort fallback' to the CUA-ish bindings
defined here.
"""
#keybindings loaded from the config file(s) are loaded _over_ these
#defaults, so if there is a problem getting any core binding there will
#be an 'ultimate last resort fallback' to the CUA-ish bindings
#defined here.
keyBindings
=
{
'<<Copy>>'
:
[
'<Control-c>'
,
'<Control-C>'
],
'<<Cut>>'
:
[
'<Control-x>'
,
'<Control-X>'
],
...
...
Lib/idlelib/keybindingDialog.py
Dosyayı görüntüle @
f9bb90e4
...
...
@@ -264,8 +264,6 @@ if __name__ == '__main__':
#test the dialog
root
=
Tk
()
def
run
():
#import aboutDialog
#aboutDialog.AboutDialog(root,'About')
keySeq
=
''
dlg
=
GetKeysDialog
(
root
,
'Get Keys'
,
'find-again'
,[])
print
dlg
.
result
...
...
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