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
201bc5b0
Commit
201bc5b0
authored
Oct 26, 2001
by
Steven M. Gava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further work on loading config dialog values from the config files
parent
8f347d7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
61 deletions
+15
-61
Lib/idlelib/configDialog.py
Lib/idlelib/configDialog.py
+15
-61
No files found.
Lib/idlelib/configDialog.py
View file @
201bc5b0
...
...
@@ -11,6 +11,7 @@ from Tkinter import *
import
tkMessageBox
,
tkColorChooser
,
tkFont
from
configHandler
import
idleConf
from
dynOptionMenuWidget
import
DynOptionMenu
class
ConfigDialog
(
Toplevel
):
"""
...
...
@@ -202,15 +203,11 @@ class ConfigDialog(Toplevel):
exportselection
=
FALSE
)
self
.
listFontName
.
bind
(
'<<ListboxSelect>>'
,
self
.
SetFontSampleBinding
)
scrollFont
=
Scrollbar
(
frameFontName
)
#self.LoadFontList()
scrollFont
.
config
(
command
=
self
.
listFontName
.
yview
)
self
.
listFontName
.
config
(
yscrollcommand
=
scrollFont
.
set
)
labelFontSizeTitle
=
Label
(
frameFontSize
,
text
=
'Size :'
)
sizes
=
(
'10'
,
'11'
,
'12'
,
'13'
,
'14'
,
'16'
,
'18'
,
'20'
,
'22'
)
args
=
(
frameFontSize
,
self
.
fontSize
)
+
sizes
keyArgs
=
{
'command'
:
self
.
SetFontSampleBinding
}
optFontSize
=
apply
(
OptionMenu
,
args
,
keyArgs
)
#optFontSize.bind('<<MenuSelect>>',self.SetFontSample)
self
.
optMenuFontSize
=
DynOptionMenu
(
frameFontSize
,
self
.
fontSize
,
None
,
command
=
self
.
SetFontSampleBinding
)
frameFontSample
=
Frame
(
frameFont
,
relief
=
SOLID
,
borderwidth
=
1
)
self
.
labelFontSample
=
Label
(
frameFontSample
,
text
=
'AaBbCcDdEe
\
n
FfGgHhIiJjK
\
n
1234567890
\
n
#:+=(){}[]'
,
...
...
@@ -248,7 +245,7 @@ class ConfigDialog(Toplevel):
self
.
listFontName
.
pack
(
side
=
LEFT
,
fill
=
Y
)
scrollFont
.
pack
(
side
=
LEFT
,
fill
=
Y
)
labelFontSizeTitle
.
pack
(
side
=
TOP
,
anchor
=
W
)
opt
FontSize
.
pack
(
side
=
TOP
,
anchor
=
W
,
fill
=
X
)
self
.
optMenu
FontSize
.
pack
(
side
=
TOP
,
anchor
=
W
,
fill
=
X
)
frameFontSample
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
self
.
labelFontSample
.
pack
(
expand
=
TRUE
,
fill
=
BOTH
)
#frameIndent
...
...
@@ -515,79 +512,35 @@ class ConfigDialog(Toplevel):
fonts
.
sort
()
for
font
in
fonts
:
self
.
listFontName
.
insert
(
END
,
font
)
configuredFont
=
idleConf
.
Get
Default
(
'main'
,
'EditorWindow'
,
'font'
,
configuredFont
=
idleConf
.
Get
Option
(
'main'
,
'EditorWindow'
,
'font'
,
default
=
'courier'
)
if
configuredFont
in
fonts
:
currentFontIndex
=
fonts
.
index
(
configuredFont
)
self
.
listFontName
.
see
(
currentFontIndex
)
self
.
listFontName
.
select_set
(
currentFontIndex
)
##font size dropdown
fontSize
=
idleConf
.
GetDefault
(
'main'
,
'EditorWindow'
,
'font-size'
,
default
=
'12'
)
self
.
fontSize
.
set
(
fontSize
)
fontSize
=
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
'font-size'
,
default
=
'12'
)
self
.
optMenuFontSize
.
SetMenu
((
'10'
,
'11'
,
'12'
,
'13'
,
'14'
,
'16'
,
'18'
,
'20'
,
'22'
),
fontSize
)
##font sample
self
.
SetFontSample
()
def
LoadTabCfg
(
self
):
##indent type radibuttons
spaceIndent
=
idleConf
.
Get
Default
(
'main'
,
'Indent'
,
'use-spaces'
,
spaceIndent
=
idleConf
.
Get
Option
(
'main'
,
'Indent'
,
'use-spaces'
,
default
=
1
,
type
=
'bool'
)
self
.
indentType
.
set
(
spaceIndent
)
##indent sizes
spaceNum
=
idleConf
.
Get
Default
(
'main'
,
'Indent'
,
'num-spaces'
,
spaceNum
=
idleConf
.
Get
Option
(
'main'
,
'Indent'
,
'num-spaces'
,
default
=
4
,
type
=
'int'
)
tabCols
=
idleConf
.
Get
Default
(
'main'
,
'Indent'
,
'tab-cols'
,
tabCols
=
idleConf
.
Get
Option
(
'main'
,
'Indent'
,
'tab-cols'
,
default
=
4
,
type
=
'int'
)
self
.
spaceNum
.
set
(
spaceNum
)
self
.
tabCols
.
set
(
tabCols
)
#def LoadOptionMenu(self, optMenu, optList, optVar, optVal=None,
# command=None):
def
LoadOptionMenu
(
self
,
optMenu
,
optVar
,
optVal
=
None
,
command
=
None
):
"""
Load the relevant list of values into an OptionMenu and set
selected value if required.
"""
params
=
{
'cfg'
:
None
,
'section'
:
None
,
'optList'
:
None
,
'optVar'
:
None
,
'optVal'
:
None
,
'command'
:
None
}
if
optMenu
==
self
.
optMenuHighlightTarget
:
params
[
'cfg'
]
=
idleConf
.
userCfg
[
'highlight'
]
# if
# params['section']=idleconf.userCfg['main'].GetDef('EditorWindow',
# 'theme')
#
# params['optVar']=self.HighlightTarget
# params['optList']=idleconf.defaultCfg['main'].options(params.Section)
# else: # a default theme
# pass
#params.optList=idleConf
#if not params.optVar.get(): #no value set yet (initial load)
# params.optVal=
#if params.section: #we're asking to load a list of option names
# optList=params.cfg
#elif optMenu == xx:
#else:
#if self.HighlightTarget.get(): #if there was a value set (reload)
# params.optVal=self.HighlightTarget.get()
#else: #no value set yet (initial load)
#if not params.optVar.get(): #no value set yet (initial load)
menu
=
optMenu
[
'menu'
]
print
menu
menu
.
delete
(
0
,
END
)
for
item
in
optList
:
menu
.
add_command
(
label
=
item
,
command
=
command
)
if
optVal
:
optVar
.
set
(
optVal
)
elif
optList
:
optVar
.
set
(
optList
[
0
])
def
LoadThemeLists
(
self
):
##default themes
pass
def
LoadConfigs
(
self
):
"""
...
...
@@ -598,6 +551,7 @@ class ConfigDialog(Toplevel):
self
.
LoadFontCfg
()
self
.
LoadTabCfg
()
### highlighting page
self
.
LoadThemeLists
()
### keys page
### help page
### general page
...
...
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