Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
acb758e5
Commit
acb758e5
authored
Mar 27, 2002
by
Steven M. Gava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further work on new config system;
user defined help items
parent
9c988d0b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
26 deletions
+56
-26
Lib/idlelib/EditorWindow.py
Lib/idlelib/EditorWindow.py
+30
-7
Lib/idlelib/config-keys.def
Lib/idlelib/config-keys.def
+1
-1
Lib/idlelib/config-main.def
Lib/idlelib/config-main.def
+0
-2
Lib/idlelib/configDialog.py
Lib/idlelib/configDialog.py
+23
-16
Lib/idlelib/configHelpSourceEdit.py
Lib/idlelib/configHelpSourceEdit.py
+2
-0
No files found.
Lib/idlelib/EditorWindow.py
View file @
acb758e5
...
@@ -98,13 +98,13 @@ class EditorWindow:
...
@@ -98,13 +98,13 @@ class EditorWindow:
self
.
flist
=
flist
self
.
flist
=
flist
root
=
root
or
flist
.
root
root
=
root
or
flist
.
root
self
.
root
=
root
self
.
root
=
root
if
flist
:
self
.
vars
=
flist
.
vars
self
.
menubar
=
Menu
(
root
)
self
.
menubar
=
Menu
(
root
)
self
.
top
=
top
=
self
.
Toplevel
(
root
,
menu
=
self
.
menubar
)
self
.
top
=
top
=
self
.
Toplevel
(
root
,
menu
=
self
.
menubar
)
#self.top.instanceDict makes flist.inversedict avalable to
if
flist
:
#configDialog.py so it can access all EditorWindow instaces
self
.
vars
=
flist
.
vars
self
.
top
.
instanceDict
=
flist
.
inversedict
#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
.
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
,
...
@@ -213,7 +213,7 @@ class EditorWindow:
...
@@ -213,7 +213,7 @@ class EditorWindow:
if
self
.
extensions
.
has_key
(
'AutoIndent'
):
if
self
.
extensions
.
has_key
(
'AutoIndent'
):
self
.
extensions
[
'AutoIndent'
].
set_indentation_params
(
self
.
extensions
[
'AutoIndent'
].
set_indentation_params
(
self
.
ispythonsource
(
filename
))
self
.
ispythonsource
(
filename
))
def
set_status_bar
(
self
):
def
set_status_bar
(
self
):
self
.
status_bar
=
self
.
MultiStatusBar
(
self
.
top
)
self
.
status_bar
=
self
.
MultiStatusBar
(
self
.
top
)
self
.
status_bar
.
set_label
(
'column'
,
'Col: ?'
,
side
=
RIGHT
)
self
.
status_bar
.
set_label
(
'column'
,
'Col: ?'
,
side
=
RIGHT
)
...
@@ -253,6 +253,7 @@ class EditorWindow:
...
@@ -253,6 +253,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
()
self
.
ResetExtraHelpMenu
()
def
postwindowsmenu
(
self
):
def
postwindowsmenu
(
self
):
# Only called when Windows menu exists
# Only called when Windows menu exists
...
@@ -323,7 +324,10 @@ class EditorWindow:
...
@@ -323,7 +324,10 @@ class EditorWindow:
del
fn
del
fn
def
python_docs
(
self
,
event
=
None
):
def
python_docs
(
self
,
event
=
None
):
webbrowser
.
open
(
self
.
help_url
)
self
.
display_docs
(
self
.
help_url
)
def
display_docs
(
self
,
url
):
webbrowser
.
open
(
url
)
def
select_all
(
self
,
event
=
None
):
def
select_all
(
self
,
event
=
None
):
self
.
text
.
tag_add
(
"sel"
,
"1.0"
,
"end-1c"
)
self
.
text
.
tag_add
(
"sel"
,
"1.0"
,
"end-1c"
)
...
@@ -525,6 +529,25 @@ class EditorWindow:
...
@@ -525,6 +529,25 @@ class EditorWindow:
menu
.
entryconfig
(
index
,
accelerator
=
accel
)
menu
.
entryconfig
(
index
,
accelerator
=
accel
)
#print 'accel now:',accel,'\n'
#print 'accel now:',accel,'\n'
def
ResetExtraHelpMenu
(
self
):
#load or update the Extra Help menu if required
menuList
=
idleConf
.
GetAllExtraHelpSourcesList
()
helpMenu
=
self
.
menudict
[
'help'
]
cascadeIndex
=
helpMenu
.
index
(
END
)
-
1
if
menuList
:
if
not
hasattr
(
self
,
'menuExtraHelp'
):
self
.
menuExtraHelp
=
Menu
(
self
.
menubar
)
helpMenu
.
insert_cascade
(
cascadeIndex
,
label
=
'Extra Help'
,
underline
=
1
,
menu
=
self
.
menuExtraHelp
)
self
.
menuExtraHelp
.
delete
(
1
,
END
)
for
menuItem
in
menuList
:
self
.
menuExtraHelp
.
add_command
(
label
=
menuItem
[
0
],
command
=
lambda
:
self
.
display_docs
(
menuItem
[
1
]))
else
:
#no extra help items
if
hasattr
(
self
,
'menuExtraHelp'
):
helpMenu
.
delete
(
cascadeIndex
-
1
)
del
(
self
.
menuExtraHelp
)
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
()
...
...
Lib/idlelib/config-keys.def
View file @
acb758e5
...
@@ -29,7 +29,7 @@ plain-newline-and-indent=<Control-Key-j>
...
@@ -29,7 +29,7 @@ plain-newline-and-indent=<Control-Key-j>
redo=<Control-Shift-Key-z>
redo=<Control-Shift-Key-z>
remove-selection=<Key-Escape>
remove-selection=<Key-Escape>
save-copy-of-window-as-file=<Alt-Shift-Key-s>
save-copy-of-window-as-file=<Alt-Shift-Key-s>
save-window-as-file=<
Al
t-Key-s>
save-window-as-file=<
Control-Shif
t-Key-s>
save-window=<Control-Key-s>
save-window=<Control-Key-s>
select-all=<Alt-Key-a>
select-all=<Alt-Key-a>
toggle-auto-coloring=<Control-Key-slash>
toggle-auto-coloring=<Control-Key-slash>
...
...
Lib/idlelib/config-main.def
View file @
acb758e5
...
@@ -28,8 +28,6 @@
...
@@ -28,8 +28,6 @@
[General]
[General]
editor-on-startup= 1
editor-on-startup= 1
user-help-browser= 0
user-help-browser-command=
[EditorWindow]
[EditorWindow]
width= 80
width= 80
...
...
Lib/idlelib/configDialog.py
View file @
acb758e5
...
@@ -367,11 +367,13 @@ class ConfigDialog(Toplevel):
...
@@ -367,11 +367,13 @@ class ConfigDialog(Toplevel):
width
=
8
,
command
=
self
.
HelpListItemAdd
)
width
=
8
,
command
=
self
.
HelpListItemAdd
)
self
.
buttonHelpListRemove
=
Button
(
frameHelpListButtons
,
text
=
'Remove'
,
self
.
buttonHelpListRemove
=
Button
(
frameHelpListButtons
,
text
=
'Remove'
,
state
=
DISABLED
,
width
=
8
,
command
=
self
.
HelpListItemRemove
)
state
=
DISABLED
,
width
=
8
,
command
=
self
.
HelpListItemRemove
)
checkHelpBrowser
=
Checkbutton
(
frameHelp
,
variable
=
self
.
userHelpBrowser
,
# the following is better handled by the BROWSER environment
onvalue
=
1
,
offvalue
=
0
,
text
=
'user specified (html) help browser:'
,
# variable under unix/linux
command
=
self
.
OnCheckUserHelpBrowser
)
#checkHelpBrowser=Checkbutton(frameHelp,variable=self.userHelpBrowser,
self
.
entryHelpBrowser
=
Entry
(
frameHelp
,
textvariable
=
self
.
helpBrowser
,
# onvalue=1,offvalue=0,text='user specified (html) help browser:',
width
=
40
)
# command=self.OnCheckUserHelpBrowser)
#self.entryHelpBrowser=Entry(frameHelp,textvariable=self.helpBrowser,
# width=40)
#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
)
...
@@ -398,8 +400,8 @@ class ConfigDialog(Toplevel):
...
@@ -398,8 +400,8 @@ class ConfigDialog(Toplevel):
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
)
checkHelpBrowser
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
)
#
checkHelpBrowser.pack(side=TOP,anchor=W,padx=5)
self
.
entryHelpBrowser
.
pack
(
side
=
TOP
,
anchor
=
W
,
padx
=
5
,
pady
=
5
)
#
self.entryHelpBrowser.pack(side=TOP,anchor=W,padx=5,pady=5)
return
frame
return
frame
def
AttachVarCallbacks
(
self
):
def
AttachVarCallbacks
(
self
):
...
@@ -870,7 +872,7 @@ class ConfigDialog(Toplevel):
...
@@ -870,7 +872,7 @@ class ConfigDialog(Toplevel):
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
,
'
New
Help Source'
,
newHelpSource
=
GetHelpSourceDialog
(
self
,
'
Edit
Help Source'
,
menuItem
=
helpSource
[
0
],
filePath
=
helpSource
[
1
]).
result
menuItem
=
helpSource
[
0
],
filePath
=
helpSource
[
1
]).
result
if
(
not
newHelpSource
)
or
(
newHelpSource
==
helpSource
):
if
(
not
newHelpSource
)
or
(
newHelpSource
==
helpSource
):
return
#no changes
return
#no changes
...
@@ -1013,11 +1015,11 @@ class ConfigDialog(Toplevel):
...
@@ -1013,11 +1015,11 @@ class ConfigDialog(Toplevel):
for
helpItem
in
self
.
userHelpList
:
for
helpItem
in
self
.
userHelpList
:
self
.
listHelp
.
insert
(
END
,
helpItem
[
0
]
+
' '
+
helpItem
[
1
])
self
.
listHelp
.
insert
(
END
,
helpItem
[
0
]
+
' '
+
helpItem
[
1
])
self
.
SetHelpListButtonStates
()
self
.
SetHelpListButtonStates
()
self
.
userHelpBrowser
.
set
(
idleConf
.
GetOption
(
'main'
,
'General'
,
#
self.userHelpBrowser.set(idleConf.GetOption('main','General',
'user-help-browser'
,
default
=
0
,
type
=
'bool'
))
#
'user-help-browser',default=0,type='bool'))
self
.
helpBrowser
.
set
(
idleConf
.
GetOption
(
'main'
,
'General'
,
#
self.helpBrowser.set(idleConf.GetOption('main','General',
'user-help-browser-command'
,
default
=
''
))
#
'user-help-browser-command',default=''))
self
.
OnCheckUserHelpBrowser
()
#
self.OnCheckUserHelpBrowser()
def
LoadConfigs
(
self
):
def
LoadConfigs
(
self
):
"""
"""
...
@@ -1070,9 +1072,12 @@ class ConfigDialog(Toplevel):
...
@@ -1070,9 +1072,12 @@ 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'
):
#if self.changedItems['main'].has_key('HelpFiles'):
#this section gets completely replaced
#this section gets completely replaced
idleConf
.
userCfg
[
'main'
].
remove_section
(
'HelpFiles'
)
print
idleConf
.
GetAllExtraHelpSourcesList
()
idleConf
.
userCfg
[
'main'
].
remove_section
(
'HelpFiles'
)
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
():
...
@@ -1081,6 +1086,7 @@ class ConfigDialog(Toplevel):
...
@@ -1081,6 +1086,7 @@ 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
...
@@ -1097,6 +1103,7 @@ class ConfigDialog(Toplevel):
...
@@ -1097,6 +1103,7 @@ class ConfigDialog(Toplevel):
instance
.
ResetColorizer
()
instance
.
ResetColorizer
()
instance
.
ResetFont
()
instance
.
ResetFont
()
instance
.
ResetKeybindings
()
instance
.
ResetKeybindings
()
instance
.
ResetExtraHelpMenu
()
def
Cancel
(
self
):
def
Cancel
(
self
):
self
.
destroy
()
self
.
destroy
()
...
...
Lib/idlelib/configHelpSourceEdit.py
View file @
acb758e5
...
@@ -22,6 +22,8 @@ class GetHelpSourceDialog(Toplevel):
...
@@ -22,6 +22,8 @@ class GetHelpSourceDialog(Toplevel):
self
.
parent
=
parent
self
.
parent
=
parent
self
.
result
=
None
self
.
result
=
None
self
.
CreateWidgets
()
self
.
CreateWidgets
()
self
.
menu
.
set
(
menuItem
)
self
.
path
.
set
(
filePath
)
self
.
withdraw
()
#hide while setting geometry
self
.
withdraw
()
#hide while setting geometry
self
.
update_idletasks
()
self
.
update_idletasks
()
#needs to be done here so that the winfo_reqwidth is valid
#needs to be done here so that the winfo_reqwidth is valid
...
...
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