summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-02-24 23:19:07 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-02-24 23:19:07 (GMT)
commit366e6ae6e8ab06fe33e52b571feb1a49ce65d182 (patch)
tree8fb5adb320979cccfe5e79a435e7137eb740c33e
parent9c93fe829bc6f85589b261a108073f914f1f9981 (diff)
downloadcpython-366e6ae6e8ab06fe33e52b571feb1a49ce65d182.zip
cpython-366e6ae6e8ab06fe33e52b571feb1a49ce65d182.tar.gz
cpython-366e6ae6e8ab06fe33e52b571feb1a49ce65d182.tar.bz2
Backport of 1.15 and 1.16:
- Don't append quit menu when on OSX, it is special and automatic there. - Changes by Donovan Preston (and a few minor ones by me) to make IDE run under MachoPython. Mainly making sure we don't call routines that don't exist and representing pathnames in a os.separator-neutral format. These shouldn't interfere too much with Just's work on the next generation IDE, I hope.
-rw-r--r--Mac/Tools/IDE/PythonIDEMain.py40
1 files changed, 28 insertions, 12 deletions
diff --git a/Mac/Tools/IDE/PythonIDEMain.py b/Mac/Tools/IDE/PythonIDEMain.py
index 680bd7b..22ad4df 100644
--- a/Mac/Tools/IDE/PythonIDEMain.py
+++ b/Mac/Tools/IDE/PythonIDEMain.py
@@ -7,6 +7,19 @@ import Wapplication
import W
import os
import macfs
+import MacOS
+
+if MacOS.runtimemodel == 'macho':
+ ELIPSES = '...'
+else:
+ ELIPSES = '\xc9'
+
+def runningOnOSX():
+ from gestalt import gestalt
+ gestaltMenuMgrAquaLayoutBit = 1 # menus have the Aqua 1.0 layout
+ gestaltMenuMgrAquaLayoutMask = (1L << gestaltMenuMgrAquaLayoutBit)
+ value = gestalt("menu") & gestaltMenuMgrAquaLayoutMask
+ return not not value
class PythonIDE(Wapplication.Application):
@@ -50,15 +63,18 @@ class PythonIDE(Wapplication.Application):
def makeusermenus(self):
m = Wapplication.Menu(self.menubar, "File")
newitem = FrameWork.MenuItem(m, "New", "N", 'new')
- openitem = FrameWork.MenuItem(m, "Open\xc9", "O", 'open')
+ openitem = FrameWork.MenuItem(m, "Open"+ELIPSES, "O", 'open')
FrameWork.Separator(m)
closeitem = FrameWork.MenuItem(m, "Close", "W", 'close')
saveitem = FrameWork.MenuItem(m, "Save", "S", 'save')
- saveasitem = FrameWork.MenuItem(m, "Save as\xc9", None, 'save_as')
- FrameWork.Separator(m)
- saveasappletitem = FrameWork.MenuItem(m, "Save as Applet\xc9", None, 'save_as_applet')
+ saveasitem = FrameWork.MenuItem(m, "Save as"+ELIPSES, None, 'save_as')
FrameWork.Separator(m)
- quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit')
+ saveasappletitem = FrameWork.MenuItem(m, "Save as Applet"+ELIPSES, None, 'save_as_applet')
+ if not runningOnOSX():
+ # On OSX there's a special "magic" quit menu, so we shouldn't add
+ # it to the File menu.
+ FrameWork.Separator(m)
+ quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit')
m = Wapplication.Menu(self.menubar, "Edit")
undoitem = FrameWork.MenuItem(m, "Undo", 'Z', "undo")
@@ -71,7 +87,7 @@ class PythonIDE(Wapplication.Application):
selallitem = FrameWork.MenuItem(m, "Select all", "A", "selectall")
sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline")
FrameWork.Separator(m)
- finditem = FrameWork.MenuItem(m, "Find\xc9", "F", "find")
+ finditem = FrameWork.MenuItem(m, "Find"+ELIPSES, "F", "find")
findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext")
enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring")
replaceitem = FrameWork.MenuItem(m, "Replace", None, "replace")
@@ -84,12 +100,12 @@ class PythonIDE(Wapplication.Application):
runitem = FrameWork.MenuItem(m, "Run window", "R", 'run')
runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection')
FrameWork.Separator(m)
- moditem = FrameWork.MenuItem(m, "Module browser\xc9", "M", self.domenu_modulebrowser)
+ moditem = FrameWork.MenuItem(m, "Module browser"+ELIPSES, "M", self.domenu_modulebrowser)
FrameWork.Separator(m)
mm = FrameWork.SubMenu(m, "Preferences")
- FrameWork.MenuItem(mm, "Set Scripts folder\xc9", None, self.do_setscriptsfolder)
- FrameWork.MenuItem(mm, "Editor default settings\xc9", None, self.do_editorprefs)
- FrameWork.MenuItem(mm, "Set default window font\xc9", None, self.do_setwindowfont)
+ FrameWork.MenuItem(mm, "Set Scripts folder"+ELIPSES, None, self.do_setscriptsfolder)
+ FrameWork.MenuItem(mm, "Editor default settings"+ELIPSES, None, self.do_editorprefs)
+ FrameWork.MenuItem(mm, "Set default window font"+ELIPSES, None, self.do_setwindowfont)
self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows')
self.makeopenwindowsmenu()
@@ -110,7 +126,7 @@ class PythonIDE(Wapplication.Application):
path = os.path.join(os.getcwd(), "Scripts")
if not os.path.exists(path):
os.mkdir(path)
- f = open(os.path.join(path, "Place your scripts here\xc9"), "w")
+ f = open(os.path.join(path, "Place your scripts here"+ELIPSES), "w")
f.close()
fss = macfs.FSSpec(path)
self.scriptsfolder = fss.NewAlias()
@@ -159,7 +175,7 @@ class PythonIDE(Wapplication.Application):
W.Message("Can't open file of type '%s'." % ftype)
def getabouttext(self):
- return "About Python IDE\xc9"
+ return "About Python IDE"+ELIPSES
def do_about(self, id, item, window, event):
Splash.about()