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
9b0bcc1f
Commit
9b0bcc1f
authored
Jul 09, 2007
by
Ronald Oussoren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch 1693258: Fix for duplicate "preferences" menu-OS X
parent
e3b185f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
Lib/idlelib/macosxSupport.py
Lib/idlelib/macosxSupport.py
+31
-18
No files found.
Lib/idlelib/macosxSupport.py
View file @
9b0bcc1f
...
...
@@ -3,6 +3,7 @@ A number of function that enhance IDLE on MacOSX when it used as a normal
GUI application (as opposed to an X11 application).
"""
import
sys
import
Tkinter
def
runningAsOSXApp
():
""" Returns True iff running from the IDLE.app bundle on OSX """
...
...
@@ -23,7 +24,11 @@ def addOpenEventSupport(root, flist):
root
.
createcommand
(
"::tk::mac::OpenDocument"
,
doOpenFile
)
def
hideTkConsole
(
root
):
root
.
tk
.
call
(
'console'
,
'hide'
)
try
:
root
.
tk
.
call
(
'console'
,
'hide'
)
except
Tkinter
.
TclError
:
# Some versions of the Tk framework don't have a console object
pass
def
overrideRootMenu
(
root
,
flist
):
"""
...
...
@@ -75,32 +80,40 @@ def overrideRootMenu(root, flist):
import
configDialog
configDialog
.
ConfigDialog
(
root
,
'Settings'
)
root
.
bind
(
'<<about-idle>>'
,
about_dialog
)
root
.
bind
(
'<<open-config-dialog>>'
,
config_dialog
)
if
flist
:
root
.
bind
(
'<<close-all-windows>>'
,
flist
.
close_all_callback
)
for
mname
,
entrylist
in
Bindings
.
menudefs
:
menu
=
menudict
.
get
(
mname
)
if
not
menu
:
continue
for
entry
in
entrylist
:
if
not
entry
:
menu
.
add_separator
()
###check if Tk version >= 8.4.14; if so, use hard-coded showprefs binding
tkversion
=
root
.
tk
.
eval
(
'info patchlevel'
)
if
tkversion
>=
'8.4.14'
:
Bindings
.
menudefs
[
0
]
=
(
'application'
,
[
(
'About IDLE'
,
'<<about-idle>>'
),
None
,
])
root
.
createcommand
(
'::tk::mac::ShowPreferences'
,
config_dialog
)
else
:
for
mname
,
entrylist
in
Bindings
.
menudefs
:
menu
=
menudict
.
get
(
mname
)
if
not
menu
:
continue
else
:
label
,
eventname
=
entry
underline
,
label
=
prepstr
(
label
)
accelerator
=
get_accelerator
(
Bindings
.
default_keydefs
,
for
entry
in
entrylist
:
if
not
entry
:
menu
.
add_separator
()
else
:
label
,
eventname
=
entry
underline
,
label
=
prepstr
(
label
)
accelerator
=
get_accelerator
(
Bindings
.
default_keydefs
,
eventname
)
def
command
(
text
=
root
,
eventname
=
eventname
):
text
.
event_generate
(
eventname
)
menu
.
add_command
(
label
=
label
,
underline
=
underline
,
def
command
(
text
=
root
,
eventname
=
eventname
):
text
.
event_generate
(
eventname
)
menu
.
add_command
(
label
=
label
,
underline
=
underline
,
command
=
command
,
accelerator
=
accelerator
)
def
setupApp
(
root
,
flist
):
"""
Perform setup for the OSX application bundle.
...
...
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