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
bd31c1a7
Commit
bd31c1a7
authored
Nov 04, 2001
by
Steven M. Gava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new config implementation
parent
4b81ff20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
55 deletions
+40
-55
Lib/idlelib/config-main.def
Lib/idlelib/config-main.def
+2
-2
Lib/idlelib/configDialog.py
Lib/idlelib/configDialog.py
+38
-53
No files found.
Lib/idlelib/config-main.def
View file @
bd31c1a7
...
...
@@ -58,11 +58,11 @@ num-spaces= 4
tab-cols= 4
[Theme]
user= 0
default= 1
name= IDLE Classic New
[Keys]
user= 0
default= 1
name= IDLE Classic - windows
[RecentFiles]
...
...
Lib/idlelib/configDialog.py
View file @
bd31c1a7
...
...
@@ -35,13 +35,13 @@ class ConfigDialog(Toplevel):
'Python Definitions'
:(
'definition'
,
'02'
,
'both'
),
'Python Comments'
:(
'comment'
,
'03'
,
'both'
),
'Python Strings'
:(
'string'
,
'04'
,
'both'
),
'Selected Text'
:(
'
selected
'
,
'05'
,
'both'
),
'Found Text'
:(
'
found
'
,
'06'
,
'both'
),
'Selected Text'
:(
'
hilite
'
,
'05'
,
'both'
),
'Found Text'
:(
'
hit
'
,
'06'
,
'both'
),
'Cursor'
:(
'cursor'
,
'07'
,
'fg'
),
'Error Background'
:(
'error'
,
'08'
,
'bg'
),
'Shell Foreground'
:(
'
shfg
'
,
'09'
,
'fg'
),
'Shell Stdout Foreground'
:(
's
hs
tdout'
,
'10'
,
'fg'
),
'Shell Stderr Foreground'
:(
's
hs
tderr'
,
'11'
,
'fg'
)}
'Shell Foreground'
:(
'
console
'
,
'09'
,
'fg'
),
'Shell Stdout Foreground'
:(
'stdout'
,
'10'
,
'fg'
),
'Shell Stderr Foreground'
:(
'stderr'
,
'11'
,
'fg'
)}
self
.
CreateWidgets
()
self
.
resizable
(
height
=
FALSE
,
width
=
FALSE
)
self
.
ChangePage
()
...
...
@@ -105,7 +105,7 @@ class ConfigDialog(Toplevel):
pos
=
pos
+
1
def
SetThemeType
(
self
):
if
self
.
themeBuiltin
.
get
():
if
self
.
theme
Is
Builtin
.
get
():
self
.
optMenuThemeBuiltin
.
config
(
state
=
NORMAL
)
self
.
optMenuThemeCustom
.
config
(
state
=
DISABLED
)
self
.
buttonDeleteCustomTheme
.
config
(
state
=
DISABLED
)
...
...
@@ -115,11 +115,11 @@ class ConfigDialog(Toplevel):
self
.
buttonDeleteCustomTheme
.
config
(
state
=
NORMAL
)
def
SetKeysType
(
self
):
if
self
.
keys
Type
.
get
()
==
0
:
if
self
.
keys
AreDefault
.
get
()
:
self
.
optMenuKeysBuiltin
.
config
(
state
=
NORMAL
)
self
.
optMenuKeysCustom
.
config
(
state
=
DISABLED
)
self
.
buttonDeleteCustomKeys
.
config
(
state
=
DISABLED
)
el
if
self
.
keysType
.
get
()
==
1
:
el
se
:
self
.
optMenuKeysBuiltin
.
config
(
state
=
DISABLED
)
self
.
optMenuKeysCustom
.
config
(
state
=
NORMAL
)
self
.
buttonDeleteCustomKeys
.
config
(
state
=
NORMAL
)
...
...
@@ -300,7 +300,7 @@ class ConfigDialog(Toplevel):
self
.
fgHilite
=
IntVar
()
self
.
colour
=
StringVar
()
self
.
fontName
=
StringVar
()
self
.
themeBuiltin
=
IntVar
()
self
.
theme
Is
Builtin
=
IntVar
()
self
.
highlightTarget
=
StringVar
()
self
.
highlightTarget
.
trace_variable
(
'w'
,
self
.
SetHighlightTargetBinding
)
##widget creation
...
...
@@ -320,11 +320,11 @@ class ConfigDialog(Toplevel):
(
'#to choose items'
,
'comment'
),(
'
\
n
'
,
'normal'
),(
'def'
,
'keyword'
),
(
' '
,
'normal'
),(
'func'
,
'definition'
),(
'(param):'
,
'normal'
),
(
'
\
n
'
,
'normal'
),(
'"""string"""'
,
'string'
),(
'
\
n
var0 = '
,
'normal'
),
(
"'string'"
,
'string'
),(
'
\
n
var1 = '
,
'normal'
),(
"'selected'"
,
'
selected
'
),
(
'
\
n
var2 = '
,
'normal'
),(
"'found'"
,
'
found
'
),(
'
\
n
\
n
'
,
'normal'
),
(
"'string'"
,
'string'
),(
'
\
n
var1 = '
,
'normal'
),(
"'selected'"
,
'
hilite
'
),
(
'
\
n
var2 = '
,
'normal'
),(
"'found'"
,
'
hit
'
),(
'
\
n
\
n
'
,
'normal'
),
(
' error '
,
'error'
),(
' '
,
'normal'
),(
'cursor |'
,
'cursor'
),
(
'
\
n
'
,
'normal'
),(
'shell'
,
'
shfg'
),(
' '
,
'normal'
),(
'stdout'
,
'sh
stdout'
),
(
' '
,
'normal'
),(
'stderr'
,
's
hs
tderr'
),(
'
\
n
'
,
'normal'
))
(
'
\
n
'
,
'normal'
),(
'shell'
,
'
console'
),(
' '
,
'normal'
),(
'stdout'
,
'
stdout'
),
(
' '
,
'normal'
),(
'stderr'
,
'stderr'
),(
'
\
n
'
,
'normal'
))
for
txTa
in
textAndTags
:
text
.
insert
(
END
,
txTa
[
0
],
txTa
[
1
])
for
element
in
self
.
themeElements
.
keys
():
...
...
@@ -349,10 +349,10 @@ class ConfigDialog(Toplevel):
#frameTheme
labelThemeTitle
=
Label
(
frameTheme
,
text
=
'Select a Highlighting Theme'
)
labelTypeTitle
=
Label
(
frameTheme
,
text
=
'Select : '
)
self
.
radioThemeBuiltin
=
Radiobutton
(
frameTheme
,
variable
=
self
.
themeBuiltin
,
value
=
0
,
command
=
self
.
SetThemeType
,
text
=
'a Built-in Theme'
)
self
.
radioThemeCustom
=
Radiobutton
(
frameTheme
,
variable
=
self
.
themeBuiltin
,
value
=
1
,
command
=
self
.
SetThemeType
,
text
=
'a Custom Theme'
)
self
.
radioThemeBuiltin
=
Radiobutton
(
frameTheme
,
variable
=
self
.
theme
Is
Builtin
,
value
=
1
,
command
=
self
.
SetThemeType
,
text
=
'a Built-in Theme'
)
self
.
radioThemeCustom
=
Radiobutton
(
frameTheme
,
variable
=
self
.
theme
Is
Builtin
,
value
=
0
,
command
=
self
.
SetThemeType
,
text
=
'a Custom Theme'
)
self
.
optMenuThemeBuiltin
=
DynOptionMenu
(
frameTheme
,
self
.
builtinTheme
,
None
,
command
=
None
)
self
.
optMenuThemeCustom
=
DynOptionMenu
(
frameTheme
,
...
...
@@ -392,7 +392,7 @@ class ConfigDialog(Toplevel):
self
.
keyCtrl
=
StringVar
()
self
.
keyAlt
=
StringVar
()
self
.
keyShift
=
StringVar
()
self
.
keys
Type
=
IntVar
()
self
.
keys
AreDefault
=
IntVar
()
##widget creation
#body frame
frame
=
Frame
(
self
.
framePages
,
borderwidth
=
2
,
relief
=
RAISED
)
...
...
@@ -419,10 +419,10 @@ class ConfigDialog(Toplevel):
#frameKeySets
labelKeysTitle
=
Label
(
frameKeySets
,
text
=
'Select a Key Set'
)
labelTypeTitle
=
Label
(
frameKeySets
,
text
=
'Select : '
)
self
.
radioKeysBuiltin
=
Radiobutton
(
frameKeySets
,
variable
=
self
.
keys
Type
,
value
=
0
,
command
=
self
.
SetKeysType
,
text
=
'a Built-in Key Set'
)
self
.
radioKeysCustom
=
Radiobutton
(
frameKeySets
,
variable
=
self
.
keys
Type
,
value
=
1
,
command
=
self
.
SetKeysType
,
text
=
'a Custom Key Set'
)
self
.
radioKeysBuiltin
=
Radiobutton
(
frameKeySets
,
variable
=
self
.
keys
AreDefault
,
value
=
1
,
command
=
self
.
SetKeysType
,
text
=
'a Built-in Key Set'
)
self
.
radioKeysCustom
=
Radiobutton
(
frameKeySets
,
variable
=
self
.
keys
AreDefault
,
value
=
0
,
command
=
self
.
SetKeysType
,
text
=
'a Custom Key Set'
)
self
.
optMenuKeysBuiltin
=
DynOptionMenu
(
frameKeySets
,
self
.
builtinKeys
,
None
,
command
=
None
)
self
.
optMenuKeysCustom
=
DynOptionMenu
(
frameKeySets
,
...
...
@@ -536,35 +536,14 @@ class ConfigDialog(Toplevel):
return
frame
def
PaintThemeSample
(
self
):
if
self
.
theme
Builtin
.
get
:
#a default theme
if
self
.
theme
IsBuiltin
.
get
()
:
#a default theme
theme
=
self
.
builtinTheme
.
get
()
else
:
#a user theme
theme
=
self
.
customTheme
.
get
()
colours
=
idleConf
.
GetHighlight
(
theme
,
'normal'
)
#normalBg=colours['background']
apply
(
self
.
textHighlightSample
.
tag_config
,(
'normal'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'keyword'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'keyword'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'comment'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'comment'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'definition'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'definition'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'string'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'string'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'hilite'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'selected'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'hit'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'found'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'cursor'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'cursor'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'error'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'error'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'console'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'shfg'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'stdout'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'shstdout'
,),
colours
)
colours
=
idleConf
.
GetHighlight
(
theme
,
'stderr'
)
apply
(
self
.
textHighlightSample
.
tag_config
,(
'shstderr'
,),
colours
)
for
element
in
self
.
themeElements
.
keys
():
colours
=
idleConf
.
GetHighlight
(
theme
,
self
.
themeElements
[
element
][
0
])
apply
(
self
.
textHighlightSample
.
tag_config
,
(
self
.
themeElements
[
element
][
0
],),
colours
)
def
LoadFontCfg
(
self
):
##base editor font selection list
...
...
@@ -600,11 +579,12 @@ class ConfigDialog(Toplevel):
def
LoadThemeCfg
(
self
):
##current theme type radiobutton
self
.
themeBuiltin
.
set
(
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'user'
,
type
=
'int'
))
self
.
themeIsBuiltin
.
set
(
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'default'
,
type
=
'int'
,
default
=
1
))
##currently set theme
currentOption
=
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
##load available theme option menus
if
self
.
themeBuiltin
.
get
():
#default theme selected
if
self
.
theme
Is
Builtin
.
get
():
#default theme selected
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'highlight'
)
self
.
optMenuThemeBuiltin
.
SetMenu
(
itemList
,
currentOption
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
...
...
@@ -623,6 +603,10 @@ 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
()
def
__ThemeNameIndexCompare
(
self
,
a
,
b
):
...
...
@@ -632,11 +616,12 @@ class ConfigDialog(Toplevel):
def
LoadKeyCfg
(
self
):
##current keys type radiobutton
self
.
keysType
.
set
(
idleConf
.
GetOption
(
'main'
,
'Keys'
,
'user'
,
type
=
'int'
))
self
.
keysAreDefault
.
set
(
idleConf
.
GetOption
(
'main'
,
'Keys'
,
'default'
,
type
=
'int'
,
default
=
1
))
##currently set keys
currentOption
=
idleConf
.
GetOption
(
'main'
,
'Keys'
,
'name'
)
##load available keyset option menus
if
self
.
keys
Type
.
get
()
==
0
:
#default theme selected
if
self
.
keys
AreDefault
.
get
()
:
#default theme selected
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'keys'
)
self
.
optMenuKeysBuiltin
.
SetMenu
(
itemList
,
currentOption
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
...
...
@@ -645,7 +630,7 @@ class ConfigDialog(Toplevel):
self
.
customKeys
.
set
(
'- no custom keys -'
)
else
:
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
el
if
self
.
keysType
.
get
()
==
1
:
#user theme selected
el
se
:
#user theme selected
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
currentOption
)
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'keys'
)
...
...
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