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
1d46e40f
Kaydet (Commit)
1d46e40f
authored
Mar 27, 2002
tarafından
Steven M. Gava
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
further work on new config system;
recent files menu
üst
03594bbb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
8 deletions
+79
-8
EditorWindow.py
Lib/idlelib/EditorWindow.py
+70
-1
IOBinding.py
Lib/idlelib/IOBinding.py
+9
-3
configDialog.py
Lib/idlelib/configDialog.py
+0
-4
No files found.
Lib/idlelib/EditorWindow.py
Dosyayı görüntüle @
1d46e40f
...
@@ -105,6 +105,8 @@ class EditorWindow:
...
@@ -105,6 +105,8 @@ class EditorWindow:
#self.top.instanceDict makes flist.inversedict avalable to
#self.top.instanceDict makes flist.inversedict avalable to
#configDialog.py so it can access all EditorWindow instaces
#configDialog.py so it can access all EditorWindow instaces
self
.
top
.
instanceDict
=
flist
.
inversedict
self
.
top
.
instanceDict
=
flist
.
inversedict
self
.
recentFilesPath
=
os
.
path
.
join
(
idleConf
.
GetUserCfgDir
(),
'recent-files.lst'
)
self
.
vbar
=
vbar
=
Scrollbar
(
top
,
name
=
'vbar'
)
self
.
vbar
=
vbar
=
Scrollbar
(
top
,
name
=
'vbar'
)
self
.
text_frame
=
text_frame
=
Frame
(
top
)
self
.
text_frame
=
text_frame
=
Frame
(
top
)
self
.
text
=
text
=
Text
(
text_frame
,
name
=
'text'
,
padx
=
5
,
wrap
=
None
,
self
.
text
=
text
=
Text
(
text_frame
,
name
=
'text'
,
padx
=
5
,
wrap
=
None
,
...
@@ -178,6 +180,11 @@ class EditorWindow:
...
@@ -178,6 +180,11 @@ class EditorWindow:
self
.
color
=
None
self
.
color
=
None
self
.
undo
=
undo
=
self
.
UndoDelegator
();
per
.
insertfilter
(
undo
)
self
.
undo
=
undo
=
self
.
UndoDelegator
();
per
.
insertfilter
(
undo
)
self
.
io
=
io
=
self
.
IOBinding
(
self
)
self
.
io
=
io
=
self
.
IOBinding
(
self
)
#create the Recent Files submenu
self
.
menuRecentFiles
=
Menu
(
self
.
menubar
)
self
.
menudict
[
'file'
]
.
insert_cascade
(
3
,
label
=
'Recent Files'
,
underline
=
0
,
menu
=
self
.
menuRecentFiles
)
self
.
UpdateRecentFilesList
()
text
.
undo_block_start
=
undo
.
undo_block_start
text
.
undo_block_start
=
undo
.
undo_block_start
text
.
undo_block_stop
=
undo
.
undo_block_stop
text
.
undo_block_stop
=
undo
.
undo_block_stop
...
@@ -253,6 +260,7 @@ class EditorWindow:
...
@@ -253,6 +260,7 @@ class EditorWindow:
menudict
[
name
]
=
menu
=
Menu
(
mbar
,
name
=
name
)
menudict
[
name
]
=
menu
=
Menu
(
mbar
,
name
=
name
)
mbar
.
add_cascade
(
label
=
label
,
menu
=
menu
,
underline
=
underline
)
mbar
.
add_cascade
(
label
=
label
,
menu
=
menu
,
underline
=
underline
)
self
.
fill_menus
()
self
.
fill_menus
()
#create the ExtraHelp menu, if required
self
.
ResetExtraHelpMenu
()
self
.
ResetExtraHelpMenu
()
def
postwindowsmenu
(
self
):
def
postwindowsmenu
(
self
):
...
@@ -542,12 +550,69 @@ class EditorWindow:
...
@@ -542,12 +550,69 @@ class EditorWindow:
self
.
menuExtraHelp
.
delete
(
1
,
END
)
self
.
menuExtraHelp
.
delete
(
1
,
END
)
for
menuItem
in
menuList
:
for
menuItem
in
menuList
:
self
.
menuExtraHelp
.
add_command
(
label
=
menuItem
[
0
],
self
.
menuExtraHelp
.
add_command
(
label
=
menuItem
[
0
],
command
=
lambda
:
self
.
display_docs
(
menuItem
[
1
]))
command
=
self
.
__DisplayExtraHelpCallback
(
menuItem
[
1
]))
else
:
#no extra help items
else
:
#no extra help items
if
hasattr
(
self
,
'menuExtraHelp'
):
if
hasattr
(
self
,
'menuExtraHelp'
):
helpMenu
.
delete
(
cascadeIndex
-
1
)
helpMenu
.
delete
(
cascadeIndex
-
1
)
del
(
self
.
menuExtraHelp
)
del
(
self
.
menuExtraHelp
)
def
__DisplayExtraHelpCallback
(
self
,
helpFile
):
def
DisplayExtraHelp
(
helpFile
=
helpFile
):
self
.
display_docs
(
helpFile
)
return
DisplayExtraHelp
def
UpdateRecentFilesList
(
self
,
newFile
=
None
):
#load or update the recent files list, and menu if required
rfList
=
[]
if
os
.
path
.
exists
(
self
.
recentFilesPath
):
RFfile
=
open
(
self
.
recentFilesPath
,
'r'
)
try
:
rfList
=
RFfile
.
readlines
()
finally
:
RFfile
.
close
()
if
newFile
:
newFile
=
os
.
path
.
abspath
(
newFile
)
+
'
\n
'
if
newFile
in
rfList
:
rfList
.
remove
(
newFile
)
rfList
.
insert
(
0
,
newFile
)
rfList
=
self
.
__CleanRecentFiles
(
rfList
)
print
self
.
top
.
instanceDict
print
self
if
rfList
:
for
instance
in
self
.
top
.
instanceDict
.
keys
():
instance
.
menuRecentFiles
.
delete
(
1
,
END
)
for
file
in
rfList
:
fileName
=
file
[
0
:
-
1
]
instance
.
menuRecentFiles
.
add_command
(
label
=
fileName
,
command
=
instance
.
__RecentFileCallback
(
fileName
))
def
__CleanRecentFiles
(
self
,
rfList
):
origRfList
=
rfList
[:]
count
=
0
nonFiles
=
[]
for
path
in
rfList
:
if
not
os
.
path
.
exists
(
path
[
0
:
-
1
]):
nonFiles
.
append
(
count
)
count
=
count
+
1
if
nonFiles
:
nonFiles
.
reverse
()
for
index
in
nonFiles
:
del
(
rfList
[
index
])
if
len
(
rfList
)
>
19
:
rfList
=
rfList
[
0
:
19
]
#if rfList != origRfList:
RFfile
=
open
(
self
.
recentFilesPath
,
'w'
)
try
:
RFfile
.
writelines
(
rfList
)
finally
:
RFfile
.
close
()
return
rfList
def
__RecentFileCallback
(
self
,
fileName
):
def
OpenRecentFile
(
fileName
=
fileName
):
self
.
io
.
open
(
editFile
=
fileName
)
return
OpenRecentFile
def
saved_change_hook
(
self
):
def
saved_change_hook
(
self
):
short
=
self
.
short_title
()
short
=
self
.
short_title
()
long
=
self
.
long_title
()
long
=
self
.
long_title
()
...
@@ -628,6 +693,10 @@ class EditorWindow:
...
@@ -628,6 +693,10 @@ class EditorWindow:
return
reply
return
reply
def
_close
(
self
):
def
_close
(
self
):
print
self
.
io
.
filename
if
self
.
io
.
filename
:
self
.
UpdateRecentFilesList
(
newFile
=
self
.
io
.
filename
)
WindowList
.
unregister_callback
(
self
.
postwindowsmenu
)
WindowList
.
unregister_callback
(
self
.
postwindowsmenu
)
if
self
.
close_hook
:
if
self
.
close_hook
:
self
.
close_hook
()
self
.
close_hook
()
...
...
Lib/idlelib/IOBinding.py
Dosyayı görüntüle @
1d46e40f
...
@@ -72,9 +72,12 @@ class IOBinding:
...
@@ -72,9 +72,12 @@ class IOBinding:
if
self
.
filename_change_hook
:
if
self
.
filename_change_hook
:
self
.
filename_change_hook
()
self
.
filename_change_hook
()
def
open
(
self
,
event
):
def
open
(
self
,
event
=
None
,
editFile
=
None
):
if
self
.
editwin
.
flist
:
if
self
.
editwin
.
flist
:
filename
=
self
.
askopenfile
()
if
not
editFile
:
filename
=
self
.
askopenfile
()
else
:
filename
=
editFile
if
filename
:
if
filename
:
# if the current window has no filename and hasn't been
# if the current window has no filename and hasn't been
# modified, we replace it's contents (no loss). Otherwise
# modified, we replace it's contents (no loss). Otherwise
...
@@ -93,7 +96,10 @@ class IOBinding:
...
@@ -93,7 +96,10 @@ class IOBinding:
if
reply
==
"cancel"
:
if
reply
==
"cancel"
:
self
.
text
.
focus_set
()
self
.
text
.
focus_set
()
return
"break"
return
"break"
filename
=
self
.
askopenfile
()
if
not
editFile
:
filename
=
self
.
askopenfile
()
else
:
filename
=
editFile
if
filename
:
if
filename
:
self
.
loadfile
(
filename
)
self
.
loadfile
(
filename
)
else
:
else
:
...
...
Lib/idlelib/configDialog.py
Dosyayı görüntüle @
1d46e40f
...
@@ -1072,12 +1072,9 @@ class ConfigDialog(Toplevel):
...
@@ -1072,12 +1072,9 @@ class ConfigDialog(Toplevel):
"""
"""
save all configuration changes to user config files.
save all configuration changes to user config files.
"""
"""
#if self.changedItems['main'].has_key('HelpFiles'):
#this section gets completely replaced
#this section gets completely replaced
print
idleConf
.
GetAllExtraHelpSourcesList
()
idleConf
.
userCfg
[
'main'
]
.
remove_section
(
'HelpFiles'
)
idleConf
.
userCfg
[
'main'
]
.
remove_section
(
'HelpFiles'
)
idleConf
.
userCfg
[
'main'
]
.
Save
()
idleConf
.
userCfg
[
'main'
]
.
Save
()
print
idleConf
.
GetAllExtraHelpSourcesList
()
for
configType
in
self
.
changedItems
.
keys
():
for
configType
in
self
.
changedItems
.
keys
():
cfgTypeHasChanges
=
0
cfgTypeHasChanges
=
0
for
section
in
self
.
changedItems
[
configType
]
.
keys
():
for
section
in
self
.
changedItems
[
configType
]
.
keys
():
...
@@ -1086,7 +1083,6 @@ class ConfigDialog(Toplevel):
...
@@ -1086,7 +1083,6 @@ class ConfigDialog(Toplevel):
if
self
.
SetUserValue
(
configType
,
section
,
item
,
value
):
if
self
.
SetUserValue
(
configType
,
section
,
item
,
value
):
cfgTypeHasChanges
=
1
cfgTypeHasChanges
=
1
if
cfgTypeHasChanges
:
if
cfgTypeHasChanges
:
print
configType
,
'- changed'
idleConf
.
userCfg
[
configType
]
.
Save
()
idleConf
.
userCfg
[
configType
]
.
Save
()
self
.
ResetChangedItems
()
#clear the changed items dict
self
.
ResetChangedItems
()
#clear the changed items dict
...
...
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