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
5427df26
Kaydet (Commit)
5427df26
authored
Agu 04, 2014
tarafından
Terry Jan Reedy
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge with 3.4
üst
1ab3dc92
4036d87f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
582 additions
and
548 deletions
+582
-548
configDialog.py
Lib/idlelib/configDialog.py
+582
-548
No files found.
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
5427df26
...
@@ -31,42 +31,44 @@ class ConfigDialog(Toplevel):
...
@@ -31,42 +31,44 @@ class ConfigDialog(Toplevel):
"""
"""
Toplevel
.
__init__
(
self
,
parent
)
Toplevel
.
__init__
(
self
,
parent
)
self
.
parent
=
parent
self
.
parent
=
parent
if
_htest
:
parent
.
instance_dict
=
{}
self
.
wm_withdraw
()
self
.
wm_withdraw
()
self
.
configure
(
borderwidth
=
5
)
self
.
configure
(
borderwidth
=
5
)
self
.
title
(
'IDLE Preferences'
)
self
.
title
(
'IDLE Preferences'
)
if
_htest
:
self
.
geometry
(
parent
.
instance_dict
=
{}
"+
%
d+
%
d"
%
(
parent
.
winfo_rootx
()
+
20
,
self
.
geometry
(
"+
%
d+
%
d"
%
(
parent
.
winfo_rootx
()
+
20
,
parent
.
winfo_rooty
()
+
(
30
if
not
_htest
else
150
)))
parent
.
winfo_rooty
()
+
(
30
if
not
_htest
else
150
)))
#Theme Elements. Each theme element key is its display name.
#Theme Elements. Each theme element key is its display name.
#The first value of the tuple is the sample area tag name.
#The first value of the tuple is the sample area tag name.
#The second value is the display name list sort index.
#The second value is the display name list sort index.
self
.
themeElements
=
{
'Normal Text'
:(
'normal'
,
'00'
),
self
.
themeElements
=
{
'Python Keywords'
:(
'keyword'
,
'01'
),
'Normal Text'
:(
'normal'
,
'00'
),
'Python Definitions'
:(
'definition'
,
'02'
),
'Python Keywords'
:(
'keyword'
,
'01'
),
'Python Definitions'
:(
'definition'
,
'02'
),
'Python Builtins'
:(
'builtin'
,
'03'
),
'Python Builtins'
:(
'builtin'
,
'03'
),
'Python Comments'
:(
'comment'
,
'04'
),
'Python Comments'
:(
'comment'
,
'04'
),
'Python Strings'
:(
'string'
,
'05'
),
'Python Strings'
:(
'string'
,
'05'
),
'Selected Text'
:(
'hilite'
,
'06'
),
'Selected Text'
:(
'hilite'
,
'06'
),
'Found Text'
:(
'hit'
,
'07'
),
'Found Text'
:(
'hit'
,
'07'
),
'Cursor'
:(
'cursor'
,
'08'
),
'Cursor'
:(
'cursor'
,
'08'
),
'Error Text'
:(
'error'
,
'09'
),
'Error Text'
:(
'error'
,
'09'
),
'Shell Normal Text'
:(
'console'
,
'10'
),
'Shell Normal Text'
:(
'console'
,
'10'
),
'Shell Stdout Text'
:(
'stdout'
,
'11'
),
'Shell Stdout Text'
:(
'stdout'
,
'11'
),
'Shell Stderr Text'
:(
'stderr'
,
'12'
),
'Shell Stderr Text'
:(
'stderr'
,
'12'
),
}
}
self
.
ResetChangedItems
()
#load initial values in changed items dict
self
.
ResetChangedItems
()
#load initial values in changed items dict
self
.
CreateWidgets
()
self
.
CreateWidgets
()
self
.
resizable
(
height
=
FALSE
,
width
=
FALSE
)
self
.
resizable
(
height
=
FALSE
,
width
=
FALSE
)
self
.
transient
(
parent
)
self
.
transient
(
parent
)
self
.
grab_set
()
self
.
grab_set
()
self
.
protocol
(
"WM_DELETE_WINDOW"
,
self
.
Cancel
)
self
.
protocol
(
"WM_DELETE_WINDOW"
,
self
.
Cancel
)
self
.
tabPages
.
focus_set
()
self
.
tabPages
.
focus_set
()
#key bindings for this dialog
#key bindings for this dialog
#self.bind('<Escape>',self.Cancel) #dismiss dialog, no save
#self.bind('<Escape>',
self.Cancel) #dismiss dialog, no save
#self.bind('<Alt-a>',self.Apply) #apply changes, save
#self.bind('<Alt-a>',
self.Apply) #apply changes, save
#self.bind('<F1>',self.Help) #context help
#self.bind('<F1>',
self.Help) #context help
self
.
LoadConfigs
()
self
.
LoadConfigs
()
self
.
AttachVarCallbacks
()
#avoid callbacks during LoadConfigs
self
.
AttachVarCallbacks
()
#avoid callbacks during LoadConfigs
...
@@ -76,40 +78,40 @@ class ConfigDialog(Toplevel):
...
@@ -76,40 +78,40 @@ class ConfigDialog(Toplevel):
def
CreateWidgets
(
self
):
def
CreateWidgets
(
self
):
self
.
tabPages
=
TabbedPageSet
(
self
,
self
.
tabPages
=
TabbedPageSet
(
self
,
page_names
=
[
'Fonts/Tabs'
,
'Highlighting'
,
'Keys'
,
'General'
])
page_names
=
[
'Fonts/Tabs'
,
'Highlighting'
,
'Keys'
,
'General'
])
frameActionButtons
=
Frame
(
self
,
pady
=
2
)
frameActionButtons
=
Frame
(
self
,
pady
=
2
)
#action buttons
#action buttons
if
macosxSupport
.
isAquaTk
():
if
macosxSupport
.
isAquaTk
():
# Changing the default padding on OSX results in unreadable
# Changing the default padding on OSX results in unreadable
# text in the buttons
# text in the buttons
paddingArgs
=
{}
paddingArgs
=
{}
else
:
else
:
paddingArgs
=
{
'padx'
:
6
,
'pady'
:
3
}
paddingArgs
=
{
'padx'
:
6
,
'pady'
:
3
}
# Comment out button creation and packing until implement self.Help
# Comment out button creation and packing until implement self.Help
## self.buttonHelp = Button(frameActionButtons,text='Help',
## self.buttonHelp = Button(frameActionButtons,
text='Help',
## command=self.Help,takefocus=FALSE,
## command=self.Help,
takefocus=FALSE,
## **paddingArgs)
## **paddingArgs)
self
.
buttonOk
=
Button
(
frameActionButtons
,
text
=
'Ok'
,
self
.
buttonOk
=
Button
(
command
=
self
.
Ok
,
takefocus
=
FALSE
,
frameActionButtons
,
text
=
'Ok'
,
**
paddingArgs
)
command
=
self
.
Ok
,
takefocus
=
FALSE
,
**
paddingArgs
)
self
.
buttonApply
=
Button
(
frameActionButtons
,
text
=
'Apply'
,
self
.
buttonApply
=
Button
(
command
=
self
.
Apply
,
takefocus
=
FALSE
,
frameActionButtons
,
text
=
'Apply'
,
**
paddingArgs
)
command
=
self
.
Apply
,
takefocus
=
FALSE
,
**
paddingArgs
)
self
.
buttonCancel
=
Button
(
frameActionButtons
,
text
=
'Cancel'
,
self
.
buttonCancel
=
Button
(
command
=
self
.
Cancel
,
takefocus
=
FALSE
,
frameActionButtons
,
text
=
'Cancel'
,
**
paddingArgs
)
command
=
self
.
Cancel
,
takefocus
=
FALSE
,
**
paddingArgs
)
self
.
CreatePageFontTab
()
self
.
CreatePageFontTab
()
self
.
CreatePageHighlight
()
self
.
CreatePageHighlight
()
self
.
CreatePageKeys
()
self
.
CreatePageKeys
()
self
.
CreatePageGeneral
()
self
.
CreatePageGeneral
()
## self.buttonHelp.pack(side=RIGHT,padx=5)
## self.buttonHelp.pack(side=RIGHT,
padx=5)
self
.
buttonOk
.
pack
(
side
=
LEFT
,
padx
=
5
)
self
.
buttonOk
.
pack
(
side
=
LEFT
,
padx
=
5
)
self
.
buttonApply
.
pack
(
side
=
LEFT
,
padx
=
5
)
self
.
buttonApply
.
pack
(
side
=
LEFT
,
padx
=
5
)
self
.
buttonCancel
.
pack
(
side
=
LEFT
,
padx
=
5
)
self
.
buttonCancel
.
pack
(
side
=
LEFT
,
padx
=
5
)
frameActionButtons
.
pack
(
side
=
BOTTOM
)
frameActionButtons
.
pack
(
side
=
BOTTOM
)
Frame
(
self
,
height
=
2
,
borderwidth
=
0
)
.
pack
(
side
=
BOTTOM
)
Frame
(
self
,
height
=
2
,
borderwidth
=
0
)
.
pack
(
side
=
BOTTOM
)
self
.
tabPages
.
pack
(
side
=
TOP
,
expand
=
TRUE
,
fill
=
BOTH
)
self
.
tabPages
.
pack
(
side
=
TOP
,
expand
=
TRUE
,
fill
=
BOTH
)
def
CreatePageFontTab
(
self
):
def
CreatePageFontTab
(
self
):
parent
=
self
.
parent
parent
=
self
.
parent
...
@@ -117,63 +119,66 @@ class ConfigDialog(Toplevel):
...
@@ -117,63 +119,66 @@ class ConfigDialog(Toplevel):
self
.
fontBold
=
BooleanVar
(
parent
)
self
.
fontBold
=
BooleanVar
(
parent
)
self
.
fontName
=
StringVar
(
parent
)
self
.
fontName
=
StringVar
(
parent
)
self
.
spaceNum
=
IntVar
(
parent
)
self
.
spaceNum
=
IntVar
(
parent
)
self
.
editFont
=
tkFont
.
Font
(
parent
,
(
'courier'
,
10
,
'normal'
))
self
.
editFont
=
tkFont
.
Font
(
parent
,
(
'courier'
,
10
,
'normal'
))
##widget creation
##widget creation
#body frame
#body frame
frame
=
self
.
tabPages
.
pages
[
'Fonts/Tabs'
]
.
frame
frame
=
self
.
tabPages
.
pages
[
'Fonts/Tabs'
]
.
frame
#body section frames
#body section frames
frameFont
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameFont
=
LabelFrame
(
text
=
' Base Editor Font '
)
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Base Editor Font '
)
frameIndent
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameIndent
=
LabelFrame
(
text
=
' Indentation Width '
)
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Indentation Width '
)
#frameFont
#frameFont
frameFontName
=
Frame
(
frameFont
)
frameFontName
=
Frame
(
frameFont
)
frameFontParam
=
Frame
(
frameFont
)
frameFontParam
=
Frame
(
frameFont
)
labelFontNameTitle
=
Label
(
frameFontName
,
justify
=
LEFT
,
labelFontNameTitle
=
Label
(
text
=
'Font Face :'
)
frameFontName
,
justify
=
LEFT
,
text
=
'Font Face :'
)
self
.
listFontName
=
Listbox
(
frameFontName
,
height
=
5
,
takefocus
=
FALSE
,
self
.
listFontName
=
Listbox
(
exportselection
=
FALSE
)
frameFontName
,
height
=
5
,
takefocus
=
FALSE
,
exportselection
=
FALSE
)
self
.
listFontName
.
bind
(
'<ButtonRelease-1>'
,
self
.
OnListFontButtonRelease
)
self
.
listFontName
.
bind
(
scrollFont
=
Scrollbar
(
frameFontName
)
'<ButtonRelease-1>'
,
self
.
OnListFontButtonRelease
)
scrollFont
=
Scrollbar
(
frameFontName
)
scrollFont
.
config
(
command
=
self
.
listFontName
.
yview
)
scrollFont
.
config
(
command
=
self
.
listFontName
.
yview
)
self
.
listFontName
.
config
(
yscrollcommand
=
scrollFont
.
set
)
self
.
listFontName
.
config
(
yscrollcommand
=
scrollFont
.
set
)
labelFontSizeTitle
=
Label
(
frameFontParam
,
text
=
'Size :'
)
labelFontSizeTitle
=
Label
(
frameFontParam
,
text
=
'Size :'
)
self
.
optMenuFontSize
=
DynOptionMenu
(
frameFontParam
,
self
.
fontSize
,
None
,
self
.
optMenuFontSize
=
DynOptionMenu
(
command
=
self
.
SetFontSample
)
frameFontParam
,
self
.
fontSize
,
None
,
command
=
self
.
SetFontSample
)
checkFontBold
=
Checkbutton
(
frameFontParam
,
variable
=
self
.
fontBold
,
checkFontBold
=
Checkbutton
(
onvalue
=
1
,
offvalue
=
0
,
text
=
'Bold'
,
command
=
self
.
SetFontSample
)
frameFontParam
,
variable
=
self
.
fontBold
,
onvalue
=
1
,
frameFontSample
=
Frame
(
frameFont
,
relief
=
SOLID
,
borderwidth
=
1
)
offvalue
=
0
,
text
=
'Bold'
,
command
=
self
.
SetFontSample
)
self
.
labelFontSample
=
Label
(
frameFontSample
,
frameFontSample
=
Frame
(
frameFont
,
relief
=
SOLID
,
borderwidth
=
1
)
text
=
'AaBbCcDdEe
\n
FfGgHhIiJjK
\n
1234567890
\n
#:+=(){}[]'
,
self
.
labelFontSample
=
Label
(
justify
=
LEFT
,
font
=
self
.
editFont
)
frameFontSample
,
justify
=
LEFT
,
font
=
self
.
editFont
,
text
=
'AaBbCcDdEe
\n
FfGgHhIiJjK
\n
1234567890
\n
#:+=(){}[]'
)
#frameIndent
#frameIndent
frameIndentSize
=
Frame
(
frameIndent
)
frameIndentSize
=
Frame
(
frameIndent
)
labelSpaceNumTitle
=
Label
(
frameIndentSize
,
justify
=
LEFT
,
labelSpaceNumTitle
=
Label
(
text
=
'Python Standard: 4 Spaces!'
)
frameIndentSize
,
justify
=
LEFT
,
self
.
scaleSpaceNum
=
Scale
(
frameIndentSize
,
variable
=
self
.
spaceNum
,
text
=
'Python Standard: 4 Spaces!'
)
orient
=
'horizontal'
,
self
.
scaleSpaceNum
=
Scale
(
tickinterval
=
2
,
from_
=
2
,
to
=
16
)
frameIndentSize
,
variable
=
self
.
spaceNum
,
orient
=
'horizontal'
,
tickinterval
=
2
,
from_
=
2
,
to
=
16
)
#widget packing
#widget packing
#body
#body
frameFont
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameFont
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameIndent
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
frameIndent
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
#frameFont
#frameFont
frameFontName
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameFontName
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameFontParam
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameFontParam
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
labelFontNameTitle
.
pack
(
side
=
TOP
,
anchor
=
W
)
labelFontNameTitle
.
pack
(
side
=
TOP
,
anchor
=
W
)
self
.
listFontName
.
pack
(
side
=
LEFT
,
expand
=
TRUE
,
fill
=
X
)
self
.
listFontName
.
pack
(
side
=
LEFT
,
expand
=
TRUE
,
fill
=
X
)
scrollFont
.
pack
(
side
=
LEFT
,
fill
=
Y
)
scrollFont
.
pack
(
side
=
LEFT
,
fill
=
Y
)
labelFontSizeTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
)
labelFontSizeTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
)
self
.
optMenuFontSize
.
pack
(
side
=
LEFT
,
anchor
=
W
)
self
.
optMenuFontSize
.
pack
(
side
=
LEFT
,
anchor
=
W
)
checkFontBold
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
20
)
checkFontBold
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
20
)
frameFontSample
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameFontSample
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
self
.
labelFontSample
.
pack
(
expand
=
TRUE
,
fill
=
BOTH
)
self
.
labelFontSample
.
pack
(
expand
=
TRUE
,
fill
=
BOTH
)
#frameIndent
#frameIndent
frameIndentSize
.
pack
(
side
=
TOP
,
fill
=
X
)
frameIndentSize
.
pack
(
side
=
TOP
,
fill
=
X
)
labelSpaceNumTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
)
labelSpaceNumTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
)
self
.
scaleSpaceNum
.
pack
(
side
=
TOP
,
padx
=
5
,
fill
=
X
)
self
.
scaleSpaceNum
.
pack
(
side
=
TOP
,
padx
=
5
,
fill
=
X
)
return
frame
return
frame
def
CreatePageHighlight
(
self
):
def
CreatePageHighlight
(
self
):
...
@@ -188,84 +193,100 @@ class ConfigDialog(Toplevel):
...
@@ -188,84 +193,100 @@ class ConfigDialog(Toplevel):
##widget creation
##widget creation
#body frame
#body frame
frame
=
self
.
tabPages
.
pages
[
'Highlighting'
]
.
frame
frame
=
self
.
tabPages
.
pages
[
'Highlighting'
]
.
frame
#body section frames
#body section frames
frameCustom
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameCustom
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Custom Highlighting '
)
text
=
' Custom Highlighting '
)
frameTheme
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameTheme
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Highlighting Theme '
)
text
=
' Highlighting Theme '
)
#frameCustom
#frameCustom
self
.
textHighlightSample
=
Text
(
frameCustom
,
relief
=
SOLID
,
borderwidth
=
1
,
self
.
textHighlightSample
=
Text
(
font
=
(
'courier'
,
12
,
''
),
cursor
=
'hand2'
,
width
=
21
,
height
=
11
,
frameCustom
,
relief
=
SOLID
,
borderwidth
=
1
,
takefocus
=
FALSE
,
highlightthickness
=
0
,
wrap
=
NONE
)
font
=
(
'courier'
,
12
,
''
),
cursor
=
'hand2'
,
width
=
21
,
height
=
11
,
takefocus
=
FALSE
,
highlightthickness
=
0
,
wrap
=
NONE
)
text
=
self
.
textHighlightSample
text
=
self
.
textHighlightSample
text
.
bind
(
'<Double-Button-1>'
,
lambda
e
:
'break'
)
text
.
bind
(
'<Double-Button-1>'
,
lambda
e
:
'break'
)
text
.
bind
(
'<B1-Motion>'
,
lambda
e
:
'break'
)
text
.
bind
(
'<B1-Motion>'
,
lambda
e
:
'break'
)
textAndTags
=
((
'#you can click here'
,
'comment'
),(
'
\n
'
,
'normal'
),
textAndTags
=
(
(
'#to choose items'
,
'comment'
),(
'
\n
'
,
'normal'
),(
'def'
,
'keyword'
),
(
'#you can click here'
,
'comment'
),
(
'
\n
'
,
'normal'
),
(
' '
,
'normal'
),(
'func'
,
'definition'
),(
'(param):'
,
'normal'
),
(
'#to choose items'
,
'comment'
),
(
'
\n
'
,
'normal'
),
(
'
\n
'
,
'normal'
),(
'"""string"""'
,
'string'
),(
'
\n
var0 = '
,
'normal'
),
(
'def'
,
'keyword'
),
(
' '
,
'normal'
),
(
"'string'"
,
'string'
),(
'
\n
var1 = '
,
'normal'
),(
"'selected'"
,
'hilite'
),
(
'func'
,
'definition'
),
(
'(param):
\n
'
,
'normal'
),
(
'
\n
var2 = '
,
'normal'
),(
"'found'"
,
'hit'
),
(
'"""string"""'
,
'string'
),
(
'
\n
var0 = '
,
'normal'
),
(
'
\n
var3 = '
,
'normal'
),(
'list'
,
'builtin'
),
(
'('
,
'normal'
),
(
"'string'"
,
'string'
),
(
'
\n
var1 = '
,
'normal'
),
(
'None'
,
'keyword'
),(
')
\n\n
'
,
'normal'
),
(
"'selected'"
,
'hilite'
),
(
'
\n
var2 = '
,
'normal'
),
(
' error '
,
'error'
),(
' '
,
'normal'
),(
'cursor |'
,
'cursor'
),
(
"'found'"
,
'hit'
),
(
'
\n
var3 = '
,
'normal'
),
(
'
\n
'
,
'normal'
),(
'shell'
,
'console'
),(
' '
,
'normal'
),(
'stdout'
,
'stdout'
),
(
'list'
,
'builtin'
),
(
'('
,
'normal'
),
(
' '
,
'normal'
),(
'stderr'
,
'stderr'
),(
'
\n
'
,
'normal'
))
(
'None'
,
'keyword'
),
(
')
\n\n
'
,
'normal'
),
(
' error '
,
'error'
),
(
' '
,
'normal'
),
(
'cursor |'
,
'cursor'
),
(
'
\n
'
,
'normal'
),
(
'shell'
,
'console'
),
(
' '
,
'normal'
),
(
'stdout'
,
'stdout'
),
(
' '
,
'normal'
),
(
'stderr'
,
'stderr'
),
(
'
\n
'
,
'normal'
))
for
txTa
in
textAndTags
:
for
txTa
in
textAndTags
:
text
.
insert
(
END
,
txTa
[
0
],
txTa
[
1
])
text
.
insert
(
END
,
txTa
[
0
],
txTa
[
1
])
for
element
in
self
.
themeElements
:
for
element
in
self
.
themeElements
:
text
.
tag_bind
(
self
.
themeElements
[
element
][
0
],
'<ButtonPress-1>'
,
def
tem
(
event
,
elem
=
element
):
lambda
event
,
elem
=
element
:
event
.
widget
.
winfo_toplevel
()
event
.
widget
.
winfo_toplevel
()
.
highlightTarget
.
set
(
elem
)
.
highlightTarget
.
set
(
elem
))
text
.
tag_bind
(
self
.
themeElements
[
element
][
0
],
'<ButtonPress-1>'
,
tem
)
text
.
config
(
state
=
DISABLED
)
text
.
config
(
state
=
DISABLED
)
self
.
frameColourSet
=
Frame
(
frameCustom
,
relief
=
SOLID
,
borderwidth
=
1
)
self
.
frameColourSet
=
Frame
(
frameCustom
,
relief
=
SOLID
,
borderwidth
=
1
)
frameFgBg
=
Frame
(
frameCustom
)
frameFgBg
=
Frame
(
frameCustom
)
buttonSetColour
=
Button
(
self
.
frameColourSet
,
text
=
'Choose Colour for :'
,
buttonSetColour
=
Button
(
command
=
self
.
GetColour
,
highlightthickness
=
0
)
self
.
frameColourSet
,
text
=
'Choose Colour for :'
,
self
.
optMenuHighlightTarget
=
DynOptionMenu
(
self
.
frameColourSet
,
command
=
self
.
GetColour
,
highlightthickness
=
0
)
self
.
highlightTarget
,
None
,
highlightthickness
=
0
)
#,command=self.SetHighlightTargetBinding
self
.
optMenuHighlightTarget
=
DynOptionMenu
(
self
.
radioFg
=
Radiobutton
(
frameFgBg
,
variable
=
self
.
fgHilite
,
self
.
frameColourSet
,
self
.
highlightTarget
,
None
,
value
=
1
,
text
=
'Foreground'
,
command
=
self
.
SetColourSampleBinding
)
highlightthickness
=
0
)
#, command=self.SetHighlightTargetBinding
self
.
radioBg
=
Radiobutton
(
frameFgBg
,
variable
=
self
.
fgHilite
,
self
.
radioFg
=
Radiobutton
(
value
=
0
,
text
=
'Background'
,
command
=
self
.
SetColourSampleBinding
)
frameFgBg
,
variable
=
self
.
fgHilite
,
value
=
1
,
text
=
'Foreground'
,
command
=
self
.
SetColourSampleBinding
)
self
.
radioBg
=
Radiobutton
(
frameFgBg
,
variable
=
self
.
fgHilite
,
value
=
0
,
text
=
'Background'
,
command
=
self
.
SetColourSampleBinding
)
self
.
fgHilite
.
set
(
1
)
self
.
fgHilite
.
set
(
1
)
buttonSaveCustomTheme
=
Button
(
frameCustom
,
buttonSaveCustomTheme
=
Button
(
text
=
'Save as New Custom Theme'
,
command
=
self
.
SaveAsNewTheme
)
frameCustom
,
text
=
'Save as New Custom Theme'
,
command
=
self
.
SaveAsNewTheme
)
#frameTheme
#frameTheme
labelTypeTitle
=
Label
(
frameTheme
,
text
=
'Select : '
)
labelTypeTitle
=
Label
(
frameTheme
,
text
=
'Select : '
)
self
.
radioThemeBuiltin
=
Radiobutton
(
frameTheme
,
variable
=
self
.
themeIsBuiltin
,
self
.
radioThemeBuiltin
=
Radiobutton
(
value
=
1
,
command
=
self
.
SetThemeType
,
text
=
'a Built-in Theme'
)
frameTheme
,
variable
=
self
.
themeIsBuiltin
,
value
=
1
,
self
.
radioThemeCustom
=
Radiobutton
(
frameTheme
,
variable
=
self
.
themeIsBuiltin
,
command
=
self
.
SetThemeType
,
text
=
'a Built-in Theme'
)
value
=
0
,
command
=
self
.
SetThemeType
,
text
=
'a Custom Theme'
)
self
.
radioThemeCustom
=
Radiobutton
(
self
.
optMenuThemeBuiltin
=
DynOptionMenu
(
frameTheme
,
frameTheme
,
variable
=
self
.
themeIsBuiltin
,
value
=
0
,
self
.
builtinTheme
,
None
,
command
=
None
)
command
=
self
.
SetThemeType
,
text
=
'a Custom Theme'
)
self
.
optMenuThemeCustom
=
DynOptionMenu
(
frameTheme
,
self
.
optMenuThemeBuiltin
=
DynOptionMenu
(
self
.
customTheme
,
None
,
command
=
None
)
frameTheme
,
self
.
builtinTheme
,
None
,
command
=
None
)
self
.
buttonDeleteCustomTheme
=
Button
(
frameTheme
,
text
=
'Delete Custom Theme'
,
self
.
optMenuThemeCustom
=
DynOptionMenu
(
frameTheme
,
self
.
customTheme
,
None
,
command
=
None
)
self
.
buttonDeleteCustomTheme
=
Button
(
frameTheme
,
text
=
'Delete Custom Theme'
,
command
=
self
.
DeleteCustomTheme
)
command
=
self
.
DeleteCustomTheme
)
##widget packing
##widget packing
#body
#body
frameCustom
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameCustom
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameTheme
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
frameTheme
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
#frameCustom
#frameCustom
self
.
frameColourSet
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
X
)
self
.
frameColourSet
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
X
)
frameFgBg
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
0
)
frameFgBg
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
0
)
self
.
textHighlightSample
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
self
.
textHighlightSample
.
pack
(
fill
=
BOTH
)
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
buttonSetColour
.
pack
(
side
=
TOP
,
expand
=
TRUE
,
fill
=
X
,
padx
=
8
,
pady
=
4
)
buttonSetColour
.
pack
(
side
=
TOP
,
expand
=
TRUE
,
fill
=
X
,
padx
=
8
,
pady
=
4
)
self
.
optMenuHighlightTarget
.
pack
(
side
=
TOP
,
expand
=
TRUE
,
fill
=
X
,
padx
=
8
,
pady
=
3
)
self
.
optMenuHighlightTarget
.
pack
(
self
.
radioFg
.
pack
(
side
=
LEFT
,
anchor
=
E
)
side
=
TOP
,
expand
=
TRUE
,
fill
=
X
,
padx
=
8
,
pady
=
3
)
self
.
radioBg
.
pack
(
side
=
RIGHT
,
anchor
=
W
)
self
.
radioFg
.
pack
(
side
=
LEFT
,
anchor
=
E
)
buttonSaveCustomTheme
.
pack
(
side
=
BOTTOM
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
self
.
radioBg
.
pack
(
side
=
RIGHT
,
anchor
=
W
)
buttonSaveCustomTheme
.
pack
(
side
=
BOTTOM
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
#frameTheme
#frameTheme
labelTypeTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelTypeTitle
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
self
.
radioThemeBuiltin
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
)
self
.
radioThemeBuiltin
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
)
self
.
radioThemeCustom
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
2
)
self
.
radioThemeCustom
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
2
)
self
.
optMenuThemeBuiltin
.
pack
(
side
=
TOP
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
self
.
optMenuThemeBuiltin
.
pack
(
side
=
TOP
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
self
.
optMenuThemeCustom
.
pack
(
side
=
TOP
,
fill
=
X
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
self
.
optMenuThemeCustom
.
pack
(
side
=
TOP
,
fill
=
X
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
self
.
buttonDeleteCustomTheme
.
pack
(
side
=
TOP
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
self
.
buttonDeleteCustomTheme
.
pack
(
side
=
TOP
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
return
frame
return
frame
def
CreatePageKeys
(
self
):
def
CreatePageKeys
(
self
):
...
@@ -278,63 +299,69 @@ class ConfigDialog(Toplevel):
...
@@ -278,63 +299,69 @@ class ConfigDialog(Toplevel):
##widget creation
##widget creation
#body frame
#body frame
frame
=
self
.
tabPages
.
pages
[
'Keys'
]
.
frame
frame
=
self
.
tabPages
.
pages
[
'Keys'
]
.
frame
#body section frames
#body section frames
frameCustom
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameCustom
=
LabelFrame
(
text
=
' Custom Key Bindings '
)
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameKeySets
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Custom Key Bindings '
)
text
=
' Key Set '
)
frameKeySets
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Key Set '
)
#frameCustom
#frameCustom
frameTarget
=
Frame
(
frameCustom
)
frameTarget
=
Frame
(
frameCustom
)
labelTargetTitle
=
Label
(
frameTarget
,
text
=
'Action - Key(s)'
)
labelTargetTitle
=
Label
(
frameTarget
,
text
=
'Action - Key(s)'
)
scrollTargetY
=
Scrollbar
(
frameTarget
)
scrollTargetY
=
Scrollbar
(
frameTarget
)
scrollTargetX
=
Scrollbar
(
frameTarget
,
orient
=
HORIZONTAL
)
scrollTargetX
=
Scrollbar
(
frameTarget
,
orient
=
HORIZONTAL
)
self
.
listBindings
=
Listbox
(
frameTarget
,
takefocus
=
FALSE
,
self
.
listBindings
=
Listbox
(
exportselection
=
FALSE
)
frameTarget
,
takefocus
=
FALSE
,
exportselection
=
FALSE
)
self
.
listBindings
.
bind
(
'<ButtonRelease-1>'
,
self
.
KeyBindingSelected
)
self
.
listBindings
.
bind
(
'<ButtonRelease-1>'
,
self
.
KeyBindingSelected
)
scrollTargetY
.
config
(
command
=
self
.
listBindings
.
yview
)
scrollTargetY
.
config
(
command
=
self
.
listBindings
.
yview
)
scrollTargetX
.
config
(
command
=
self
.
listBindings
.
xview
)
scrollTargetX
.
config
(
command
=
self
.
listBindings
.
xview
)
self
.
listBindings
.
config
(
yscrollcommand
=
scrollTargetY
.
set
)
self
.
listBindings
.
config
(
yscrollcommand
=
scrollTargetY
.
set
)
self
.
listBindings
.
config
(
xscrollcommand
=
scrollTargetX
.
set
)
self
.
listBindings
.
config
(
xscrollcommand
=
scrollTargetX
.
set
)
self
.
buttonNewKeys
=
Button
(
frameCustom
,
text
=
'Get New Keys for Selection'
,
self
.
buttonNewKeys
=
Button
(
command
=
self
.
GetNewKeys
,
state
=
DISABLED
)
frameCustom
,
text
=
'Get New Keys for Selection'
,
command
=
self
.
GetNewKeys
,
state
=
DISABLED
)
#frameKeySets
#frameKeySets
frames
=
[
Frame
(
frameKeySets
,
padx
=
2
,
pady
=
2
,
borderwidth
=
0
)
frames
=
[
Frame
(
frameKeySets
,
padx
=
2
,
pady
=
2
,
borderwidth
=
0
)
for
i
in
range
(
2
)]
for
i
in
range
(
2
)]
self
.
radioKeysBuiltin
=
Radiobutton
(
frames
[
0
],
variable
=
self
.
keysAreBuiltin
,
self
.
radioKeysBuiltin
=
Radiobutton
(
value
=
1
,
command
=
self
.
SetKeysType
,
text
=
'Use a Built-in Key Set'
)
frames
[
0
],
variable
=
self
.
keysAreBuiltin
,
value
=
1
,
self
.
radioKeysCustom
=
Radiobutton
(
frames
[
0
],
variable
=
self
.
keysAreBuiltin
,
command
=
self
.
SetKeysType
,
text
=
'Use a Built-in Key Set'
)
value
=
0
,
command
=
self
.
SetKeysType
,
text
=
'Use a Custom Key Set'
)
self
.
radioKeysCustom
=
Radiobutton
(
self
.
optMenuKeysBuiltin
=
DynOptionMenu
(
frames
[
0
],
frames
[
0
],
variable
=
self
.
keysAreBuiltin
,
value
=
0
,
self
.
builtinKeys
,
None
,
command
=
None
)
command
=
self
.
SetKeysType
,
text
=
'Use a Custom Key Set'
)
self
.
optMenuKeysCustom
=
DynOptionMenu
(
frames
[
0
],
self
.
optMenuKeysBuiltin
=
DynOptionMenu
(
self
.
customKeys
,
None
,
command
=
None
)
frames
[
0
],
self
.
builtinKeys
,
None
,
command
=
None
)
self
.
buttonDeleteCustomKeys
=
Button
(
frames
[
1
],
text
=
'Delete Custom Key Set'
,
self
.
optMenuKeysCustom
=
DynOptionMenu
(
frames
[
0
],
self
.
customKeys
,
None
,
command
=
None
)
self
.
buttonDeleteCustomKeys
=
Button
(
frames
[
1
],
text
=
'Delete Custom Key Set'
,
command
=
self
.
DeleteCustomKeys
)
command
=
self
.
DeleteCustomKeys
)
buttonSaveCustomKeys
=
Button
(
frames
[
1
],
buttonSaveCustomKeys
=
Button
(
text
=
'Save as New Custom Key Set'
,
command
=
self
.
SaveAsNewKeySet
)
frames
[
1
],
text
=
'Save as New Custom Key Set'
,
command
=
self
.
SaveAsNewKeySet
)
##widget packing
##widget packing
#body
#body
frameCustom
.
pack
(
side
=
BOTTOM
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameCustom
.
pack
(
side
=
BOTTOM
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameKeySets
.
pack
(
side
=
BOTTOM
,
padx
=
5
,
pady
=
5
,
fill
=
BOTH
)
frameKeySets
.
pack
(
side
=
BOTTOM
,
padx
=
5
,
pady
=
5
,
fill
=
BOTH
)
#frameCustom
#frameCustom
self
.
buttonNewKeys
.
pack
(
side
=
BOTTOM
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
self
.
buttonNewKeys
.
pack
(
side
=
BOTTOM
,
fill
=
X
,
padx
=
5
,
pady
=
5
)
frameTarget
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameTarget
.
pack
(
side
=
LEFT
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
#frame target
#frame target
frameTarget
.
columnconfigure
(
0
,
weight
=
1
)
frameTarget
.
columnconfigure
(
0
,
weight
=
1
)
frameTarget
.
rowconfigure
(
1
,
weight
=
1
)
frameTarget
.
rowconfigure
(
1
,
weight
=
1
)
labelTargetTitle
.
grid
(
row
=
0
,
column
=
0
,
columnspan
=
2
,
sticky
=
W
)
labelTargetTitle
.
grid
(
row
=
0
,
column
=
0
,
columnspan
=
2
,
sticky
=
W
)
self
.
listBindings
.
grid
(
row
=
1
,
column
=
0
,
sticky
=
NSEW
)
self
.
listBindings
.
grid
(
row
=
1
,
column
=
0
,
sticky
=
NSEW
)
scrollTargetY
.
grid
(
row
=
1
,
column
=
1
,
sticky
=
NS
)
scrollTargetY
.
grid
(
row
=
1
,
column
=
1
,
sticky
=
NS
)
scrollTargetX
.
grid
(
row
=
2
,
column
=
0
,
sticky
=
EW
)
scrollTargetX
.
grid
(
row
=
2
,
column
=
0
,
sticky
=
EW
)
#frameKeySets
#frameKeySets
self
.
radioKeysBuiltin
.
grid
(
row
=
0
,
column
=
0
,
sticky
=
W
+
NS
)
self
.
radioKeysBuiltin
.
grid
(
row
=
0
,
column
=
0
,
sticky
=
W
+
NS
)
self
.
radioKeysCustom
.
grid
(
row
=
1
,
column
=
0
,
sticky
=
W
+
NS
)
self
.
radioKeysCustom
.
grid
(
row
=
1
,
column
=
0
,
sticky
=
W
+
NS
)
self
.
optMenuKeysBuiltin
.
grid
(
row
=
0
,
column
=
1
,
sticky
=
NSEW
)
self
.
optMenuKeysBuiltin
.
grid
(
row
=
0
,
column
=
1
,
sticky
=
NSEW
)
self
.
optMenuKeysCustom
.
grid
(
row
=
1
,
column
=
1
,
sticky
=
NSEW
)
self
.
optMenuKeysCustom
.
grid
(
row
=
1
,
column
=
1
,
sticky
=
NSEW
)
self
.
buttonDeleteCustomKeys
.
pack
(
side
=
LEFT
,
fill
=
X
,
expand
=
True
,
padx
=
2
)
self
.
buttonDeleteCustomKeys
.
pack
(
side
=
LEFT
,
fill
=
X
,
expand
=
True
,
padx
=
2
)
buttonSaveCustomKeys
.
pack
(
side
=
LEFT
,
fill
=
X
,
expand
=
True
,
padx
=
2
)
buttonSaveCustomKeys
.
pack
(
side
=
LEFT
,
fill
=
X
,
expand
=
True
,
padx
=
2
)
frames
[
0
]
.
pack
(
side
=
TOP
,
fill
=
BOTH
,
expand
=
True
)
frames
[
0
]
.
pack
(
side
=
TOP
,
fill
=
BOTH
,
expand
=
True
)
frames
[
1
]
.
pack
(
side
=
TOP
,
fill
=
X
,
expand
=
True
,
pady
=
2
)
frames
[
1
]
.
pack
(
side
=
TOP
,
fill
=
X
,
expand
=
True
,
pady
=
2
)
return
frame
return
frame
...
@@ -352,208 +379,216 @@ class ConfigDialog(Toplevel):
...
@@ -352,208 +379,216 @@ class ConfigDialog(Toplevel):
#widget creation
#widget creation
#body
#body
frame
=
self
.
tabPages
.
pages
[
'General'
]
.
frame
frame
=
self
.
tabPages
.
pages
[
'General'
]
.
frame
#body section frames
#body section frames
frameRun
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameRun
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Startup Preferences '
)
text
=
' Startup Preferences '
)
frameSave
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameSave
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Autosave Preferences '
)
text
=
' Autosave Preferences '
)
frameWinSize
=
Frame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
)
frameWinSize
=
Frame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
)
frameParaSize
=
Frame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
)
frameParaSize
=
Frame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
)
frameHelp
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
frameHelp
=
LabelFrame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
,
text
=
' Additional Help Sources '
)
text
=
' Additional Help Sources '
)
#frameRun
#frameRun
labelRunChoiceTitle
=
Label
(
frameRun
,
text
=
'At Startup'
)
labelRunChoiceTitle
=
Label
(
frameRun
,
text
=
'At Startup'
)
radioStartupEdit
=
Radiobutton
(
frameRun
,
variable
=
self
.
startupEdit
,
radioStartupEdit
=
Radiobutton
(
value
=
1
,
command
=
self
.
SetKeysType
,
text
=
"Open Edit Window"
)
frameRun
,
variable
=
self
.
startupEdit
,
value
=
1
,
radioStartupShell
=
Radiobutton
(
frameRun
,
variable
=
self
.
startupEdit
,
command
=
self
.
SetKeysType
,
text
=
"Open Edit Window"
)
value
=
0
,
command
=
self
.
SetKeysType
,
text
=
'Open Shell Window'
)
radioStartupShell
=
Radiobutton
(
frameRun
,
variable
=
self
.
startupEdit
,
value
=
0
,
command
=
self
.
SetKeysType
,
text
=
'Open Shell Window'
)
#frameSave
#frameSave
labelRunSaveTitle
=
Label
(
frameSave
,
text
=
'At Start of Run (F5) '
)
labelRunSaveTitle
=
Label
(
frameSave
,
text
=
'At Start of Run (F5) '
)
radioSaveAsk
=
Radiobutton
(
frameSave
,
variable
=
self
.
autoSave
,
radioSaveAsk
=
Radiobutton
(
value
=
0
,
command
=
self
.
SetKeysType
,
text
=
"Prompt to Save"
)
frameSave
,
variable
=
self
.
autoSave
,
value
=
0
,
radioSaveAuto
=
Radiobutton
(
frameSave
,
variable
=
self
.
autoSave
,
command
=
self
.
SetKeysType
,
text
=
"Prompt to Save"
)
value
=
1
,
command
=
self
.
SetKeysType
,
text
=
'No Prompt'
)
radioSaveAuto
=
Radiobutton
(
frameSave
,
variable
=
self
.
autoSave
,
value
=
1
,
command
=
self
.
SetKeysType
,
text
=
'No Prompt'
)
#frameWinSize
#frameWinSize
labelWinSizeTitle
=
Label
(
frameWinSize
,
text
=
'Initial Window Size'
+
labelWinSizeTitle
=
Label
(
'
(in characters)'
)
frameWinSize
,
text
=
'Initial Window Size
(in characters)'
)
labelWinWidthTitle
=
Label
(
frameWinSize
,
text
=
'Width'
)
labelWinWidthTitle
=
Label
(
frameWinSize
,
text
=
'Width'
)
entryWinWidth
=
Entry
(
frameWinSize
,
textvariable
=
self
.
winWidth
,
entryWinWidth
=
Entry
(
width
=
3
)
frameWinSize
,
textvariable
=
self
.
winWidth
,
width
=
3
)
labelWinHeightTitle
=
Label
(
frameWinSize
,
text
=
'Height'
)
labelWinHeightTitle
=
Label
(
frameWinSize
,
text
=
'Height'
)
entryWinHeight
=
Entry
(
frameWinSize
,
textvariable
=
self
.
winHeight
,
entryWinHeight
=
Entry
(
width
=
3
)
frameWinSize
,
textvariable
=
self
.
winHeight
,
width
=
3
)
#paragraphFormatWidth
#paragraphFormatWidth
labelParaWidthTitle
=
Label
(
frameParaSize
,
text
=
'Paragraph reformat'
+
labelParaWidthTitle
=
Label
(
'
width (in characters)'
)
frameParaSize
,
text
=
'Paragraph reformat
width (in characters)'
)
entryParaWidth
=
Entry
(
frameParaSize
,
textvariable
=
self
.
paraWidth
,
entryParaWidth
=
Entry
(
width
=
3
)
frameParaSize
,
textvariable
=
self
.
paraWidth
,
width
=
3
)
#frameHelp
#frameHelp
frameHelpList
=
Frame
(
frameHelp
)
frameHelpList
=
Frame
(
frameHelp
)
frameHelpListButtons
=
Frame
(
frameHelpList
)
frameHelpListButtons
=
Frame
(
frameHelpList
)
scrollHelpList
=
Scrollbar
(
frameHelpList
)
scrollHelpList
=
Scrollbar
(
frameHelpList
)
self
.
listHelp
=
Listbox
(
frameHelpList
,
height
=
5
,
takefocus
=
FALSE
,
self
.
listHelp
=
Listbox
(
frameHelpList
,
height
=
5
,
takefocus
=
FALSE
,
exportselection
=
FALSE
)
exportselection
=
FALSE
)
scrollHelpList
.
config
(
command
=
self
.
listHelp
.
yview
)
scrollHelpList
.
config
(
command
=
self
.
listHelp
.
yview
)
self
.
listHelp
.
config
(
yscrollcommand
=
scrollHelpList
.
set
)
self
.
listHelp
.
config
(
yscrollcommand
=
scrollHelpList
.
set
)
self
.
listHelp
.
bind
(
'<ButtonRelease-1>'
,
self
.
HelpSourceSelected
)
self
.
listHelp
.
bind
(
'<ButtonRelease-1>'
,
self
.
HelpSourceSelected
)
self
.
buttonHelpListEdit
=
Button
(
frameHelpListButtons
,
text
=
'Edit'
,
self
.
buttonHelpListEdit
=
Button
(
state
=
DISABLED
,
width
=
8
,
command
=
self
.
HelpListItemEdit
)
frameHelpListButtons
,
text
=
'Edit'
,
state
=
DISABLED
,
self
.
buttonHelpListAdd
=
Button
(
frameHelpListButtons
,
text
=
'Add'
,
width
=
8
,
command
=
self
.
HelpListItemEdit
)
width
=
8
,
command
=
self
.
HelpListItemAdd
)
self
.
buttonHelpListAdd
=
Button
(
self
.
buttonHelpListRemove
=
Button
(
frameHelpListButtons
,
text
=
'Remove'
,
frameHelpListButtons
,
text
=
'Add'
,
state
=
DISABLED
,
width
=
8
,
command
=
self
.
HelpListItemRemove
)
width
=
8
,
command
=
self
.
HelpListItemAdd
)
self
.
buttonHelpListRemove
=
Button
(
frameHelpListButtons
,
text
=
'Remove'
,
state
=
DISABLED
,
width
=
8
,
command
=
self
.
HelpListItemRemove
)
#widget packing
#widget packing
#body
#body
frameRun
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameRun
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameSave
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameSave
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameWinSize
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameWinSize
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameParaSize
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameParaSize
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
fill
=
X
)
frameHelp
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameHelp
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
#frameRun
#frameRun
labelRunChoiceTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelRunChoiceTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioStartupShell
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioStartupShell
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioStartupEdit
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioStartupEdit
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
#frameSave
#frameSave
labelRunSaveTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelRunSaveTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioSaveAuto
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioSaveAuto
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioSaveAsk
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
radioSaveAsk
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
#frameWinSize
#frameWinSize
labelWinSizeTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelWinSizeTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
entryWinHeight
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
entryWinHeight
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
labelWinHeightTitle
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
pady
=
5
)
labelWinHeightTitle
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
pady
=
5
)
entryWinWidth
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
entryWinWidth
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
labelWinWidthTitle
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
pady
=
5
)
labelWinWidthTitle
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
pady
=
5
)
#paragraphFormatWidth
#paragraphFormatWidth
labelParaWidthTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
labelParaWidthTitle
.
pack
(
side
=
LEFT
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
entryParaWidth
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
entryParaWidth
.
pack
(
side
=
RIGHT
,
anchor
=
E
,
padx
=
10
,
pady
=
5
)
#frameHelp
#frameHelp
frameHelpListButtons
.
pack
(
side
=
RIGHT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
frameHelpListButtons
.
pack
(
side
=
RIGHT
,
padx
=
5
,
pady
=
5
,
fill
=
Y
)
frameHelpList
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
frameHelpList
.
pack
(
side
=
TOP
,
padx
=
5
,
pady
=
5
,
expand
=
TRUE
,
fill
=
BOTH
)
scrollHelpList
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
fill
=
Y
)
scrollHelpList
.
pack
(
side
=
RIGHT
,
anchor
=
W
,
fill
=
Y
)
self
.
listHelp
.
pack
(
side
=
LEFT
,
anchor
=
E
,
expand
=
TRUE
,
fill
=
BOTH
)
self
.
listHelp
.
pack
(
side
=
LEFT
,
anchor
=
E
,
expand
=
TRUE
,
fill
=
BOTH
)
self
.
buttonHelpListEdit
.
pack
(
side
=
TOP
,
anchor
=
W
,
pady
=
5
)
self
.
buttonHelpListEdit
.
pack
(
side
=
TOP
,
anchor
=
W
,
pady
=
5
)
self
.
buttonHelpListAdd
.
pack
(
side
=
TOP
,
anchor
=
W
)
self
.
buttonHelpListAdd
.
pack
(
side
=
TOP
,
anchor
=
W
)
self
.
buttonHelpListRemove
.
pack
(
side
=
TOP
,
anchor
=
W
,
pady
=
5
)
self
.
buttonHelpListRemove
.
pack
(
side
=
TOP
,
anchor
=
W
,
pady
=
5
)
return
frame
return
frame
def
AttachVarCallbacks
(
self
):
def
AttachVarCallbacks
(
self
):
self
.
fontSize
.
trace_variable
(
'w'
,
self
.
VarChanged_fontSize
)
self
.
fontSize
.
trace_variable
(
'w'
,
self
.
VarChanged_fontSize
)
self
.
fontName
.
trace_variable
(
'w'
,
self
.
VarChanged_fontName
)
self
.
fontName
.
trace_variable
(
'w'
,
self
.
VarChanged_fontName
)
self
.
fontBold
.
trace_variable
(
'w'
,
self
.
VarChanged_fontBold
)
self
.
fontBold
.
trace_variable
(
'w'
,
self
.
VarChanged_fontBold
)
self
.
spaceNum
.
trace_variable
(
'w'
,
self
.
VarChanged_spaceNum
)
self
.
spaceNum
.
trace_variable
(
'w'
,
self
.
VarChanged_spaceNum
)
self
.
colour
.
trace_variable
(
'w'
,
self
.
VarChanged_colour
)
self
.
colour
.
trace_variable
(
'w'
,
self
.
VarChanged_colour
)
self
.
builtinTheme
.
trace_variable
(
'w'
,
self
.
VarChanged_builtinTheme
)
self
.
builtinTheme
.
trace_variable
(
'w'
,
self
.
VarChanged_builtinTheme
)
self
.
customTheme
.
trace_variable
(
'w'
,
self
.
VarChanged_customTheme
)
self
.
customTheme
.
trace_variable
(
'w'
,
self
.
VarChanged_customTheme
)
self
.
themeIsBuiltin
.
trace_variable
(
'w'
,
self
.
VarChanged_themeIsBuiltin
)
self
.
themeIsBuiltin
.
trace_variable
(
'w'
,
self
.
VarChanged_themeIsBuiltin
)
self
.
highlightTarget
.
trace_variable
(
'w'
,
self
.
VarChanged_highlightTarget
)
self
.
highlightTarget
.
trace_variable
(
'w'
,
self
.
VarChanged_highlightTarget
)
self
.
keyBinding
.
trace_variable
(
'w'
,
self
.
VarChanged_keyBinding
)
self
.
keyBinding
.
trace_variable
(
'w'
,
self
.
VarChanged_keyBinding
)
self
.
builtinKeys
.
trace_variable
(
'w'
,
self
.
VarChanged_builtinKeys
)
self
.
builtinKeys
.
trace_variable
(
'w'
,
self
.
VarChanged_builtinKeys
)
self
.
customKeys
.
trace_variable
(
'w'
,
self
.
VarChanged_customKeys
)
self
.
customKeys
.
trace_variable
(
'w'
,
self
.
VarChanged_customKeys
)
self
.
keysAreBuiltin
.
trace_variable
(
'w'
,
self
.
VarChanged_keysAreBuiltin
)
self
.
keysAreBuiltin
.
trace_variable
(
'w'
,
self
.
VarChanged_keysAreBuiltin
)
self
.
winWidth
.
trace_variable
(
'w'
,
self
.
VarChanged_winWidth
)
self
.
winWidth
.
trace_variable
(
'w'
,
self
.
VarChanged_winWidth
)
self
.
winHeight
.
trace_variable
(
'w'
,
self
.
VarChanged_winHeight
)
self
.
winHeight
.
trace_variable
(
'w'
,
self
.
VarChanged_winHeight
)
self
.
paraWidth
.
trace_variable
(
'w'
,
self
.
VarChanged_paraWidth
)
self
.
paraWidth
.
trace_variable
(
'w'
,
self
.
VarChanged_paraWidth
)
self
.
startupEdit
.
trace_variable
(
'w'
,
self
.
VarChanged_startupEdit
)
self
.
startupEdit
.
trace_variable
(
'w'
,
self
.
VarChanged_startupEdit
)
self
.
autoSave
.
trace_variable
(
'w'
,
self
.
VarChanged_autoSave
)
self
.
autoSave
.
trace_variable
(
'w'
,
self
.
VarChanged_autoSave
)
self
.
encoding
.
trace_variable
(
'w'
,
self
.
VarChanged_encoding
)
self
.
encoding
.
trace_variable
(
'w'
,
self
.
VarChanged_encoding
)
def
VarChanged_fontSize
(
self
,
*
params
):
def
VarChanged_fontSize
(
self
,
*
params
):
value
=
self
.
fontSize
.
get
()
value
=
self
.
fontSize
.
get
()
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'font-size'
,
value
)
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'font-size'
,
value
)
def
VarChanged_fontName
(
self
,
*
params
):
def
VarChanged_fontName
(
self
,
*
params
):
value
=
self
.
fontName
.
get
()
value
=
self
.
fontName
.
get
()
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'font'
,
value
)
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'font'
,
value
)
def
VarChanged_fontBold
(
self
,
*
params
):
def
VarChanged_fontBold
(
self
,
*
params
):
value
=
self
.
fontBold
.
get
()
value
=
self
.
fontBold
.
get
()
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'font-bold'
,
value
)
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'font-bold'
,
value
)
def
VarChanged_spaceNum
(
self
,
*
params
):
def
VarChanged_spaceNum
(
self
,
*
params
):
value
=
self
.
spaceNum
.
get
()
value
=
self
.
spaceNum
.
get
()
self
.
AddChangedItem
(
'main'
,
'Indent'
,
'num-spaces'
,
value
)
self
.
AddChangedItem
(
'main'
,
'Indent'
,
'num-spaces'
,
value
)
def
VarChanged_colour
(
self
,
*
params
):
def
VarChanged_colour
(
self
,
*
params
):
self
.
OnNewColourSet
()
self
.
OnNewColourSet
()
def
VarChanged_builtinTheme
(
self
,
*
params
):
def
VarChanged_builtinTheme
(
self
,
*
params
):
value
=
self
.
builtinTheme
.
get
()
value
=
self
.
builtinTheme
.
get
()
self
.
AddChangedItem
(
'main'
,
'Theme'
,
'name'
,
value
)
self
.
AddChangedItem
(
'main'
,
'Theme'
,
'name'
,
value
)
self
.
PaintThemeSample
()
self
.
PaintThemeSample
()
def
VarChanged_customTheme
(
self
,
*
params
):
def
VarChanged_customTheme
(
self
,
*
params
):
value
=
self
.
customTheme
.
get
()
value
=
self
.
customTheme
.
get
()
if
value
!=
'- no custom themes -'
:
if
value
!=
'- no custom themes -'
:
self
.
AddChangedItem
(
'main'
,
'Theme'
,
'name'
,
value
)
self
.
AddChangedItem
(
'main'
,
'Theme'
,
'name'
,
value
)
self
.
PaintThemeSample
()
self
.
PaintThemeSample
()
def
VarChanged_themeIsBuiltin
(
self
,
*
params
):
def
VarChanged_themeIsBuiltin
(
self
,
*
params
):
value
=
self
.
themeIsBuiltin
.
get
()
value
=
self
.
themeIsBuiltin
.
get
()
self
.
AddChangedItem
(
'main'
,
'Theme'
,
'default'
,
value
)
self
.
AddChangedItem
(
'main'
,
'Theme'
,
'default'
,
value
)
if
value
:
if
value
:
self
.
VarChanged_builtinTheme
()
self
.
VarChanged_builtinTheme
()
else
:
else
:
self
.
VarChanged_customTheme
()
self
.
VarChanged_customTheme
()
def
VarChanged_highlightTarget
(
self
,
*
params
):
def
VarChanged_highlightTarget
(
self
,
*
params
):
self
.
SetHighlightTarget
()
self
.
SetHighlightTarget
()
def
VarChanged_keyBinding
(
self
,
*
params
):
def
VarChanged_keyBinding
(
self
,
*
params
):
value
=
self
.
keyBinding
.
get
()
value
=
self
.
keyBinding
.
get
()
keySet
=
self
.
customKeys
.
get
()
keySet
=
self
.
customKeys
.
get
()
event
=
self
.
listBindings
.
get
(
ANCHOR
)
.
split
()[
0
]
event
=
self
.
listBindings
.
get
(
ANCHOR
)
.
split
()[
0
]
if
idleConf
.
IsCoreBinding
(
event
):
if
idleConf
.
IsCoreBinding
(
event
):
#this is a core keybinding
#this is a core keybinding
self
.
AddChangedItem
(
'keys'
,
keySet
,
event
,
value
)
self
.
AddChangedItem
(
'keys'
,
keySet
,
event
,
value
)
else
:
#this is an extension key binding
else
:
#this is an extension key binding
extName
=
idleConf
.
GetExtnNameForEvent
(
event
)
extName
=
idleConf
.
GetExtnNameForEvent
(
event
)
extKeybindSection
=
extName
+
'_cfgBindings'
extKeybindSection
=
extName
+
'_cfgBindings'
self
.
AddChangedItem
(
'extensions'
,
extKeybindSection
,
event
,
value
)
self
.
AddChangedItem
(
'extensions'
,
extKeybindSection
,
event
,
value
)
def
VarChanged_builtinKeys
(
self
,
*
params
):
def
VarChanged_builtinKeys
(
self
,
*
params
):
value
=
self
.
builtinKeys
.
get
()
value
=
self
.
builtinKeys
.
get
()
self
.
AddChangedItem
(
'main'
,
'Keys'
,
'name'
,
value
)
self
.
AddChangedItem
(
'main'
,
'Keys'
,
'name'
,
value
)
self
.
LoadKeysList
(
value
)
self
.
LoadKeysList
(
value
)
def
VarChanged_customKeys
(
self
,
*
params
):
def
VarChanged_customKeys
(
self
,
*
params
):
value
=
self
.
customKeys
.
get
()
value
=
self
.
customKeys
.
get
()
if
value
!=
'- no custom keys -'
:
if
value
!=
'- no custom keys -'
:
self
.
AddChangedItem
(
'main'
,
'Keys'
,
'name'
,
value
)
self
.
AddChangedItem
(
'main'
,
'Keys'
,
'name'
,
value
)
self
.
LoadKeysList
(
value
)
self
.
LoadKeysList
(
value
)
def
VarChanged_keysAreBuiltin
(
self
,
*
params
):
def
VarChanged_keysAreBuiltin
(
self
,
*
params
):
value
=
self
.
keysAreBuiltin
.
get
()
value
=
self
.
keysAreBuiltin
.
get
()
self
.
AddChangedItem
(
'main'
,
'Keys'
,
'default'
,
value
)
self
.
AddChangedItem
(
'main'
,
'Keys'
,
'default'
,
value
)
if
value
:
if
value
:
self
.
VarChanged_builtinKeys
()
self
.
VarChanged_builtinKeys
()
else
:
else
:
self
.
VarChanged_customKeys
()
self
.
VarChanged_customKeys
()
def
VarChanged_winWidth
(
self
,
*
params
):
def
VarChanged_winWidth
(
self
,
*
params
):
value
=
self
.
winWidth
.
get
()
value
=
self
.
winWidth
.
get
()
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'width'
,
value
)
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'width'
,
value
)
def
VarChanged_winHeight
(
self
,
*
params
):
def
VarChanged_winHeight
(
self
,
*
params
):
value
=
self
.
winHeight
.
get
()
value
=
self
.
winHeight
.
get
()
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'height'
,
value
)
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'height'
,
value
)
def
VarChanged_paraWidth
(
self
,
*
params
):
def
VarChanged_paraWidth
(
self
,
*
params
):
value
=
self
.
paraWidth
.
get
()
value
=
self
.
paraWidth
.
get
()
self
.
AddChangedItem
(
'main'
,
'FormatParagraph'
,
'paragraph'
,
value
)
self
.
AddChangedItem
(
'main'
,
'FormatParagraph'
,
'paragraph'
,
value
)
def
VarChanged_startupEdit
(
self
,
*
params
):
def
VarChanged_startupEdit
(
self
,
*
params
):
value
=
self
.
startupEdit
.
get
()
value
=
self
.
startupEdit
.
get
()
self
.
AddChangedItem
(
'main'
,
'General'
,
'editor-on-startup'
,
value
)
self
.
AddChangedItem
(
'main'
,
'General'
,
'editor-on-startup'
,
value
)
def
VarChanged_autoSave
(
self
,
*
params
):
def
VarChanged_autoSave
(
self
,
*
params
):
value
=
self
.
autoSave
.
get
()
value
=
self
.
autoSave
.
get
()
self
.
AddChangedItem
(
'main'
,
'General'
,
'autosave'
,
value
)
self
.
AddChangedItem
(
'main'
,
'General'
,
'autosave'
,
value
)
def
VarChanged_encoding
(
self
,
*
params
):
def
VarChanged_encoding
(
self
,
*
params
):
value
=
self
.
encoding
.
get
()
value
=
self
.
encoding
.
get
()
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'encoding'
,
value
)
self
.
AddChangedItem
(
'main'
,
'EditorWindow'
,
'encoding'
,
value
)
def
ResetChangedItems
(
self
):
def
ResetChangedItems
(
self
):
#When any config item is changed in this dialog, an entry
#When any config item is changed in this dialog, an entry
...
@@ -561,24 +596,25 @@ class ConfigDialog(Toplevel):
...
@@ -561,24 +596,25 @@ class ConfigDialog(Toplevel):
#dictionary. The key should be the config file section name and the
#dictionary. The key should be the config file section name and the
#value a dictionary, whose key:value pairs are item=value pairs for
#value a dictionary, whose key:value pairs are item=value pairs for
#that config file section.
#that config file section.
self
.
changedItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
self
.
changedItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
def
AddChangedItem
(
self
,
type
,
section
,
item
,
value
):
def
AddChangedItem
(
self
,
typ
,
section
,
item
,
value
):
value
=
str
(
value
)
#make sure we use a string
value
=
str
(
value
)
#make sure we use a string
if
section
not
in
self
.
changedItems
[
typ
e
]:
if
section
not
in
self
.
changedItems
[
typ
]:
self
.
changedItems
[
typ
e
][
section
]
=
{}
self
.
changedItems
[
typ
][
section
]
=
{}
self
.
changedItems
[
typ
e
][
section
][
item
]
=
value
self
.
changedItems
[
typ
][
section
][
item
]
=
value
def
GetDefaultItems
(
self
):
def
GetDefaultItems
(
self
):
dItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
dItems
=
{
'main'
:{},
'highlight'
:{},
'keys'
:{},
'extensions'
:{}}
for
configType
in
dItems
:
for
configType
in
dItems
:
sections
=
idleConf
.
GetSectionList
(
'default'
,
configType
)
sections
=
idleConf
.
GetSectionList
(
'default'
,
configType
)
for
section
in
sections
:
for
section
in
sections
:
dItems
[
configType
][
section
]
=
{}
dItems
[
configType
][
section
]
=
{}
options
=
idleConf
.
defaultCfg
[
configType
]
.
GetOptionList
(
section
)
options
=
idleConf
.
defaultCfg
[
configType
]
.
GetOptionList
(
section
)
for
option
in
options
:
for
option
in
options
:
dItems
[
configType
][
section
][
option
]
=
(
dItems
[
configType
][
section
][
option
]
=
(
idleConf
.
defaultCfg
[
configType
]
.
Get
(
section
,
option
))
idleConf
.
defaultCfg
[
configType
]
.
Get
(
section
,
option
))
return
dItems
return
dItems
def
SetThemeType
(
self
):
def
SetThemeType
(
self
):
...
@@ -604,26 +640,26 @@ class ConfigDialog(Toplevel):
...
@@ -604,26 +640,26 @@ class ConfigDialog(Toplevel):
self
.
buttonDeleteCustomKeys
.
config
(
state
=
NORMAL
)
self
.
buttonDeleteCustomKeys
.
config
(
state
=
NORMAL
)
def
GetNewKeys
(
self
):
def
GetNewKeys
(
self
):
listIndex
=
self
.
listBindings
.
index
(
ANCHOR
)
listIndex
=
self
.
listBindings
.
index
(
ANCHOR
)
binding
=
self
.
listBindings
.
get
(
listIndex
)
binding
=
self
.
listBindings
.
get
(
listIndex
)
bindName
=
binding
.
split
()[
0
]
#first part, up to first space
bindName
=
binding
.
split
()[
0
]
#first part, up to first space
if
self
.
keysAreBuiltin
.
get
():
if
self
.
keysAreBuiltin
.
get
():
currentKeySetName
=
self
.
builtinKeys
.
get
()
currentKeySetName
=
self
.
builtinKeys
.
get
()
else
:
else
:
currentKeySetName
=
self
.
customKeys
.
get
()
currentKeySetName
=
self
.
customKeys
.
get
()
currentBindings
=
idleConf
.
GetCurrentKeySet
()
currentBindings
=
idleConf
.
GetCurrentKeySet
()
if
currentKeySetName
in
self
.
changedItems
[
'keys'
]:
#unsaved changes
if
currentKeySetName
in
self
.
changedItems
[
'keys'
]:
#unsaved changes
keySetChanges
=
self
.
changedItems
[
'keys'
][
currentKeySetName
]
keySetChanges
=
self
.
changedItems
[
'keys'
][
currentKeySetName
]
for
event
in
keySetChanges
:
for
event
in
keySetChanges
:
currentBindings
[
event
]
=
keySetChanges
[
event
]
.
split
()
currentBindings
[
event
]
=
keySetChanges
[
event
]
.
split
()
currentKeySequences
=
list
(
currentBindings
.
values
())
currentKeySequences
=
list
(
currentBindings
.
values
())
newKeys
=
GetKeysDialog
(
self
,
'Get New Keys'
,
bindName
,
newKeys
=
GetKeysDialog
(
self
,
'Get New Keys'
,
bindName
,
currentKeySequences
)
.
result
currentKeySequences
)
.
result
if
newKeys
:
#new keys were specified
if
newKeys
:
#new keys were specified
if
self
.
keysAreBuiltin
.
get
():
#current key set is a built-in
if
self
.
keysAreBuiltin
.
get
():
#current key set is a built-in
message
=
(
'Your changes will be saved as a new Custom Key Set. '
+
message
=
(
'Your changes will be saved as a new Custom Key Set.'
'
Enter a name for your new Custom Key Set below.'
)
'
Enter a name for your new Custom Key Set below.'
)
newKeySet
=
self
.
GetNewKeysName
(
message
)
newKeySet
=
self
.
GetNewKeysName
(
message
)
if
not
newKeySet
:
#user cancelled custom key set creation
if
not
newKeySet
:
#user cancelled custom key set creation
self
.
listBindings
.
select_set
(
listIndex
)
self
.
listBindings
.
select_set
(
listIndex
)
self
.
listBindings
.
select_anchor
(
listIndex
)
self
.
listBindings
.
select_anchor
(
listIndex
)
...
@@ -631,7 +667,7 @@ class ConfigDialog(Toplevel):
...
@@ -631,7 +667,7 @@ class ConfigDialog(Toplevel):
else
:
#create new custom key set based on previously active key set
else
:
#create new custom key set based on previously active key set
self
.
CreateNewKeySet
(
newKeySet
)
self
.
CreateNewKeySet
(
newKeySet
)
self
.
listBindings
.
delete
(
listIndex
)
self
.
listBindings
.
delete
(
listIndex
)
self
.
listBindings
.
insert
(
listIndex
,
bindName
+
' - '
+
newKeys
)
self
.
listBindings
.
insert
(
listIndex
,
bindName
+
' - '
+
newKeys
)
self
.
listBindings
.
select_set
(
listIndex
)
self
.
listBindings
.
select_set
(
listIndex
)
self
.
listBindings
.
select_anchor
(
listIndex
)
self
.
listBindings
.
select_anchor
(
listIndex
)
self
.
keyBinding
.
set
(
newKeys
)
self
.
keyBinding
.
set
(
newKeys
)
...
@@ -639,65 +675,65 @@ class ConfigDialog(Toplevel):
...
@@ -639,65 +675,65 @@ class ConfigDialog(Toplevel):
self
.
listBindings
.
select_set
(
listIndex
)
self
.
listBindings
.
select_set
(
listIndex
)
self
.
listBindings
.
select_anchor
(
listIndex
)
self
.
listBindings
.
select_anchor
(
listIndex
)
def
GetNewKeysName
(
self
,
message
):
def
GetNewKeysName
(
self
,
message
):
usedNames
=
(
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
+
usedNames
=
(
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
+
idleConf
.
GetSectionList
(
'default'
,
'keys'
))
idleConf
.
GetSectionList
(
'default'
,
'keys'
))
newKeySet
=
GetCfgSectionNameDialog
(
self
,
'New Custom Key Set'
,
newKeySet
=
GetCfgSectionNameDialog
(
message
,
usedNames
)
.
result
self
,
'New Custom Key Set'
,
message
,
usedNames
)
.
result
return
newKeySet
return
newKeySet
def
SaveAsNewKeySet
(
self
):
def
SaveAsNewKeySet
(
self
):
newKeysName
=
self
.
GetNewKeysName
(
'New Key Set Name:'
)
newKeysName
=
self
.
GetNewKeysName
(
'New Key Set Name:'
)
if
newKeysName
:
if
newKeysName
:
self
.
CreateNewKeySet
(
newKeysName
)
self
.
CreateNewKeySet
(
newKeysName
)
def
KeyBindingSelected
(
self
,
event
):
def
KeyBindingSelected
(
self
,
event
):
self
.
buttonNewKeys
.
config
(
state
=
NORMAL
)
self
.
buttonNewKeys
.
config
(
state
=
NORMAL
)
def
CreateNewKeySet
(
self
,
newKeySetName
):
def
CreateNewKeySet
(
self
,
newKeySetName
):
#creates new custom key set based on the previously active key set,
#creates new custom key set based on the previously active key set,
#and makes the new key set active
#and makes the new key set active
if
self
.
keysAreBuiltin
.
get
():
if
self
.
keysAreBuiltin
.
get
():
prevKeySetName
=
self
.
builtinKeys
.
get
()
prevKeySetName
=
self
.
builtinKeys
.
get
()
else
:
else
:
prevKeySetName
=
self
.
customKeys
.
get
()
prevKeySetName
=
self
.
customKeys
.
get
()
prevKeys
=
idleConf
.
GetCoreKeys
(
prevKeySetName
)
prevKeys
=
idleConf
.
GetCoreKeys
(
prevKeySetName
)
newKeys
=
{}
newKeys
=
{}
for
event
in
prevKeys
:
#add key set to changed items
for
event
in
prevKeys
:
#add key set to changed items
eventName
=
event
[
2
:
-
2
]
#trim off the angle brackets
eventName
=
event
[
2
:
-
2
]
#trim off the angle brackets
binding
=
' '
.
join
(
prevKeys
[
event
])
binding
=
' '
.
join
(
prevKeys
[
event
])
newKeys
[
eventName
]
=
binding
newKeys
[
eventName
]
=
binding
#handle any unsaved changes to prev key set
#handle any unsaved changes to prev key set
if
prevKeySetName
in
self
.
changedItems
[
'keys'
]:
if
prevKeySetName
in
self
.
changedItems
[
'keys'
]:
keySetChanges
=
self
.
changedItems
[
'keys'
][
prevKeySetName
]
keySetChanges
=
self
.
changedItems
[
'keys'
][
prevKeySetName
]
for
event
in
keySetChanges
:
for
event
in
keySetChanges
:
newKeys
[
event
]
=
keySetChanges
[
event
]
newKeys
[
event
]
=
keySetChanges
[
event
]
#save the new theme
#save the new theme
self
.
SaveNewKeySet
(
newKeySetName
,
newKeys
)
self
.
SaveNewKeySet
(
newKeySetName
,
newKeys
)
#change gui over to the new key set
#change gui over to the new key set
customKeyList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
customKeyList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
customKeyList
.
sort
()
customKeyList
.
sort
()
self
.
optMenuKeysCustom
.
SetMenu
(
customKeyList
,
newKeySetName
)
self
.
optMenuKeysCustom
.
SetMenu
(
customKeyList
,
newKeySetName
)
self
.
keysAreBuiltin
.
set
(
0
)
self
.
keysAreBuiltin
.
set
(
0
)
self
.
SetKeysType
()
self
.
SetKeysType
()
def
LoadKeysList
(
self
,
keySetName
):
def
LoadKeysList
(
self
,
keySetName
):
reselect
=
0
reselect
=
0
newKeySet
=
0
newKeySet
=
0
if
self
.
listBindings
.
curselection
():
if
self
.
listBindings
.
curselection
():
reselect
=
1
reselect
=
1
listIndex
=
self
.
listBindings
.
index
(
ANCHOR
)
listIndex
=
self
.
listBindings
.
index
(
ANCHOR
)
keySet
=
idleConf
.
GetKeySet
(
keySetName
)
keySet
=
idleConf
.
GetKeySet
(
keySetName
)
bindNames
=
list
(
keySet
.
keys
())
bindNames
=
list
(
keySet
.
keys
())
bindNames
.
sort
()
bindNames
.
sort
()
self
.
listBindings
.
delete
(
0
,
END
)
self
.
listBindings
.
delete
(
0
,
END
)
for
bindName
in
bindNames
:
for
bindName
in
bindNames
:
key
=
' '
.
join
(
keySet
[
bindName
])
#make key(s) into a string
key
=
' '
.
join
(
keySet
[
bindName
])
#make key(s) into a string
bindName
=
bindName
[
2
:
-
2
]
#trim off the angle brackets
bindName
=
bindName
[
2
:
-
2
]
#trim off the angle brackets
if
keySetName
in
self
.
changedItems
[
'keys'
]:
if
keySetName
in
self
.
changedItems
[
'keys'
]:
#handle any unsaved changes to this key set
#handle any unsaved changes to this key set
if
bindName
in
self
.
changedItems
[
'keys'
][
keySetName
]:
if
bindName
in
self
.
changedItems
[
'keys'
][
keySetName
]:
key
=
self
.
changedItems
[
'keys'
][
keySetName
][
bindName
]
key
=
self
.
changedItems
[
'keys'
][
keySetName
][
bindName
]
self
.
listBindings
.
insert
(
END
,
bindName
+
' - '
+
key
)
self
.
listBindings
.
insert
(
END
,
bindName
+
' - '
+
key
)
if
reselect
:
if
reselect
:
self
.
listBindings
.
see
(
listIndex
)
self
.
listBindings
.
see
(
listIndex
)
...
@@ -706,9 +742,9 @@ class ConfigDialog(Toplevel):
...
@@ -706,9 +742,9 @@ class ConfigDialog(Toplevel):
def
DeleteCustomKeys
(
self
):
def
DeleteCustomKeys
(
self
):
keySetName
=
self
.
customKeys
.
get
()
keySetName
=
self
.
customKeys
.
get
()
if
not
tkMessageBox
.
askyesno
(
'Delete Key Set'
,
'Are you sure you wish '
+
delmsg
=
'Are you sure you wish to delete the key set
%
r ?'
'to delete the key set
%
r ?'
%
(
keySetName
),
if
not
tkMessageBox
.
askyesno
(
parent
=
self
):
'Delete Key Set'
,
delmsg
%
keySetName
,
parent
=
self
):
return
return
#remove key set from config
#remove key set from config
idleConf
.
userCfg
[
'keys'
]
.
remove_section
(
keySetName
)
idleConf
.
userCfg
[
'keys'
]
.
remove_section
(
keySetName
)
...
@@ -717,25 +753,25 @@ class ConfigDialog(Toplevel):
...
@@ -717,25 +753,25 @@ class ConfigDialog(Toplevel):
#write changes
#write changes
idleConf
.
userCfg
[
'keys'
]
.
Save
()
idleConf
.
userCfg
[
'keys'
]
.
Save
()
#reload user key set list
#reload user key set list
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
.
sort
()
itemList
.
sort
()
if
not
itemList
:
if
not
itemList
:
self
.
radioKeysCustom
.
config
(
state
=
DISABLED
)
self
.
radioKeysCustom
.
config
(
state
=
DISABLED
)
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
'- no custom keys -'
)
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
'- no custom keys -'
)
else
:
else
:
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
#revert to default key set
#revert to default key set
self
.
keysAreBuiltin
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Keys'
,
'default'
))
self
.
keysAreBuiltin
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Keys'
,
'default'
))
self
.
builtinKeys
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Keys'
,
'name'
))
self
.
builtinKeys
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Keys'
,
'name'
))
#user can't back out of these changes, they must be applied now
#user can't back out of these changes, they must be applied now
self
.
Apply
()
self
.
Apply
()
self
.
SetKeysType
()
self
.
SetKeysType
()
def
DeleteCustomTheme
(
self
):
def
DeleteCustomTheme
(
self
):
themeName
=
self
.
customTheme
.
get
()
themeName
=
self
.
customTheme
.
get
()
if
not
tkMessageBox
.
askyesno
(
'Delete Theme'
,
'Are you sure you wish '
+
delmsg
=
'Are you sure you wish to delete the theme
%
r ?'
'to delete the theme
%
r ?'
%
(
themeName
,),
if
not
tkMessageBox
.
askyesno
(
parent
=
self
):
'Delete Theme'
,
delmsg
%
themeName
,
parent
=
self
):
return
return
#remove theme from config
#remove theme from config
idleConf
.
userCfg
[
'highlight'
]
.
remove_section
(
themeName
)
idleConf
.
userCfg
[
'highlight'
]
.
remove_section
(
themeName
)
...
@@ -744,153 +780,149 @@ class ConfigDialog(Toplevel):
...
@@ -744,153 +780,149 @@ class ConfigDialog(Toplevel):
#write changes
#write changes
idleConf
.
userCfg
[
'highlight'
]
.
Save
()
idleConf
.
userCfg
[
'highlight'
]
.
Save
()
#reload user theme list
#reload user theme list
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
itemList
.
sort
()
itemList
.
sort
()
if
not
itemList
:
if
not
itemList
:
self
.
radioThemeCustom
.
config
(
state
=
DISABLED
)
self
.
radioThemeCustom
.
config
(
state
=
DISABLED
)
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
'- no custom themes -'
)
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
'- no custom themes -'
)
else
:
else
:
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
#revert to default theme
#revert to default theme
self
.
themeIsBuiltin
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Theme'
,
'default'
))
self
.
themeIsBuiltin
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Theme'
,
'default'
))
self
.
builtinTheme
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Theme'
,
'name'
))
self
.
builtinTheme
.
set
(
idleConf
.
defaultCfg
[
'main'
]
.
Get
(
'Theme'
,
'name'
))
#user can't back out of these changes, they must be applied now
#user can't back out of these changes, they must be applied now
self
.
Apply
()
self
.
Apply
()
self
.
SetThemeType
()
self
.
SetThemeType
()
def
GetColour
(
self
):
def
GetColour
(
self
):
target
=
self
.
highlightTarget
.
get
()
target
=
self
.
highlightTarget
.
get
()
prevColour
=
self
.
frameColourSet
.
cget
(
'bg'
)
prevColour
=
self
.
frameColourSet
.
cget
(
'bg'
)
rgbTuplet
,
colourString
=
tkColorChooser
.
askcolor
(
parent
=
self
,
rgbTuplet
,
colourString
=
tkColorChooser
.
askcolor
(
title
=
'Pick new colour for : '
+
target
,
initialcolor
=
prevColour
)
parent
=
self
,
title
=
'Pick new colour for : '
+
target
,
if
colourString
and
(
colourString
!=
prevColour
):
initialcolor
=
prevColour
)
if
colourString
and
(
colourString
!=
prevColour
):
#user didn't cancel, and they chose a new colour
#user didn't cancel, and they chose a new colour
if
self
.
themeIsBuiltin
.
get
():
#current theme is a built-in
if
self
.
themeIsBuiltin
.
get
():
#current theme is a built-in
message
=
(
'Your changes will be saved as a new Custom Theme. '
+
message
=
(
'Your changes will be saved as a new Custom Theme. '
'Enter a name for your new Custom Theme below.'
)
'Enter a name for your new Custom Theme below.'
)
newTheme
=
self
.
GetNewThemeName
(
message
)
newTheme
=
self
.
GetNewThemeName
(
message
)
if
not
newTheme
:
#user cancelled custom theme creation
if
not
newTheme
:
#user cancelled custom theme creation
return
return
else
:
#create new custom theme based on previously active theme
else
:
#create new custom theme based on previously active theme
self
.
CreateNewTheme
(
newTheme
)
self
.
CreateNewTheme
(
newTheme
)
self
.
colour
.
set
(
colourString
)
self
.
colour
.
set
(
colourString
)
else
:
#current theme is user defined
else
:
#current theme is user defined
self
.
colour
.
set
(
colourString
)
self
.
colour
.
set
(
colourString
)
def
OnNewColourSet
(
self
):
def
OnNewColourSet
(
self
):
newColour
=
self
.
colour
.
get
()
newColour
=
self
.
colour
.
get
()
self
.
frameColourSet
.
config
(
bg
=
newColour
)
#set sample
self
.
frameColourSet
.
config
(
bg
=
newColour
)
#set sample
if
self
.
fgHilite
.
get
():
plane
=
'foreground'
plane
=
'foreground'
if
self
.
fgHilite
.
get
()
else
'background'
else
:
plane
=
'background'
sampleElement
=
self
.
themeElements
[
self
.
highlightTarget
.
get
()][
0
]
sampleElement
=
self
.
themeElements
[
self
.
highlightTarget
.
get
()][
0
]
self
.
textHighlightSample
.
tag_config
(
sampleElement
,
**
{
plane
:
newColour
})
self
.
textHighlightSample
.
tag_config
(
sampleElement
,
**
{
plane
:
newColour
})
theme
=
self
.
customTheme
.
get
()
theme
=
self
.
customTheme
.
get
()
themeElement
=
sampleElement
+
'-'
+
plane
themeElement
=
sampleElement
+
'-'
+
plane
self
.
AddChangedItem
(
'highlight'
,
theme
,
themeElement
,
newColour
)
self
.
AddChangedItem
(
'highlight'
,
theme
,
themeElement
,
newColour
)
def
GetNewThemeName
(
self
,
message
):
def
GetNewThemeName
(
self
,
message
):
usedNames
=
(
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
+
usedNames
=
(
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
+
idleConf
.
GetSectionList
(
'default'
,
'highlight'
))
idleConf
.
GetSectionList
(
'default'
,
'highlight'
))
newTheme
=
GetCfgSectionNameDialog
(
self
,
'New Custom Theme'
,
newTheme
=
GetCfgSectionNameDialog
(
message
,
usedNames
)
.
result
self
,
'New Custom Theme'
,
message
,
usedNames
)
.
result
return
newTheme
return
newTheme
def
SaveAsNewTheme
(
self
):
def
SaveAsNewTheme
(
self
):
newThemeName
=
self
.
GetNewThemeName
(
'New Theme Name:'
)
newThemeName
=
self
.
GetNewThemeName
(
'New Theme Name:'
)
if
newThemeName
:
if
newThemeName
:
self
.
CreateNewTheme
(
newThemeName
)
self
.
CreateNewTheme
(
newThemeName
)
def
CreateNewTheme
(
self
,
newThemeName
):
def
CreateNewTheme
(
self
,
newThemeName
):
#creates new custom theme based on the previously active theme,
#creates new custom theme based on the previously active theme,
#and makes the new theme active
#and makes the new theme active
if
self
.
themeIsBuiltin
.
get
():
if
self
.
themeIsBuiltin
.
get
():
themeType
=
'default'
themeType
=
'default'
themeName
=
self
.
builtinTheme
.
get
()
themeName
=
self
.
builtinTheme
.
get
()
else
:
else
:
themeType
=
'user'
themeType
=
'user'
themeName
=
self
.
customTheme
.
get
()
themeName
=
self
.
customTheme
.
get
()
newTheme
=
idleConf
.
GetThemeDict
(
themeType
,
themeName
)
newTheme
=
idleConf
.
GetThemeDict
(
themeType
,
themeName
)
#apply any of the old theme's unsaved changes to the new theme
#apply any of the old theme's unsaved changes to the new theme
if
themeName
in
self
.
changedItems
[
'highlight'
]:
if
themeName
in
self
.
changedItems
[
'highlight'
]:
themeChanges
=
self
.
changedItems
[
'highlight'
][
themeName
]
themeChanges
=
self
.
changedItems
[
'highlight'
][
themeName
]
for
element
in
themeChanges
:
for
element
in
themeChanges
:
newTheme
[
element
]
=
themeChanges
[
element
]
newTheme
[
element
]
=
themeChanges
[
element
]
#save the new theme
#save the new theme
self
.
SaveNewTheme
(
newThemeName
,
newTheme
)
self
.
SaveNewTheme
(
newThemeName
,
newTheme
)
#change gui over to the new theme
#change gui over to the new theme
customThemeList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
customThemeList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
customThemeList
.
sort
()
customThemeList
.
sort
()
self
.
optMenuThemeCustom
.
SetMenu
(
customThemeList
,
newThemeName
)
self
.
optMenuThemeCustom
.
SetMenu
(
customThemeList
,
newThemeName
)
self
.
themeIsBuiltin
.
set
(
0
)
self
.
themeIsBuiltin
.
set
(
0
)
self
.
SetThemeType
()
self
.
SetThemeType
()
def
OnListFontButtonRelease
(
self
,
event
):
def
OnListFontButtonRelease
(
self
,
event
):
font
=
self
.
listFontName
.
get
(
ANCHOR
)
font
=
self
.
listFontName
.
get
(
ANCHOR
)
self
.
fontName
.
set
(
font
.
lower
())
self
.
fontName
.
set
(
font
.
lower
())
self
.
SetFontSample
()
self
.
SetFontSample
()
def
SetFontSample
(
self
,
event
=
None
):
def
SetFontSample
(
self
,
event
=
None
):
fontName
=
self
.
fontName
.
get
()
fontName
=
self
.
fontName
.
get
()
if
self
.
fontBold
.
get
():
fontWeight
=
tkFont
.
BOLD
if
self
.
fontBold
.
get
()
else
tkFont
.
NORMAL
fontWeight
=
tkFont
.
BOLD
else
:
fontWeight
=
tkFont
.
NORMAL
newFont
=
(
fontName
,
self
.
fontSize
.
get
(),
fontWeight
)
newFont
=
(
fontName
,
self
.
fontSize
.
get
(),
fontWeight
)
self
.
labelFontSample
.
config
(
font
=
newFont
)
self
.
labelFontSample
.
config
(
font
=
newFont
)
self
.
textHighlightSample
.
configure
(
font
=
newFont
)
self
.
textHighlightSample
.
configure
(
font
=
newFont
)
def
SetHighlightTarget
(
self
):
def
SetHighlightTarget
(
self
):
if
self
.
highlightTarget
.
get
()
==
'Cursor'
:
#bg not possible
if
self
.
highlightTarget
.
get
()
==
'Cursor'
:
#bg not possible
self
.
radioFg
.
config
(
state
=
DISABLED
)
self
.
radioFg
.
config
(
state
=
DISABLED
)
self
.
radioBg
.
config
(
state
=
DISABLED
)
self
.
radioBg
.
config
(
state
=
DISABLED
)
self
.
fgHilite
.
set
(
1
)
self
.
fgHilite
.
set
(
1
)
else
:
#both fg and bg can be set
else
:
#both fg and bg can be set
self
.
radioFg
.
config
(
state
=
NORMAL
)
self
.
radioFg
.
config
(
state
=
NORMAL
)
self
.
radioBg
.
config
(
state
=
NORMAL
)
self
.
radioBg
.
config
(
state
=
NORMAL
)
self
.
fgHilite
.
set
(
1
)
self
.
fgHilite
.
set
(
1
)
self
.
SetColourSample
()
self
.
SetColourSample
()
def
SetColourSampleBinding
(
self
,
*
args
):
def
SetColourSampleBinding
(
self
,
*
args
):
self
.
SetColourSample
()
self
.
SetColourSample
()
def
SetColourSample
(
self
):
def
SetColourSample
(
self
):
#set the colour smaple area
#set the colour smaple area
tag
=
self
.
themeElements
[
self
.
highlightTarget
.
get
()][
0
]
tag
=
self
.
themeElements
[
self
.
highlightTarget
.
get
()][
0
]
if
self
.
fgHilite
.
get
():
plane
=
'foreground'
plane
=
'foreground'
if
self
.
fgHilite
.
get
()
else
'background'
else
:
plane
=
'background'
colour
=
self
.
textHighlightSample
.
tag_cget
(
tag
,
plane
)
colour
=
self
.
textHighlightSample
.
tag_cget
(
tag
,
plane
)
self
.
frameColourSet
.
config
(
bg
=
colour
)
self
.
frameColourSet
.
config
(
bg
=
colour
)
def
PaintThemeSample
(
self
):
def
PaintThemeSample
(
self
):
if
self
.
themeIsBuiltin
.
get
():
#a default theme
if
self
.
themeIsBuiltin
.
get
():
#a default theme
theme
=
self
.
builtinTheme
.
get
()
theme
=
self
.
builtinTheme
.
get
()
else
:
#a user theme
else
:
#a user theme
theme
=
self
.
customTheme
.
get
()
theme
=
self
.
customTheme
.
get
()
for
elementTitle
in
self
.
themeElements
:
for
elementTitle
in
self
.
themeElements
:
element
=
self
.
themeElements
[
elementTitle
][
0
]
element
=
self
.
themeElements
[
elementTitle
][
0
]
colours
=
idleConf
.
GetHighlight
(
theme
,
element
)
colours
=
idleConf
.
GetHighlight
(
theme
,
element
)
if
element
==
'cursor'
:
#cursor sample needs special painting
if
element
==
'cursor'
:
#cursor sample needs special painting
colours
[
'background'
]
=
idleConf
.
GetHighlight
(
theme
,
colours
[
'background'
]
=
idleConf
.
GetHighlight
(
'normal'
,
fgBg
=
'bg'
)
theme
,
'normal'
,
fgBg
=
'bg'
)
#handle any unsaved changes to this theme
#handle any unsaved changes to this theme
if
theme
in
self
.
changedItems
[
'highlight'
]:
if
theme
in
self
.
changedItems
[
'highlight'
]:
themeDict
=
self
.
changedItems
[
'highlight'
][
theme
]
themeDict
=
self
.
changedItems
[
'highlight'
][
theme
]
if
element
+
'-foreground'
in
themeDict
:
if
element
+
'-foreground'
in
themeDict
:
colours
[
'foreground'
]
=
themeDict
[
element
+
'-foreground'
]
colours
[
'foreground'
]
=
themeDict
[
element
+
'-foreground'
]
if
element
+
'-background'
in
themeDict
:
if
element
+
'-background'
in
themeDict
:
colours
[
'background'
]
=
themeDict
[
element
+
'-background'
]
colours
[
'background'
]
=
themeDict
[
element
+
'-background'
]
self
.
textHighlightSample
.
tag_config
(
element
,
**
colours
)
self
.
textHighlightSample
.
tag_config
(
element
,
**
colours
)
self
.
SetColourSample
()
self
.
SetColourSample
()
def
HelpSourceSelected
(
self
,
event
):
def
HelpSourceSelected
(
self
,
event
):
self
.
SetHelpListButtonStates
()
self
.
SetHelpListButtonStates
()
def
SetHelpListButtonStates
(
self
):
def
SetHelpListButtonStates
(
self
):
if
self
.
listHelp
.
size
()
<
1
:
#no entries in list
if
self
.
listHelp
.
size
()
<
1
:
#no entries in list
self
.
buttonHelpListEdit
.
config
(
state
=
DISABLED
)
self
.
buttonHelpListEdit
.
config
(
state
=
DISABLED
)
self
.
buttonHelpListRemove
.
config
(
state
=
DISABLED
)
self
.
buttonHelpListRemove
.
config
(
state
=
DISABLED
)
else
:
#there are some entries
else
:
#there are some entries
if
self
.
listHelp
.
curselection
():
#there currently is a selection
if
self
.
listHelp
.
curselection
():
#there currently is a selection
self
.
buttonHelpListEdit
.
config
(
state
=
NORMAL
)
self
.
buttonHelpListEdit
.
config
(
state
=
NORMAL
)
self
.
buttonHelpListRemove
.
config
(
state
=
NORMAL
)
self
.
buttonHelpListRemove
.
config
(
state
=
NORMAL
)
else
:
#there currently is not a selection
else
:
#there currently is not a selection
...
@@ -898,28 +930,29 @@ class ConfigDialog(Toplevel):
...
@@ -898,28 +930,29 @@ class ConfigDialog(Toplevel):
self
.
buttonHelpListRemove
.
config
(
state
=
DISABLED
)
self
.
buttonHelpListRemove
.
config
(
state
=
DISABLED
)
def
HelpListItemAdd
(
self
):
def
HelpListItemAdd
(
self
):
helpSource
=
GetHelpSourceDialog
(
self
,
'New Help Source'
)
.
result
helpSource
=
GetHelpSourceDialog
(
self
,
'New Help Source'
)
.
result
if
helpSource
:
if
helpSource
:
self
.
userHelpList
.
append
(
(
helpSource
[
0
],
helpSource
[
1
])
)
self
.
userHelpList
.
append
(
(
helpSource
[
0
],
helpSource
[
1
])
)
self
.
listHelp
.
insert
(
END
,
helpSource
[
0
])
self
.
listHelp
.
insert
(
END
,
helpSource
[
0
])
self
.
UpdateUserHelpChangedItems
()
self
.
UpdateUserHelpChangedItems
()
self
.
SetHelpListButtonStates
()
self
.
SetHelpListButtonStates
()
def
HelpListItemEdit
(
self
):
def
HelpListItemEdit
(
self
):
itemIndex
=
self
.
listHelp
.
index
(
ANCHOR
)
itemIndex
=
self
.
listHelp
.
index
(
ANCHOR
)
helpSource
=
self
.
userHelpList
[
itemIndex
]
helpSource
=
self
.
userHelpList
[
itemIndex
]
newHelpSource
=
GetHelpSourceDialog
(
self
,
'Edit Help Source'
,
newHelpSource
=
GetHelpSourceDialog
(
menuItem
=
helpSource
[
0
],
filePath
=
helpSource
[
1
])
.
result
self
,
'Edit Help Source'
,
menuItem
=
helpSource
[
0
],
if
(
not
newHelpSource
)
or
(
newHelpSource
==
helpSource
):
filePath
=
helpSource
[
1
])
.
result
if
(
not
newHelpSource
)
or
(
newHelpSource
==
helpSource
):
return
#no changes
return
#no changes
self
.
userHelpList
[
itemIndex
]
=
newHelpSource
self
.
userHelpList
[
itemIndex
]
=
newHelpSource
self
.
listHelp
.
delete
(
itemIndex
)
self
.
listHelp
.
delete
(
itemIndex
)
self
.
listHelp
.
insert
(
itemIndex
,
newHelpSource
[
0
])
self
.
listHelp
.
insert
(
itemIndex
,
newHelpSource
[
0
])
self
.
UpdateUserHelpChangedItems
()
self
.
UpdateUserHelpChangedItems
()
self
.
SetHelpListButtonStates
()
self
.
SetHelpListButtonStates
()
def
HelpListItemRemove
(
self
):
def
HelpListItemRemove
(
self
):
itemIndex
=
self
.
listHelp
.
index
(
ANCHOR
)
itemIndex
=
self
.
listHelp
.
index
(
ANCHOR
)
del
(
self
.
userHelpList
[
itemIndex
])
del
(
self
.
userHelpList
[
itemIndex
])
self
.
listHelp
.
delete
(
itemIndex
)
self
.
listHelp
.
delete
(
itemIndex
)
self
.
UpdateUserHelpChangedItems
()
self
.
UpdateUserHelpChangedItems
()
...
@@ -928,18 +961,19 @@ class ConfigDialog(Toplevel):
...
@@ -928,18 +961,19 @@ class ConfigDialog(Toplevel):
def
UpdateUserHelpChangedItems
(
self
):
def
UpdateUserHelpChangedItems
(
self
):
"Clear and rebuild the HelpFiles section in self.changedItems"
"Clear and rebuild the HelpFiles section in self.changedItems"
self
.
changedItems
[
'main'
][
'HelpFiles'
]
=
{}
self
.
changedItems
[
'main'
][
'HelpFiles'
]
=
{}
for
num
in
range
(
1
,
len
(
self
.
userHelpList
)
+
1
):
for
num
in
range
(
1
,
len
(
self
.
userHelpList
)
+
1
):
self
.
AddChangedItem
(
'main'
,
'HelpFiles'
,
str
(
num
),
self
.
AddChangedItem
(
'main'
,
'HelpFiles'
,
str
(
num
),
';'
.
join
(
self
.
userHelpList
[
num
-
1
][:
2
]))
';'
.
join
(
self
.
userHelpList
[
num
-
1
][:
2
]))
def
LoadFontCfg
(
self
):
def
LoadFontCfg
(
self
):
##base editor font selection list
##base editor font selection list
fonts
=
list
(
tkFont
.
families
(
self
))
fonts
=
list
(
tkFont
.
families
(
self
))
fonts
.
sort
()
fonts
.
sort
()
for
font
in
fonts
:
for
font
in
fonts
:
self
.
listFontName
.
insert
(
END
,
font
)
self
.
listFontName
.
insert
(
END
,
font
)
configuredFont
=
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
'font'
,
configuredFont
=
idleConf
.
GetOption
(
default
=
'courier'
)
'main'
,
'EditorWindow'
,
'font'
,
default
=
'courier'
)
lc_configuredFont
=
configuredFont
.
lower
()
lc_configuredFont
=
configuredFont
.
lower
()
self
.
fontName
.
set
(
lc_configuredFont
)
self
.
fontName
.
set
(
lc_configuredFont
)
lc_fonts
=
[
s
.
lower
()
for
s
in
fonts
]
lc_fonts
=
[
s
.
lower
()
for
s
in
fonts
]
...
@@ -949,107 +983,107 @@ class ConfigDialog(Toplevel):
...
@@ -949,107 +983,107 @@ class ConfigDialog(Toplevel):
self
.
listFontName
.
select_set
(
currentFontIndex
)
self
.
listFontName
.
select_set
(
currentFontIndex
)
self
.
listFontName
.
select_anchor
(
currentFontIndex
)
self
.
listFontName
.
select_anchor
(
currentFontIndex
)
##font size dropdown
##font size dropdown
fontSize
=
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
'font-size'
,
fontSize
=
idleConf
.
GetOption
(
type
=
'int'
,
default
=
'10'
)
'main'
,
'EditorWindow'
,
'font-size'
,
type
=
'int'
,
default
=
'10'
)
self
.
optMenuFontSize
.
SetMenu
((
'7'
,
'8'
,
'9'
,
'10'
,
'11'
,
'12'
,
'13'
,
'14
'
,
self
.
optMenuFontSize
.
SetMenu
((
'7'
,
'8'
,
'9'
,
'10'
,
'11'
,
'12'
,
'13
'
,
'1
6'
,
'18'
,
'20'
,
'22'
),
fontSize
)
'1
4'
,
'16'
,
'18'
,
'20'
,
'22'
),
fontSize
)
##fontWeight
##fontWeight
self
.
fontBold
.
set
(
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
self
.
fontBold
.
set
(
idleConf
.
GetOption
(
'font-bold'
,
default
=
0
,
type
=
'bool'
))
'main'
,
'EditorWindow'
,
'font-bold'
,
default
=
0
,
type
=
'bool'
))
##font sample
##font sample
self
.
SetFontSample
()
self
.
SetFontSample
()
def
LoadTabCfg
(
self
):
def
LoadTabCfg
(
self
):
##indent sizes
##indent sizes
spaceNum
=
idleConf
.
GetOption
(
'main'
,
'Indent'
,
'num-spaces'
,
spaceNum
=
idleConf
.
GetOption
(
default
=
4
,
type
=
'int'
)
'main'
,
'Indent'
,
'num-spaces'
,
default
=
4
,
type
=
'int'
)
self
.
spaceNum
.
set
(
spaceNum
)
self
.
spaceNum
.
set
(
spaceNum
)
def
LoadThemeCfg
(
self
):
def
LoadThemeCfg
(
self
):
##current theme type radiobutton
##current theme type radiobutton
self
.
themeIsBuiltin
.
set
(
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'default'
,
self
.
themeIsBuiltin
.
set
(
idleConf
.
GetOption
(
type
=
'bool'
,
default
=
1
))
'main'
,
'Theme'
,
'default'
,
type
=
'bool'
,
default
=
1
))
##currently set theme
##currently set theme
currentOption
=
idleConf
.
CurrentTheme
()
currentOption
=
idleConf
.
CurrentTheme
()
##load available theme option menus
##load available theme option menus
if
self
.
themeIsBuiltin
.
get
():
#default theme selected
if
self
.
themeIsBuiltin
.
get
():
#default theme selected
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'highlight'
)
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'highlight'
)
itemList
.
sort
()
itemList
.
sort
()
self
.
optMenuThemeBuiltin
.
SetMenu
(
itemList
,
currentOption
)
self
.
optMenuThemeBuiltin
.
SetMenu
(
itemList
,
currentOption
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
itemList
.
sort
()
itemList
.
sort
()
if
not
itemList
:
if
not
itemList
:
self
.
radioThemeCustom
.
config
(
state
=
DISABLED
)
self
.
radioThemeCustom
.
config
(
state
=
DISABLED
)
self
.
customTheme
.
set
(
'- no custom themes -'
)
self
.
customTheme
.
set
(
'- no custom themes -'
)
else
:
else
:
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
else
:
#user theme selected
else
:
#user theme selected
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'highlight'
)
itemList
.
sort
()
itemList
.
sort
()
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
currentOption
)
self
.
optMenuThemeCustom
.
SetMenu
(
itemList
,
currentOption
)
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'highlight'
)
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'highlight'
)
itemList
.
sort
()
itemList
.
sort
()
self
.
optMenuThemeBuiltin
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
optMenuThemeBuiltin
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
SetThemeType
()
self
.
SetThemeType
()
##load theme element option menu
##load theme element option menu
themeNames
=
list
(
self
.
themeElements
.
keys
())
themeNames
=
list
(
self
.
themeElements
.
keys
())
themeNames
.
sort
(
key
=
lambda
x
:
self
.
themeElements
[
x
][
1
])
themeNames
.
sort
(
key
=
lambda
x
:
self
.
themeElements
[
x
][
1
])
self
.
optMenuHighlightTarget
.
SetMenu
(
themeNames
,
themeNames
[
0
])
self
.
optMenuHighlightTarget
.
SetMenu
(
themeNames
,
themeNames
[
0
])
self
.
PaintThemeSample
()
self
.
PaintThemeSample
()
self
.
SetHighlightTarget
()
self
.
SetHighlightTarget
()
def
LoadKeyCfg
(
self
):
def
LoadKeyCfg
(
self
):
##current keys type radiobutton
##current keys type radiobutton
self
.
keysAreBuiltin
.
set
(
idleConf
.
GetOption
(
'main'
,
'Keys'
,
'default'
,
self
.
keysAreBuiltin
.
set
(
idleConf
.
GetOption
(
type
=
'bool'
,
default
=
1
))
'main'
,
'Keys'
,
'default'
,
type
=
'bool'
,
default
=
1
))
##currently set keys
##currently set keys
currentOption
=
idleConf
.
CurrentKeys
()
currentOption
=
idleConf
.
CurrentKeys
()
##load available keyset option menus
##load available keyset option menus
if
self
.
keysAreBuiltin
.
get
():
#default theme selected
if
self
.
keysAreBuiltin
.
get
():
#default theme selected
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'keys'
)
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'keys'
)
itemList
.
sort
()
itemList
.
sort
()
self
.
optMenuKeysBuiltin
.
SetMenu
(
itemList
,
currentOption
)
self
.
optMenuKeysBuiltin
.
SetMenu
(
itemList
,
currentOption
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
.
sort
()
itemList
.
sort
()
if
not
itemList
:
if
not
itemList
:
self
.
radioKeysCustom
.
config
(
state
=
DISABLED
)
self
.
radioKeysCustom
.
config
(
state
=
DISABLED
)
self
.
customKeys
.
set
(
'- no custom keys -'
)
self
.
customKeys
.
set
(
'- no custom keys -'
)
else
:
else
:
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
itemList
[
0
])
else
:
#user key set selected
else
:
#user key set selected
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
=
idleConf
.
GetSectionList
(
'user'
,
'keys'
)
itemList
.
sort
()
itemList
.
sort
()
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
currentOption
)
self
.
optMenuKeysCustom
.
SetMenu
(
itemList
,
currentOption
)
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'keys'
)
itemList
=
idleConf
.
GetSectionList
(
'default'
,
'keys'
)
itemList
.
sort
()
itemList
.
sort
()
self
.
optMenuKeysBuiltin
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
optMenuKeysBuiltin
.
SetMenu
(
itemList
,
itemList
[
0
])
self
.
SetKeysType
()
self
.
SetKeysType
()
##load keyset element list
##load keyset element list
keySetName
=
idleConf
.
CurrentKeys
()
keySetName
=
idleConf
.
CurrentKeys
()
self
.
LoadKeysList
(
keySetName
)
self
.
LoadKeysList
(
keySetName
)
def
LoadGeneralCfg
(
self
):
def
LoadGeneralCfg
(
self
):
#startup state
#startup state
self
.
startupEdit
.
set
(
idleConf
.
GetOption
(
'main'
,
'General'
,
self
.
startupEdit
.
set
(
idleConf
.
GetOption
(
'
editor-on-startup'
,
default
=
1
,
type
=
'bool'
))
'
main'
,
'General'
,
'editor-on-startup'
,
default
=
1
,
type
=
'bool'
))
#autosave state
#autosave state
self
.
autoSave
.
set
(
idleConf
.
GetOption
(
'main'
,
'General'
,
'autosave'
,
self
.
autoSave
.
set
(
idleConf
.
GetOption
(
default
=
0
,
type
=
'bool'
))
'main'
,
'General'
,
'autosave'
,
default
=
0
,
type
=
'bool'
))
#initial window size
#initial window size
self
.
winWidth
.
set
(
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
'width'
,
self
.
winWidth
.
set
(
idleConf
.
GetOption
(
type
=
'int'
))
'main'
,
'EditorWindow'
,
'width'
,
type
=
'int'
))
self
.
winHeight
.
set
(
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
'height'
,
self
.
winHeight
.
set
(
idleConf
.
GetOption
(
type
=
'int'
))
'main'
,
'EditorWindow'
,
'height'
,
type
=
'int'
))
#initial paragraph reformat size
#initial paragraph reformat size
self
.
paraWidth
.
set
(
idleConf
.
GetOption
(
'main'
,
'FormatParagraph'
,
'paragraph'
,
self
.
paraWidth
.
set
(
idleConf
.
GetOption
(
type
=
'int'
))
'main'
,
'FormatParagraph'
,
'paragraph'
,
type
=
'int'
))
# default source encoding
# default source encoding
self
.
encoding
.
set
(
idleConf
.
GetOption
(
'main'
,
'EditorWindow'
,
self
.
encoding
.
set
(
idleConf
.
GetOption
(
'encoding'
,
default
=
'none'
))
'main'
,
'EditorWindow'
,
'encoding'
,
default
=
'none'
))
# additional help sources
# additional help sources
self
.
userHelpList
=
idleConf
.
GetAllExtraHelpSourcesList
()
self
.
userHelpList
=
idleConf
.
GetAllExtraHelpSourcesList
()
for
helpItem
in
self
.
userHelpList
:
for
helpItem
in
self
.
userHelpList
:
self
.
listHelp
.
insert
(
END
,
helpItem
[
0
])
self
.
listHelp
.
insert
(
END
,
helpItem
[
0
])
self
.
SetHelpListButtonStates
()
self
.
SetHelpListButtonStates
()
def
LoadConfigs
(
self
):
def
LoadConfigs
(
self
):
...
@@ -1067,7 +1101,7 @@ class ConfigDialog(Toplevel):
...
@@ -1067,7 +1101,7 @@ class ConfigDialog(Toplevel):
### general page
### general page
self
.
LoadGeneralCfg
()
self
.
LoadGeneralCfg
()
def
SaveNewKeySet
(
self
,
keySetName
,
keySet
):
def
SaveNewKeySet
(
self
,
keySetName
,
keySet
):
"""
"""
save a newly created core key set.
save a newly created core key set.
keySetName - string, the name of the new key set
keySetName - string, the name of the new key set
...
@@ -1076,10 +1110,10 @@ class ConfigDialog(Toplevel):
...
@@ -1076,10 +1110,10 @@ class ConfigDialog(Toplevel):
if
not
idleConf
.
userCfg
[
'keys'
]
.
has_section
(
keySetName
):
if
not
idleConf
.
userCfg
[
'keys'
]
.
has_section
(
keySetName
):
idleConf
.
userCfg
[
'keys'
]
.
add_section
(
keySetName
)
idleConf
.
userCfg
[
'keys'
]
.
add_section
(
keySetName
)
for
event
in
keySet
:
for
event
in
keySet
:
value
=
keySet
[
event
]
value
=
keySet
[
event
]
idleConf
.
userCfg
[
'keys'
]
.
SetOption
(
keySetName
,
event
,
value
)
idleConf
.
userCfg
[
'keys'
]
.
SetOption
(
keySetName
,
event
,
value
)
def
SaveNewTheme
(
self
,
themeName
,
theme
):
def
SaveNewTheme
(
self
,
themeName
,
theme
):
"""
"""
save a newly created theme.
save a newly created theme.
themeName - string, the name of the new theme
themeName - string, the name of the new theme
...
@@ -1088,16 +1122,16 @@ class ConfigDialog(Toplevel):
...
@@ -1088,16 +1122,16 @@ class ConfigDialog(Toplevel):
if
not
idleConf
.
userCfg
[
'highlight'
]
.
has_section
(
themeName
):
if
not
idleConf
.
userCfg
[
'highlight'
]
.
has_section
(
themeName
):
idleConf
.
userCfg
[
'highlight'
]
.
add_section
(
themeName
)
idleConf
.
userCfg
[
'highlight'
]
.
add_section
(
themeName
)
for
element
in
theme
:
for
element
in
theme
:
value
=
theme
[
element
]
value
=
theme
[
element
]
idleConf
.
userCfg
[
'highlight'
]
.
SetOption
(
themeName
,
element
,
value
)
idleConf
.
userCfg
[
'highlight'
]
.
SetOption
(
themeName
,
element
,
value
)
def
SetUserValue
(
self
,
configType
,
section
,
item
,
value
):
def
SetUserValue
(
self
,
configType
,
section
,
item
,
value
):
if
idleConf
.
defaultCfg
[
configType
]
.
has_option
(
section
,
item
):
if
idleConf
.
defaultCfg
[
configType
]
.
has_option
(
section
,
item
):
if
idleConf
.
defaultCfg
[
configType
]
.
Get
(
section
,
item
)
==
value
:
if
idleConf
.
defaultCfg
[
configType
]
.
Get
(
section
,
item
)
==
value
:
#the setting equals a default setting, remove it from user cfg
#the setting equals a default setting, remove it from user cfg
return
idleConf
.
userCfg
[
configType
]
.
RemoveOption
(
section
,
item
)
return
idleConf
.
userCfg
[
configType
]
.
RemoveOption
(
section
,
item
)
#if we got here set the option
#if we got here set the option
return
idleConf
.
userCfg
[
configType
]
.
SetOption
(
section
,
item
,
value
)
return
idleConf
.
userCfg
[
configType
]
.
SetOption
(
section
,
item
,
value
)
def
SaveAllChangedConfigs
(
self
):
def
SaveAllChangedConfigs
(
self
):
"Save configuration changes to the user config file."
"Save configuration changes to the user config file."
...
@@ -1111,7 +1145,7 @@ class ConfigDialog(Toplevel):
...
@@ -1111,7 +1145,7 @@ class ConfigDialog(Toplevel):
cfgTypeHasChanges
=
True
cfgTypeHasChanges
=
True
for
item
in
self
.
changedItems
[
configType
][
section
]:
for
item
in
self
.
changedItems
[
configType
][
section
]:
value
=
self
.
changedItems
[
configType
][
section
][
item
]
value
=
self
.
changedItems
[
configType
][
section
][
item
]
if
self
.
SetUserValue
(
configType
,
section
,
item
,
value
):
if
self
.
SetUserValue
(
configType
,
section
,
item
,
value
):
cfgTypeHasChanges
=
True
cfgTypeHasChanges
=
True
if
cfgTypeHasChanges
:
if
cfgTypeHasChanges
:
idleConf
.
userCfg
[
configType
]
.
Save
()
idleConf
.
userCfg
[
configType
]
.
Save
()
...
...
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