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
b77d343b
Kaydet (Commit)
b77d343b
authored
Mar 02, 2002
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
First work on making config changes dynamic,
dynamic theme changes
üst
03b18834
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
36 deletions
+56
-36
ColorDelegator.py
Lib/idlelib/ColorDelegator.py
+15
-14
EditorWindow.py
Lib/idlelib/EditorWindow.py
+10
-0
PyShell.py
Lib/idlelib/PyShell.py
+16
-12
configDialog.py
Lib/idlelib/configDialog.py
+7
-8
configHandler.py
Lib/idlelib/configHandler.py
+8
-2
No files found.
Lib/idlelib/ColorDelegator.py
Dosyayı görüntüle @
b77d343b
...
...
@@ -37,6 +37,7 @@ class ColorDelegator(Delegator):
self
.
prog
=
prog
self
.
idprog
=
idprog
self
.
asprog
=
asprog
self
.
LoadTagDefs
()
def
setdelegate
(
self
,
delegate
):
if
self
.
delegate
is
not
None
:
...
...
@@ -52,21 +53,21 @@ class ColorDelegator(Delegator):
if
cnf
:
apply
(
self
.
tag_configure
,
(
tag
,),
cnf
)
self
.
tag_raise
(
'sel'
)
theme
=
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
tagdefs
=
{
"COMMENT"
:
idleConf
.
GetHighlight
(
theme
,
"comment"
),
"KEYWORD"
:
idleConf
.
GetHighlight
(
theme
,
"keyword"
),
"STRING"
:
idleConf
.
GetHighlight
(
theme
,
"string"
),
"DEFINITION"
:
idleConf
.
GetHighlight
(
theme
,
"definition"
),
"SYNC"
:
{
'background'
:
None
,
'foreground'
:
None
},
"TODO"
:
{
'background'
:
None
,
'foreground'
:
None
},
"BREAK"
:
idleConf
.
GetHighlight
(
theme
,
"break"
),
# The following is used by ReplaceDialog:
"hit"
:
idleConf
.
GetHighlight
(
theme
,
"hit"
),
}
def
LoadTagDefs
(
self
):
theme
=
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
self
.
tagdefs
=
{
"COMMENT"
:
idleConf
.
GetHighlight
(
theme
,
"comment"
),
"KEYWORD"
:
idleConf
.
GetHighlight
(
theme
,
"keyword"
),
"STRING"
:
idleConf
.
GetHighlight
(
theme
,
"string"
),
"DEFINITION"
:
idleConf
.
GetHighlight
(
theme
,
"definition"
),
"SYNC"
:
{
'background'
:
None
,
'foreground'
:
None
},
"TODO"
:
{
'background'
:
None
,
'foreground'
:
None
},
"BREAK"
:
idleConf
.
GetHighlight
(
theme
,
"break"
),
# The following is used by ReplaceDialog:
"hit"
:
idleConf
.
GetHighlight
(
theme
,
"hit"
),
}
if
DEBUG
:
print
'tagdefs'
,
tagdefs
def
insert
(
self
,
index
,
chars
,
tags
=
None
):
...
...
Lib/idlelib/EditorWindow.py
Dosyayı görüntüle @
b77d343b
...
...
@@ -102,6 +102,9 @@ class EditorWindow:
self
.
vars
=
flist
.
vars
self
.
menubar
=
Menu
(
root
)
self
.
top
=
top
=
self
.
Toplevel
(
root
,
menu
=
self
.
menubar
)
#self.top.instanceDict makes flist.inversedict avalable to
#configDialog.py so it can access all EditorWindow instaces
self
.
top
.
instanceDict
=
flist
.
inversedict
self
.
vbar
=
vbar
=
Scrollbar
(
top
,
name
=
'vbar'
)
self
.
text_frame
=
text_frame
=
Frame
(
top
)
self
.
text
=
text
=
Text
(
text_frame
,
name
=
'text'
,
padx
=
5
,
wrap
=
None
,
...
...
@@ -467,6 +470,13 @@ class EditorWindow:
self
.
per
.
removefilter
(
self
.
color
)
self
.
color
=
None
self
.
per
.
insertfilter
(
self
.
undo
)
def
ResetColorizer
(
self
):
#this function is called from configDialog.py
#to update the colour theme if it is changed
if
self
.
color
:
self
.
color
=
self
.
ColorDelegator
()
self
.
per
.
insertfilter
(
self
.
color
)
def
saved_change_hook
(
self
):
short
=
self
.
short_title
()
...
...
Lib/idlelib/PyShell.py
Dosyayı görüntüle @
b77d343b
...
...
@@ -134,23 +134,27 @@ class PyShellFileList(FileList):
class
ModifiedColorDelegator
(
ColorDelegator
):
# Colorizer for the shell window itself
def
__init__
(
self
):
ColorDelegator
.
__init__
(
self
)
self
.
LoadTagDefs
()
def
recolorize_main
(
self
):
self
.
tag_remove
(
"TODO"
,
"1.0"
,
"iomark"
)
self
.
tag_add
(
"SYNC"
,
"1.0"
,
"iomark"
)
ColorDelegator
.
recolorize_main
(
self
)
tagdefs
=
ColorDelegator
.
tagdefs
.
copy
()
theme
=
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
tagdefs
.
update
({
"stdin"
:
{
'background'
:
None
,
'foreground'
:
None
},
"stdout"
:
idleConf
.
GetHighlight
(
theme
,
"stdout"
),
"stderr"
:
idleConf
.
GetHighlight
(
theme
,
"stderr"
),
"console"
:
idleConf
.
GetHighlight
(
theme
,
"console"
),
"ERROR"
:
idleConf
.
GetHighlight
(
theme
,
"error"
),
None
:
idleConf
.
GetHighlight
(
theme
,
"normal"
),
})
def
LoadTagDefs
(
self
):
ColorDelegator
.
LoadTagDefs
(
self
)
theme
=
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
self
.
tagdefs
.
update
({
"stdin"
:
{
'background'
:
None
,
'foreground'
:
None
},
"stdout"
:
idleConf
.
GetHighlight
(
theme
,
"stdout"
),
"stderr"
:
idleConf
.
GetHighlight
(
theme
,
"stderr"
),
"console"
:
idleConf
.
GetHighlight
(
theme
,
"console"
),
"ERROR"
:
idleConf
.
GetHighlight
(
theme
,
"error"
),
None
:
idleConf
.
GetHighlight
(
theme
,
"normal"
),
})
class
ModifiedUndoDelegator
(
UndoDelegator
):
...
...
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
b77d343b
...
...
@@ -23,8 +23,6 @@ class ConfigDialog(Toplevel):
#Theme Elements. Each theme element key is it's display name.
#The first value of the tuple is the sample area tag name.
#The second value is the display name list sort index.
#The third value indicates whether the element can have a foreground
#or background colour or both.
self
.
themeElements
=
{
'Normal Text'
:(
'normal'
,
'00'
),
'Python Keywords'
:(
'keyword'
,
'01'
),
'Python Definitions'
:(
'definition'
,
'02'
),
...
...
@@ -180,8 +178,8 @@ class ConfigDialog(Toplevel):
frameTheme
=
Frame
(
frame
,
borderwidth
=
2
,
relief
=
GROOVE
)
#frameCustom
self
.
textHighlightSample
=
Text
(
frameCustom
,
relief
=
SOLID
,
borderwidth
=
1
,
font
=
(
'courier'
,
12
,
''
),
cursor
=
'hand2'
,
width
=
10
,
height
=
10
,
takefocus
=
FALSE
,
highlightthickness
=
0
)
font
=
(
'courier'
,
12
,
''
),
cursor
=
'hand2'
,
width
=
21
,
height
=
10
,
takefocus
=
FALSE
,
highlightthickness
=
0
,
wrap
=
NONE
)
text
=
self
.
textHighlightSample
text
.
bind
(
'<Double-Button-1>'
,
lambda
e
:
'break'
)
text
.
bind
(
'<B1-Motion>'
,
lambda
e
:
'break'
)
...
...
@@ -514,7 +512,7 @@ class ConfigDialog(Toplevel):
self
.
AddChangedItem
(
'main'
,
'General'
,
'editor-on-startup'
,
value
)
def
ResetChangedItems
(
self
):
#
changedItems.
When any config item is changed in this dialog, an entry
#When any config item is changed in this dialog, an entry
#should be made in the relevant section (config type) of this
#dictionary. The key should be the config file section name and the
#value a dictionary, whose key:value pairs are item=value pairs for
...
...
@@ -1086,14 +1084,15 @@ class ConfigDialog(Toplevel):
def
ActivateConfigChanges
(
self
):
#things that need to be done to make
#applied config changes dynamic:
#
#update editor/shell font and repaint
#dynamically update indentation setttings
#update theme and repaint
#update keybindings and re-bind
#update user help sources menu
pass
winInstances
=
self
.
parent
.
instanceDict
.
keys
()
for
instance
in
winInstances
:
instance
.
ResetColorizer
()
def
Cancel
(
self
):
self
.
destroy
()
...
...
Lib/idlelib/configHandler.py
Dosyayı görüntüle @
b77d343b
...
...
@@ -110,6 +110,13 @@ class IdleUserConfParser(IdleConfParser):
self
.
set
(
section
,
option
,
value
)
return
1
def
RemoveFile
(
self
):
"""
Removes the user config file from disk if it exists.
"""
if
os
.
path
.
exists
(
self
.
file
):
os
.
remove
(
self
.
file
)
def
Save
(
self
):
"""
If config isn't empty, write file to disk. If config is empty,
...
...
@@ -119,8 +126,7 @@ class IdleUserConfParser(IdleConfParser):
cfgFile
=
open
(
self
.
file
,
'w'
)
self
.
write
(
cfgFile
)
else
:
if
os
.
path
.
exists
(
self
.
file
):
os
.
remove
(
self
.
file
)
self
.
RemoveFile
()
class
IdleConf
:
"""
...
...
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