Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
745479f2
Commit
745479f2
authored
Jan 04, 2002
by
Steven M. Gava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loading core keybindings via new config system plus
further devel of highlight handling
parent
bcedd602
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
31 deletions
+40
-31
Lib/idlelib/Bindings.py
Lib/idlelib/Bindings.py
+1
-6
Lib/idlelib/ColorDelegator.py
Lib/idlelib/ColorDelegator.py
+2
-2
Lib/idlelib/EditorWindow.py
Lib/idlelib/EditorWindow.py
+0
-1
Lib/idlelib/PyShell.py
Lib/idlelib/PyShell.py
+2
-4
Lib/idlelib/config-extensions.def
Lib/idlelib/config-extensions.def
+3
-3
Lib/idlelib/config-main.def
Lib/idlelib/config-main.def
+1
-1
Lib/idlelib/configDialog.py
Lib/idlelib/configDialog.py
+4
-7
Lib/idlelib/configHandler.py
Lib/idlelib/configHandler.py
+27
-7
No files found.
Lib/idlelib/Bindings.py
View file @
745479f2
...
...
@@ -73,11 +73,6 @@ menudefs = [
]),
]
#if sys.platform == 'win32':
# default_keydefs = windows_keydefs
#else:
# default_keydefs = unix_keydefs
default_keydefs
=
idleConf
.
GetKeys
(
keySetName
=
None
)
default_keydefs
=
idleConf
.
GetKeys
(
keySetName
=
idleConf
.
CurrentKeys
())
del
sys
Lib/idlelib/ColorDelegator.py
View file @
745479f2
...
...
@@ -60,8 +60,8 @@ class ColorDelegator(Delegator):
"KEYWORD"
:
idleConf
.
GetHighlight
(
theme
,
"keyword"
),
"STRING"
:
idleConf
.
GetHighlight
(
theme
,
"string"
),
"DEFINITION"
:
idleConf
.
GetHighlight
(
theme
,
"definition"
),
"SYNC"
:
idleConf
.
GetHighlight
(
theme
,
"sync"
)
,
"TODO"
:
idleConf
.
GetHighlight
(
theme
,
"todo"
)
,
"SYNC"
:
{
'background'
:
None
,
'foreground'
:
None
}
,
"TODO"
:
{
'background'
:
None
,
'foreground'
:
None
}
,
"BREAK"
:
idleConf
.
GetHighlight
(
theme
,
"break"
),
# The following is used by ReplaceDialog:
"hit"
:
idleConf
.
GetHighlight
(
theme
,
"hit"
),
...
...
Lib/idlelib/EditorWindow.py
View file @
745479f2
...
...
@@ -206,7 +206,6 @@ class EditorWindow:
if
self
.
extensions
.
has_key
(
'AutoIndent'
):
self
.
extensions
[
'AutoIndent'
].
set_indentation_params
(
self
.
ispythonsource
(
filename
))
def
set_status_bar
(
self
):
self
.
status_bar
=
self
.
MultiStatusBar
(
self
.
top
)
...
...
Lib/idlelib/PyShell.py
View file @
745479f2
...
...
@@ -42,7 +42,6 @@ from FileList import FileList
from
ColorDelegator
import
ColorDelegator
from
UndoDelegator
import
UndoDelegator
from
OutputWindow
import
OutputWindow
,
OnDemandOutputWindow
from
IdleConf
import
idleconf
from
configHandler
import
idleConf
import
idlever
...
...
@@ -143,9 +142,9 @@ class ModifiedColorDelegator(ColorDelegator):
tagdefs
=
ColorDelegator
.
tagdefs
.
copy
()
theme
=
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
tagdefs
.
update
({
"stdin"
:
idleConf
.
GetHighlight
(
theme
,
"stdin"
),
tagdefs
.
update
({
"stdin"
:
{
'background'
:
None
,
'foreground'
:
None
},
"stdout"
:
idleConf
.
GetHighlight
(
theme
,
"stdout"
),
"stderr"
:
idleConf
.
GetHighlight
(
theme
,
"stderr"
),
"console"
:
idleConf
.
GetHighlight
(
theme
,
"console"
),
...
...
@@ -153,7 +152,6 @@ class ModifiedColorDelegator(ColorDelegator):
None
:
idleConf
.
GetHighlight
(
theme
,
"normal"
),
})
class
ModifiedUndoDelegator
(
UndoDelegator
):
# Forbid insert/delete before the I/O mark
...
...
Lib/idlelib/config-extensions.def
View file @
745479f2
# IDLE reads several config files to determine user preferences. This
# file is the default config file for idle extensions settings.
[
AutoIndent
]
[
FormatParagraph
]
enable=1
[Auto
Expand
]
[Auto
Indent
]
enable=1
[
FormatParagraph
]
[
AutoExpand
]
enable=1
[ZoomHeight]
...
...
Lib/idlelib/config-main.def
View file @
745479f2
...
...
@@ -63,7 +63,7 @@ name= IDLE Classic
[Keys]
default= 1
name= IDLE Classic
- w
indows
name= IDLE Classic
W
indows
[RecentFiles]
1=
...
...
Lib/idlelib/configDialog.py
View file @
745479f2
...
...
@@ -120,8 +120,8 @@ class ConfigDialog(Toplevel):
self
.
radioBg
.
config
(
state
=
DISABLED
)
self
.
fgHilite
.
set
(
1
)
else
:
#both fg and bg can be set
self
.
radioFg
.
config
(
state
=
DISABLED
)
self
.
radioBg
.
config
(
state
=
DISABLED
)
self
.
radioFg
.
config
(
state
=
NORMAL
)
self
.
radioBg
.
config
(
state
=
NORMAL
)
self
.
fgHilite
.
set
(
1
)
self
.
SetColourSample
()
...
...
@@ -496,7 +496,7 @@ class ConfigDialog(Toplevel):
colours
=
idleConf
.
GetHighlight
(
theme
,
self
.
themeElements
[
element
][
0
])
if
element
==
'Cursor'
:
#cursor sample needs special painting
colours
[
'background'
]
=
idleConf
.
GetHighlight
(
theme
,
'normal
-text
'
,
fgBg
=
'bg'
)
'normal'
,
fgBg
=
'bg'
)
apply
(
self
.
textHighlightSample
.
tag_config
,
(
self
.
themeElements
[
element
][
0
],),
colours
)
...
...
@@ -558,11 +558,8 @@ class ConfigDialog(Toplevel):
themeNames
=
self
.
themeElements
.
keys
()
themeNames
.
sort
(
self
.
__ThemeNameIndexCompare
)
self
.
optMenuHighlightTarget
.
SetMenu
(
themeNames
,
themeNames
[
0
])
sampleBg
=
idleConf
.
GetHighlight
(
currentOption
,
self
.
highlightTarget
.
get
())[
'background'
]
self
.
fgHilite
.
set
(
0
)
self
.
frameColourSet
.
config
(
bg
=
sampleBg
)
self
.
PaintThemeSample
()
self
.
SetHighlightTarget
()
def
__ThemeNameIndexCompare
(
self
,
a
,
b
):
if
self
.
themeElements
[
a
][
1
]
<
self
.
themeElements
[
b
][
1
]:
return
-
1
...
...
Lib/idlelib/configHandler.py
View file @
745479f2
...
...
@@ -27,7 +27,6 @@ class IdleConfParser(ConfigParser):
"""
Get an option value for given section/option or return default.
If type is specified, return as type.
If a default is returned a warning is printed to stderr.
"""
if
type
==
'bool'
:
getVal
=
self
.
getboolean
...
...
@@ -125,6 +124,7 @@ class IdleConf:
fallback to a useable passed-in default if the option isn't present in
either the user or the default configuration.
configType must be one of ('main','extensions','highlight','keys')
If a default is returned a warning is printed to stderr.
"""
if
self
.
userCfg
[
configType
].
has_option
(
section
,
option
):
return
self
.
userCfg
[
configType
].
Get
(
section
,
option
,
type
=
type
)
...
...
@@ -201,14 +201,14 @@ class IdleConf:
"""
Returns the name of the currently active theme
"""
return
self
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
return
self
.
GetOption
(
'main'
,
'Theme'
,
'name'
,
default
=
''
)
def
CurrentKeys
(
self
):
"""
Returns the name of the currently active theme
"""
return
self
.
GetOption
(
'main'
,
'Keys'
,
'name'
)
return
self
.
GetOption
(
'main'
,
'Keys'
,
'name'
,
default
=
''
)
def
GetExtensions
(
self
,
activeOnly
=
1
):
"""
...
...
@@ -230,11 +230,21 @@ class IdleConf:
else
:
return
extns
def
GetKeyBinding
(
self
,
keySetName
,
eventStr
):
"""
returns the keybinding for a specific event.
keySetName - string, name of key binding set
eventStr - string, the virtual event we want the binding for,
represented as a string, eg. '<<event>>'
"""
eventName
=
eventStr
[
2
:
-
2
]
#trim off the angle brackets
binding
=
self
.
GetOption
(
'keys'
,
keySetName
,
eventName
,
default
=
''
).
split
()
return
binding
def
GetKeys
(
self
,
keySetName
=
None
):
"""
returns the requested keybindings, with fallbacks if required.
returns the requested
set of
keybindings, with fallbacks if required.
"""
#default keybindings.
#keybindings loaded from the config file(s) are loaded _over_ these
#defaults, so if there is a problem getting any binding there will
#be an 'ultimate last resort fallback' to the CUA-ish bindings
...
...
@@ -266,9 +276,19 @@ class IdleConf:
'<<save-window>>'
:
[
'<Control-s>'
],
'<<select-all>>'
:
[
'<Alt-a>'
],
'<<toggle-auto-coloring>>'
:
[
'<Control-slash>'
],
'<<undo>>'
:
[
'<Control-z>'
]}
'<<undo>>'
:
[
'<Control-z>'
],
'<<find-again>>'
:
[
'<Control-g>'
,
'<F3>'
],
'<<find-in-files>>'
:
[
'<Alt-F3>'
],
'<<find-selection>>'
:
[
'<Control-F3>'
],
'<<find>>'
:
[
'<Control-f>'
],
'<<replace>>'
:
[
'<Control-h>'
],
'<<goto-line>>'
:
[
'<Alt-g>'
]
}
if
keySetName
:
pass
for
event
in
keyBindings
.
keys
():
binding
=
self
.
GetKeyBinding
(
keySetName
,
event
)
if
binding
:
#otherwise will keep default
keyBindings
[
event
]
=
binding
return
keyBindings
...
...
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