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
429a86af
Kaydet (Commit)
429a86af
authored
Eki 23, 2001
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
font/tabs config dialog page now reads its data from the config file
üst
c77db345
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
30 deletions
+108
-30
config-main.def
Lib/idlelib/config-main.def
+17
-1
configDialog.py
Lib/idlelib/configDialog.py
+57
-14
configHandler.py
Lib/idlelib/configHandler.py
+34
-15
No files found.
Lib/idlelib/config-main.def
Dosyayı görüntüle @
429a86af
...
...
@@ -17,7 +17,6 @@
# ~/.idlerc/idle-extensions.cfg the user extension config file
# ~/.idlerc/idle-highlight.cfg the user highlighting config file
# ~/.idlerc/idle-keys.cfg the user keybinding config file
# XXX what about Windows?
#
# Any options the user saves through the config dialog will be saved to
# the relevant user config file. Reverting any general setting to the
...
...
@@ -29,8 +28,25 @@
[General]
run-in-separate-process= 1
help-browser= ""
[HelpFiles]
idle="IDLE _Help",""
python="_Python Documentation",""
#additional help sources
1=
2=
3=
4=
5=
6=
7=
8=
9=
10=
[EditorWindow]
editor-on-startup= 0
width= 80
height= 24
font= courier
...
...
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
429a86af
...
...
@@ -43,6 +43,9 @@ class ConfigDialog(Toplevel):
self
.
bind
(
'<Alt-k>'
,
self
.
ChangePageBinding
)
self
.
bind
(
'<Alt-g>'
,
self
.
ChangePageBinding
)
#self.LoadOptMenuHighlightTarget()
self
.
LoadConfigs
()
self
.
wait_window
()
def
Cancel
(
self
):
...
...
@@ -121,8 +124,11 @@ class ConfigDialog(Toplevel):
self
.
frameHighlightSample
.
update
()
#redraw after dialog
self
.
labelTestSample
.
update
()
def
SetFontSample
(
self
,
event
):
self
.
newFont
.
config
(
size
=
self
.
fontSize
.
get
(),
weight
=
NORMAL
,
def
SetFontSampleBinding
(
self
,
event
):
self
.
SetFontSample
()
def
SetFontSample
(
self
):
self
.
editFont
.
config
(
size
=
self
.
fontSize
.
get
(),
weight
=
NORMAL
,
family
=
self
.
listFontName
.
get
(
self
.
listFontName
.
curselection
()[
0
]))
def
CreateWidgets
(
self
):
...
...
@@ -179,7 +185,7 @@ class ConfigDialog(Toplevel):
self
.
spaceNum
=
IntVar
()
self
.
tabCols
=
IntVar
()
self
.
indentType
=
IntVar
()
self
.
new
Font
=
tkFont
.
Font
(
self
,(
'courier'
,
12
,
'normal'
))
self
.
edit
Font
=
tkFont
.
Font
(
self
,(
'courier'
,
12
,
'normal'
))
##widget creation
#body frame
frame
=
Frame
(
self
.
framePages
,
borderwidth
=
2
,
relief
=
RAISED
)
...
...
@@ -194,21 +200,21 @@ class ConfigDialog(Toplevel):
text
=
'Font :'
)
self
.
listFontName
=
Listbox
(
frameFontName
,
height
=
5
,
takefocus
=
FALSE
,
exportselection
=
FALSE
)
self
.
listFontName
.
bind
(
'<<ListboxSelect>>'
,
self
.
SetFontSample
)
self
.
listFontName
.
bind
(
'<<ListboxSelect>>'
,
self
.
SetFontSample
Binding
)
scrollFont
=
Scrollbar
(
frameFontName
)
self
.
LoadFontList
()
#
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
.
SetFontSample
}
keyArgs
=
{
'command'
:
self
.
SetFontSample
Binding
}
optFontSize
=
apply
(
OptionMenu
,
args
,
keyArgs
)
#optFontSize.bind('<<MenuSelect>>',self.SetFontSample)
frameFontSample
=
Frame
(
frameFont
,
relief
=
SOLID
,
borderwidth
=
1
)
self
.
labelFontSample
=
Label
(
frameFontSample
,
text
=
'AaBbCcDdEe
\n
FfGgHhIiJjK
\n
1234567890
\n
#:+=(){}[]'
,
justify
=
LEFT
,
font
=
self
.
new
Font
)
justify
=
LEFT
,
font
=
self
.
edit
Font
)
#frameIndent
labelIndentTitle
=
Label
(
frameIndent
,
text
=
'Set Indentation Defaults'
)
frameIndentType
=
Frame
(
frameIndent
)
...
...
@@ -216,9 +222,9 @@ class ConfigDialog(Toplevel):
labelIndentTypeTitle
=
Label
(
frameIndentType
,
text
=
'Choose indentation type :'
)
radioUseSpaces
=
Radiobutton
(
frameIndentType
,
variable
=
self
.
indentType
,
value
=
0
,
text
=
'Tab key inserts spaces'
)
value
=
1
,
text
=
'Tab key inserts spaces'
)
radioUseTabs
=
Radiobutton
(
frameIndentType
,
variable
=
self
.
indentType
,
value
=
1
,
text
=
'Tab key inserts tabs'
)
value
=
0
,
text
=
'Tab key inserts tabs'
)
labelIndentSizeTitle
=
Label
(
frameIndentSize
,
text
=
'Choose indentation size :'
)
labelSpaceNumTitle
=
Label
(
frameIndentSize
,
justify
=
LEFT
,
...
...
@@ -503,15 +509,36 @@ class ConfigDialog(Toplevel):
return
frame
def
LoadFontList
(
self
):
def
LoadFontCfg
(
self
):
##base editor font selection list
fonts
=
list
(
tkFont
.
families
(
self
))
fonts
.
sort
()
for
font
in
fonts
:
self
.
listFontName
.
insert
(
END
,
font
)
currentFontIndex
=
fonts
.
index
(
'courier'
)
self
.
listFontName
.
see
(
currentFontIndex
)
self
.
listFontName
.
select_set
(
currentFontIndex
)
self
.
fontSize
.
set
(
'12'
)
configuredFont
=
idleConf
.
GetDefault
(
'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
)
##font sample
self
.
SetFontSample
()
def
LoadTabCfg
(
self
):
##indent type radibuttons
spaceIndent
=
idleConf
.
GetDefault
(
'main'
,
'Indent'
,
'use-spaces'
,
default
=
1
,
type
=
'bool'
)
self
.
indentType
.
set
(
spaceIndent
)
##indent sizes
spaceNum
=
idleConf
.
GetDefault
(
'main'
,
'Indent'
,
'num-spaces'
,
default
=
4
,
type
=
'int'
)
tabCols
=
idleConf
.
GetDefault
(
'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):
...
...
@@ -562,7 +589,23 @@ class ConfigDialog(Toplevel):
elif
optList
:
optVar
.
set
(
optList
[
0
])
def
LoadConfigs
(
self
):
"""
load configuration from default and user config files and populate
the widgets on the config dialog pages.
"""
### fonts / tabs page
self
.
LoadFontCfg
()
self
.
LoadTabCfg
()
### highlighting page
### keys page
### help page
### general page
def
SaveConfigs
(
self
):
"""
save configuration changes to user config files.
"""
pass
if
__name__
==
'__main__'
:
...
...
Lib/idlelib/configHandler.py
Dosyayı görüntüle @
429a86af
...
...
@@ -21,29 +21,31 @@ class IdleConfParser(ConfigParser):
self
.
file
=
cfgFile
ConfigParser
.
__init__
(
self
,
defaults
=
cfgDefaults
)
def
GetInt
(
self
,
section
,
option
):
"""
Get an option value as an integer
"""
return
self
.
Get
(
section
,
option
,
type
=
'int'
)
def
GetBool
(
self
,
section
,
option
):
"""
Get an option value as a boolean
"""
return
self
.
Get
(
section
,
option
,
type
=
'bool'
)
# def GetInt(self, section, option, *kw
):
#
"""
#
Get an option value as an integer
#
"""
# return self.Get(section, option, type='int', *kw
)
#
# def GetBool(self, section, option, **kw
):
#
"""
#
Get an option value as a boolean
#
"""
# return self.Get(section, option, type='bool', *kw
)
def
Get
(
self
,
section
,
option
,
raw
=
0
,
vars
=
None
,
default
=
None
,
type
=
None
):
# def Get(self, section, option, raw=0, vars=None, default=None,
# type=None):
def
Get
(
self
,
section
,
option
,
default
=
None
,
type
=
None
):
"""
Get an option value for given section/option or return default.
If type is specified, return as type.
"""
if
type
==
'bool'
:
getVal
=
self
.
getbool
if
type
==
'bool'
:
getVal
=
self
.
getbool
ean
elif
type
==
'int'
:
getVal
=
self
.
getint
else
:
getVal
=
self
.
get
if
self
.
has_option
(
section
,
option
):
return
getVal
(
section
,
option
,
raw
,
vars
)
#return getVal(section, option, raw, vars)
return
getVal
(
section
,
option
)
else
:
return
default
...
...
@@ -136,6 +138,23 @@ class IdleConf:
self
.
defaultCfg
[
cfgType
]
=
IdleConfParser
(
defCfgFiles
[
cfgType
])
self
.
userCfg
[
cfgType
]
=
IdleUserConfParser
(
usrCfgFiles
[
cfgType
])
def
GetDefault
(
self
,
configType
,
section
,
option
,
default
=
None
,
type
=
None
):
"""
Get an option value for given config type and given general
configuration section/option or return a default. If type is specified,
return as type. Firstly the user configuration is checked, with a
fallback to the default configuration, and a final 'catch all'
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
self
.
userCfg
[
configType
]
.
has_option
(
section
,
option
):
return
self
.
userCfg
[
configType
]
.
Get
(
section
,
option
,
type
=
type
)
elif
self
.
defaultCfg
[
configType
]
.
has_option
(
section
,
option
):
return
self
.
defaultCfg
[
configType
]
.
Get
(
section
,
option
,
type
=
type
)
else
:
return
default
def
LoadCfgFiles
(
self
):
"""
load all configuration files.
...
...
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