summaryrefslogtreecommitdiff
path: root/Mac
diff options
context:
space:
mode:
Diffstat (limited to 'Mac')
-rw-r--r--Mac/BuildScript/README.txt (renamed from Mac/OSX/BuildScript/README.txt)0
-rwxr-xr-xMac/BuildScript/build-installer.py (renamed from Mac/OSX/BuildScript/build-installer.py)30
-rw-r--r--Mac/BuildScript/ncurses-5.5.patch (renamed from Mac/OSX/BuildScript/ncurses-5.5.patch)0
-rw-r--r--Mac/BuildScript/resources/ReadMe.txt (renamed from Mac/OSX/BuildScript/resources/ReadMe.txt)0
-rw-r--r--Mac/BuildScript/resources/Welcome.rtf (renamed from Mac/OSX/BuildScript/resources/Welcome.rtf)0
-rw-r--r--Mac/BuildScript/resources/background.jpg (renamed from Mac/OSX/BuildScript/resources/background.jpg)bin45421 -> 45421 bytes
-rwxr-xr-xMac/BuildScript/scripts/postflight.documentation (renamed from Mac/OSX/BuildScript/scripts/postflight.documentation)0
-rwxr-xr-xMac/BuildScript/scripts/postflight.framework (renamed from Mac/OSX/BuildScript/scripts/postflight.framework)0
-rwxr-xr-xMac/BuildScript/scripts/postflight.patch-profile (renamed from Mac/OSX/BuildScript/scripts/postflight.patch-profile)0
-rw-r--r--Mac/Demo/index.html4
-rw-r--r--Mac/Demo/textedit.html3
-rw-r--r--Mac/Demo/waste.html72
-rw-r--r--Mac/Demo/waste/htmled.py830
-rw-r--r--Mac/Demo/waste/swed.py634
-rw-r--r--Mac/Demo/waste/wed.py426
-rw-r--r--Mac/Extras.ReadMe.txt (renamed from Mac/OSX/Extras.ReadMe.txt)0
-rw-r--r--Mac/Extras.install.py (renamed from Mac/OSX/Extras.install.py)0
-rw-r--r--Mac/IDLE/Info.plist.in (renamed from Mac/OSX/IDLE/Info.plist)6
-rw-r--r--Mac/IDLE/Makefile.in (renamed from Mac/OSX/IDLE/Makefile.in)19
-rw-r--r--Mac/IDLE/config-extensions.def88
-rw-r--r--Mac/IDLE/config-main.def79
-rw-r--r--Mac/IDLE/idlemain.py (renamed from Mac/OSX/IDLE/idlemain.py)0
-rw-r--r--Mac/Icons/Disk Image.icns (renamed from Mac/OSX/Icons/Disk Image.icns)bin50703 -> 50703 bytes
-rw-r--r--Mac/Icons/IDLE.icns (renamed from Mac/OSX/Icons/IDLE.icns)bin53456 -> 53456 bytes
-rw-r--r--Mac/Icons/Python Folder.icns (renamed from Mac/OSX/Icons/Python Folder.icns)bin133608 -> 133608 bytes
-rw-r--r--Mac/Icons/PythonCompiled.icns (renamed from Mac/OSX/Icons/PythonCompiled.icns)bin60777 -> 60777 bytes
-rw-r--r--Mac/Icons/PythonLauncher.icns (renamed from Mac/OSX/Icons/PythonLauncher.icns)bin42658 -> 42658 bytes
-rw-r--r--Mac/Icons/PythonSource.icns (renamed from Mac/OSX/Icons/PythonSource.icns)bin54522 -> 54522 bytes
-rw-r--r--Mac/Icons/ReadMe.txt (renamed from Mac/OSX/Icons/ReadMe.txt)0
-rw-r--r--Mac/Makefile.in (renamed from Mac/OSX/Makefile.in)82
-rw-r--r--Mac/Modules/waste/wastemodule.c2596
-rw-r--r--Mac/Modules/waste/wastescan.py152
-rw-r--r--Mac/Modules/waste/wastesupport.py444
-rw-r--r--Mac/OSX/PythonLauncher/PreferenceWindow.nib/classes.nib26
-rw-r--r--Mac/OSX/PythonLauncher/PreferenceWindow.nib/info.nib16
-rw-r--r--Mac/OSX/PythonLauncher/PreferenceWindow.nib/objects.nibbin5882 -> 0 bytes
-rw-r--r--Mac/PythonLauncher/English.lproj/Credits.rtf (renamed from Mac/OSX/PythonLauncher/English.lproj/Credits.rtf)0
-rw-r--r--Mac/PythonLauncher/English.lproj/MainMenu.nib/classes.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/classes.nib)0
-rw-r--r--Mac/PythonLauncher/English.lproj/MainMenu.nib/info.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/info.nib)0
-rw-r--r--Mac/PythonLauncher/English.lproj/MainMenu.nib/objects.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/objects.nib)bin5016 -> 5016 bytes
-rw-r--r--Mac/PythonLauncher/English.lproj/MyDocument.nib/classes.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib)0
-rw-r--r--Mac/PythonLauncher/English.lproj/MyDocument.nib/info.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib)0
-rw-r--r--Mac/PythonLauncher/English.lproj/MyDocument.nib/objects.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/objects.nib)bin4845 -> 4845 bytes
-rw-r--r--Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib)0
-rw-r--r--Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib)0
-rw-r--r--Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib (renamed from Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib)bin5882 -> 5882 bytes
-rwxr-xr-xMac/PythonLauncher/FileSettings.h (renamed from Mac/OSX/PythonLauncher/FileSettings.h)0
-rwxr-xr-xMac/PythonLauncher/FileSettings.m (renamed from Mac/OSX/PythonLauncher/FileSettings.m)0
-rw-r--r--Mac/PythonLauncher/Info.plist.in (renamed from Mac/OSX/PythonLauncher/Info.plist)6
-rw-r--r--Mac/PythonLauncher/Makefile.in (renamed from Mac/OSX/PythonLauncher/Makefile.in)13
-rw-r--r--Mac/PythonLauncher/MyAppDelegate.h (renamed from Mac/OSX/PythonLauncher/MyAppDelegate.h)0
-rw-r--r--Mac/PythonLauncher/MyAppDelegate.m (renamed from Mac/OSX/PythonLauncher/MyAppDelegate.m)0
-rwxr-xr-xMac/PythonLauncher/MyDocument.h (renamed from Mac/OSX/PythonLauncher/MyDocument.h)0
-rwxr-xr-xMac/PythonLauncher/MyDocument.m (renamed from Mac/OSX/PythonLauncher/MyDocument.m)0
-rw-r--r--Mac/PythonLauncher/PreferencesWindowController.h (renamed from Mac/OSX/PythonLauncher/PreferencesWindowController.h)0
-rw-r--r--Mac/PythonLauncher/PreferencesWindowController.m (renamed from Mac/OSX/PythonLauncher/PreferencesWindowController.m)0
-rw-r--r--Mac/PythonLauncher/doscript.h (renamed from Mac/OSX/PythonLauncher/doscript.h)0
-rw-r--r--Mac/PythonLauncher/doscript.m (renamed from Mac/OSX/PythonLauncher/doscript.m)0
-rw-r--r--Mac/PythonLauncher/factorySettings.plist (renamed from Mac/OSX/PythonLauncher/factorySettings.plist)0
-rwxr-xr-xMac/PythonLauncher/main.m (renamed from Mac/OSX/PythonLauncher/main.m)0
-rw-r--r--Mac/README (renamed from Mac/OSX/README)0
-rw-r--r--Mac/Resources/app/Info.plist (renamed from Mac/OSXResources/app/Info.plist)0
-rw-r--r--Mac/Resources/app/PkgInfo (renamed from Mac/OSXResources/app/PkgInfo)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/PackageManager.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/PackageManager.gif)bin6087 -> 6087 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/community.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/community.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/doc/index.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/doc/index.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/finder.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/finder.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/gui.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/IDE.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/IDE.gif)bin10249 -> 10249 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif)bin15578 -> 15578 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/hello_world.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/hello_world.gif)bin15681 -> 15681 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/index.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/index.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif)bin50595 -> 50595 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif)bin25978 -> 25978 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif)bin20606 -> 20606 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif)bin21808 -> 21808 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/output_window.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/output_window.gif)bin37660 -> 37660 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif)bin26559 -> 26559 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif)bin14134 -> 14134 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif)bin12850 -> 12850 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/index.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/intro.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/intro.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/packman.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/packman.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/python.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/python.gif)bin6389 -> 6389 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/pythonsmall.gif (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/pythonsmall.gif)bin138 -> 138 bytes
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/scripting.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/Documentation/shell.html (renamed from Mac/OSXResources/app/Resources/English.lproj/Documentation/shell.html)0
-rw-r--r--Mac/Resources/app/Resources/English.lproj/InfoPlist.strings (renamed from Mac/OSXResources/app/Resources/English.lproj/InfoPlist.strings)bin656 -> 656 bytes
-rw-r--r--Mac/Resources/app/Resources/PythonApplet.icns (renamed from Mac/OSXResources/app/Resources/PythonApplet.icns)bin63136 -> 63136 bytes
-rw-r--r--Mac/Resources/app/Resources/PythonInterpreter.icns (renamed from Mac/OSXResources/app/Resources/PythonInterpreter.icns)bin42658 -> 42658 bytes
-rw-r--r--Mac/Resources/framework/English.lproj/InfoPlist.strings (renamed from Mac/OSXResources/framework/English.lproj/InfoPlist.strings)bin358 -> 358 bytes
-rw-r--r--Mac/Resources/framework/Info.plist (renamed from Mac/OSXResources/framework/Info.plist)0
-rw-r--r--Mac/Resources/framework/version.plist (renamed from Mac/OSXResources/framework/version.plist)0
-rw-r--r--Mac/Resources/iconsrc/IDE.psd (renamed from Mac/OSXResources/iconsrc/IDE.psd)bin83876 -> 83876 bytes
-rw-r--r--Mac/Resources/iconsrc/PackageManager.psd (renamed from Mac/OSXResources/iconsrc/PackageManager.psd)bin71056 -> 71056 bytes
-rw-r--r--Mac/Resources/iconsrc/PythonApplet.psd (renamed from Mac/OSXResources/iconsrc/PythonApplet.psd)bin41543 -> 41543 bytes
-rwxr-xr-xMac/Resources/iconsrc/PythonCompiled.psd (renamed from Mac/OSXResources/iconsrc/PythonCompiled.psd)bin76118 -> 76118 bytes
-rwxr-xr-xMac/Resources/iconsrc/PythonIcon.psd (renamed from Mac/OSXResources/iconsrc/PythonIcon.psd)bin67236 -> 67236 bytes
-rwxr-xr-xMac/Resources/iconsrc/PythonSource.psd (renamed from Mac/OSXResources/iconsrc/PythonSource.psd)bin62075 -> 62075 bytes
-rw-r--r--Mac/Resources/iconsrc/PythonWSource.psd (renamed from Mac/OSXResources/iconsrc/PythonWSource.psd)bin64185 -> 64185 bytes
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py (renamed from Mac/OSX/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py)0
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Miscellaneous_Standards.py (renamed from Mac/OSX/Doc/HelpIndexingTool/Miscellaneous_Standards.py)0
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Required_Suite.py (renamed from Mac/OSX/Doc/HelpIndexingTool/Required_Suite.py)0
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/Standard_Suite.py (renamed from Mac/OSX/Doc/HelpIndexingTool/Standard_Suite.py)0
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/__init__.py (renamed from Mac/OSX/Doc/HelpIndexingTool/__init__.py)0
-rw-r--r--Mac/Tools/Doc/HelpIndexingTool/odds_and_ends.py (renamed from Mac/OSX/Doc/HelpIndexingTool/odds_and_ends.py)0
-rw-r--r--Mac/Tools/Doc/README (renamed from Mac/OSX/Doc/README)0
-rw-r--r--Mac/Tools/Doc/setup.py (renamed from Mac/OSX/Doc/setup.py)0
-rw-r--r--Mac/Tools/fixapplepython23.py (renamed from Mac/OSX/fixapplepython23.py)1
-rw-r--r--Mac/Tools/pythonw.c (renamed from Mac/OSX/Tools/pythonw.c)0
-rw-r--r--Mac/scripts/BuildApplet.py12
111 files changed, 276 insertions, 5263 deletions
diff --git a/Mac/OSX/BuildScript/README.txt b/Mac/BuildScript/README.txt
index c556de8329..c556de8329 100644
--- a/Mac/OSX/BuildScript/README.txt
+++ b/Mac/BuildScript/README.txt
diff --git a/Mac/OSX/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index b24f5dcee0..05afe98bab 100755
--- a/Mac/OSX/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -67,13 +67,12 @@ DEPSRC=os.path.expanduser('~/Universal/other-sources')
SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk"
#SDKPATH="/"
-# Source directory (asume we're in Mac/OSX/Dist)
+# Source directory (asume we're in Mac/BuildScript)
SRCDIR=os.path.dirname(
os.path.dirname(
os.path.dirname(
- os.path.dirname(
- os.path.abspath(__file__
- )))))
+ os.path.abspath(__file__
+ ))))
USAGE=textwrap.dedent("""\
Usage: build_python [options]
@@ -179,9 +178,11 @@ PKG_RECIPES=[
long_name="GUI Applications",
source="/Applications/MacPython %(VER)s",
readme="""\
- This package installs Python.framework, that is the python
- interpreter and the standard library. This also includes Python
- wrappers for lots of Mac OS X API's.
+ This package installs IDLE (an interactive Python IDLE),
+ Python Launcher and Build Applet (create application bundles
+ from python scripts).
+
+ It also installs a number of examples and demos.
""",
required=False,
),
@@ -227,9 +228,22 @@ PKG_RECIPES=[
source="/empty-dir",
required=False,
),
+ dict(
+ name="PythonSystemFixes",
+ long_name="Fix system Python",
+ readme="""\
+ This package updates the system python installation on
+ Mac OS X 10.3 to ensure that you can build new python extensions
+ using that copy of python after installing this version of
+ python.
+ """
+ postflight="../Tools/fixapplepython23.py",
+ topdir="/Library/Frameworks/Python.framework",
+ source="/empty-dir",
+ required=False,
+ )
]
-
def fatal(msg):
"""
A fatal error, bail out.
diff --git a/Mac/OSX/BuildScript/ncurses-5.5.patch b/Mac/BuildScript/ncurses-5.5.patch
index 0eab3d3666..0eab3d3666 100644
--- a/Mac/OSX/BuildScript/ncurses-5.5.patch
+++ b/Mac/BuildScript/ncurses-5.5.patch
diff --git a/Mac/OSX/BuildScript/resources/ReadMe.txt b/Mac/BuildScript/resources/ReadMe.txt
index 1a6e63764f..1a6e63764f 100644
--- a/Mac/OSX/BuildScript/resources/ReadMe.txt
+++ b/Mac/BuildScript/resources/ReadMe.txt
diff --git a/Mac/OSX/BuildScript/resources/Welcome.rtf b/Mac/BuildScript/resources/Welcome.rtf
index cb65f09409..cb65f09409 100644
--- a/Mac/OSX/BuildScript/resources/Welcome.rtf
+++ b/Mac/BuildScript/resources/Welcome.rtf
diff --git a/Mac/OSX/BuildScript/resources/background.jpg b/Mac/BuildScript/resources/background.jpg
index b3c76406cf..b3c76406cf 100644
--- a/Mac/OSX/BuildScript/resources/background.jpg
+++ b/Mac/BuildScript/resources/background.jpg
Binary files differ
diff --git a/Mac/OSX/BuildScript/scripts/postflight.documentation b/Mac/BuildScript/scripts/postflight.documentation
index 85d400fe12..85d400fe12 100755
--- a/Mac/OSX/BuildScript/scripts/postflight.documentation
+++ b/Mac/BuildScript/scripts/postflight.documentation
diff --git a/Mac/OSX/BuildScript/scripts/postflight.framework b/Mac/BuildScript/scripts/postflight.framework
index 532e745179..532e745179 100755
--- a/Mac/OSX/BuildScript/scripts/postflight.framework
+++ b/Mac/BuildScript/scripts/postflight.framework
diff --git a/Mac/OSX/BuildScript/scripts/postflight.patch-profile b/Mac/BuildScript/scripts/postflight.patch-profile
index 48bf701587..48bf701587 100755
--- a/Mac/OSX/BuildScript/scripts/postflight.patch-profile
+++ b/Mac/BuildScript/scripts/postflight.patch-profile
diff --git a/Mac/Demo/index.html b/Mac/Demo/index.html
index 6b5806b6c7..443cce9cf5 100644
--- a/Mac/Demo/index.html
+++ b/Mac/Demo/index.html
@@ -74,10 +74,6 @@ how to use <code>FrameWork</code> application framework and the
<code>TextEdit</code> toolbox to build a text editor.
<LI>
-<A HREF="waste.html">Using WASTE</A> expands on this editor by using
-WASTE, an extended TextEdit replacement.
-
-<LI>
<A HREF="plugins.html">Creating a C extension module on the Macintosh</A>
is meant for the hardcore programmer, and shows how to create an
extension module in C. It also handles using Modulator to create the
diff --git a/Mac/Demo/textedit.html b/Mac/Demo/textedit.html
index 606c668990..fcd8c973df 100644
--- a/Mac/Demo/textedit.html
+++ b/Mac/Demo/textedit.html
@@ -80,8 +80,7 @@ A modeless dialog window initialized from a DLOG resource. See the
Let us have a look at <A HREF="textedit/ped.py">ped.py</A> (in the Demo:textedit folder), the Pathetic
EDitor. It has multiple windows, cut/copy/paste and keyboard input, but that is about all. It looks
-as if you can resize the window but it does not work. Still, it serves as an example. We will improve
-on ped later, in a <A HREF="waste.html">waste-based example</A>. <p>
+as if you can resize the window but it does not work. Still, it serves as an example.
Ped creates two classes, <code>TEWindow</code> and <code>Ped</code>. Let us start with the latter one,
which is a subclass of <code>FrameWork.Application</code> and our main application. The init function
diff --git a/Mac/Demo/waste.html b/Mac/Demo/waste.html
deleted file mode 100644
index 96b13bfde5..0000000000
--- a/Mac/Demo/waste.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<HTML><HEAD><TITLE>Using WASTE</TITLE></HEAD>
-<BODY>
-<H1>Using WASTE</H1>
-<HR>
-
-WASTE is an almost-compatible TextEdit replacement which overcomes
-some of the limitations of it (like the 32K limit) and provides some extensions
-(drag and drop, images, undo support). Moreover, it has a much cleaner interface
-and is therefore easier integrated in Python. <p>
-
-WASTE is written by Marco Piovanelli, <A HREF="mailto:piovanel@kagi.com">&lt;piovanel@kagi.com&gt;</A>,
-and copyrighted by him. You can always obtain the latest version (for use in C
-or Pascal programs) and the documentation from
-<A HREF="http://www.boingo.com/waste/">&lt;http://www.boingo.com/waste/&gt;</A>.
-
-We explain the useage of waste here by showing how to modify the TextEdit based
-<A HREF="textedit/ped.py">ped.py</A> of the
-<A HREF="textedit.html">previous example</A> into the waste-based <A HREF="waste/wed.py">wed.py</A>,
-so you should have both sources handy. <p>
-
-Functionally, <code>wed.py</code> provides three new things: resizable windows, a horizontal
-scroll bar and undo. <p>
-
-Let us look at the code, first at the application class <code>Wed</code>. The only real change is that
-we now handle <code>undo</code>. Aside from enabling it in the creation routine and the addition of
-a callback routine there is a bit of new code in <code>updatemenubar</code>: Waste not only handles
-the full details of implementing undo, it will also tell us what the next undo operation will undo
-(or redo). We use this to our advantage by changing the undo menu label to tell the user. <p>
-
-The <code>WasteWindow</code> has seen a bit more change. Initialization of the waste data structure is
-a bit different, in that we can specify some options at creation time. Also, waste has no <code>SetText</code>
-method but a <code>UseText</code> which expects a handle as parameter. We have to be <EM>very</EM> careful
-that we keep this handle around, because Python will happily free the handle if we have no more references
-to it (and I doubt that Waste would like this:-). A final difference in <code>open</code>
-is that we use a large number for the destination rectangle width, because we will use a horizontal scroll
-bar. <p>
-
-The <code>idle</code> method is a bit more involved, since we also call <code>WEAdjustCursor</code> to
-provide the correct cursor based on mouse-position. Users like this. <p>
-
-<code>Getscrollbarvalues</code> is simpler than its' TextEdit counterpart because Waste correctly
-updates the destination rectangle when the document changes. Also note that waste uses accessor functions
-to get at internal values, as opposed to direct struct access for TextEdit. <p>
-
-<code>Scrollbar_callback</code> on the other hand is more elaborate (but also provides more functionality).
-It also handles horizontal scrolls (scrolling one-tenth and half a screenful with the buttons). This
-function is also "multi-font-ready" in that scrolling one line will do the expected thing in case of multiple
-fonts. We will implement a multi-font editor later. A minor annoyance of Waste is that is does not provide
-a pinned scroll, so at the end of our callback routine we have to check that we have not scrolled past the
-beginning or end of the document, and adjust when needed. <p>
-
-<code>do_update</code> is also changed, because Waste is completely region-based (as opposed to rect-based).
-Hence, we erase regions here and we can also return immedeately if there is nothing to update. <p>
-
-<code>Do_postresize</code> is new: because Waste uses accessor functions we can now modify the viewRect from
-Python, which is impossible in the Python TextEdit interface, and hence we can implement resize. The
-<code>do_key</code> and <code>do_contentclick</code> methods have also seen minor changes, because the
-corresponding waste routines need a bit more information than their TextEdit counterparts. The Cut/copy/paste
-code is simplified, because Waste uses the normal desktop scrap. <p>
-
-Implementing undo is a wonder of simplicity: Waste handles all the details for us. Also, the new
-<code>can_paste</code> method (which controls greying out of the paste menu entry) is an improvement
-over what <code>ped</code> did: in ped it was possible that paste was enabled but that the data on the
-scrap was incompatible with TextEdit. No more such problems here. <p>
-
-That is all for now. There is an undocumented extended version of wed, <a href="waste/swed.py">swed.py</a>,
-which supports multiple fonts, sizes and faces, and uses Waste's tab-calculation to do tab characters "right".
-There is also an even more elaborate example, <a href="waste/htmled.py">htmled.py</a> which extends swed with
-the ability to import html files, showing the use of color and how to use embedded object (rulers, in this case).
-These two programs have not been documented yet, though, so you will have to look at them without guidance. <p>
-<hr>
-Back to the <A HREF="index.html">index</A> to pick another example.
diff --git a/Mac/Demo/waste/htmled.py b/Mac/Demo/waste/htmled.py
deleted file mode 100644
index d8cea1b453..0000000000
--- a/Mac/Demo/waste/htmled.py
+++ /dev/null
@@ -1,830 +0,0 @@
-# A minimal text editor.
-#
-# To be done:
-# - Functionality: find, etc.
-
-from Carbon.Menu import DrawMenuBar
-from FrameWork import *
-from Carbon import Win
-from Carbon import Qd
-from Carbon import Res
-from Carbon import Fm
-import waste
-import WASTEconst
-from Carbon import Scrap
-import os
-import EasyDialogs
-import macfs
-import string
-import htmllib
-
-WATCH = Qd.GetCursor(4).data
-
-LEFTMARGIN=0
-
-UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
- None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"]
-
-# Style and size menu. Note that style order is important (tied to bit values)
-STYLES = [
- ("Bold", "B"), ("Italic", "I"), ("Underline", "U"), ("Outline", "O"),
- ("Shadow", ""), ("Condensed", ""), ("Extended", "")
- ]
-SIZES = [ 9, 10, 12, 14, 18, 24]
-
-# Sizes for HTML tag types
-HTML_SIZE={
- 'h1': 18,
- 'h2': 14
-}
-
-BIGREGION=Qd.NewRgn()
-Qd.SetRectRgn(BIGREGION, -16000, -16000, 16000, 16000)
-
-class WasteWindow(ScrolledWindow):
- def open(self, path, name, data):
- self.path = path
- self.name = name
- r = windowbounds(400, 400)
- w = Win.NewWindow(r, name, 1, 0, -1, 1, 0)
- self.wid = w
- vr = LEFTMARGIN, 0, r[2]-r[0]-15, r[3]-r[1]-15
- dr = (0, 0, vr[2], 0)
- Qd.SetPort(w)
- Qd.TextFont(4)
- Qd.TextSize(9)
- flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite | \
- WASTEconst.weDoMonoStyled | WASTEconst.weDoUndo
- self.ted = waste.WENew(dr, vr, flags)
- self.ted.WEInstallTabHooks()
- style, soup = self.getstylesoup(self.path)
- self.ted.WEInsert(data, style, soup)
- self.ted.WESetSelection(0,0)
- self.ted.WECalText()
- self.ted.WEResetModCount()
- w.DrawGrowIcon()
- self.scrollbars()
- self.do_postopen()
- self.do_activate(1, None)
-
- def getstylesoup(self, pathname):
- if not pathname:
- return None, None
- oldrf = Res.CurResFile()
- try:
- rf = Res.FSpOpenResFile(self.path, 1)
- except Res.Error:
- return None, None
- try:
- hstyle = Res.Get1Resource('styl', 128)
- hstyle.DetachResource()
- except Res.Error:
- hstyle = None
- try:
- hsoup = Res.Get1Resource('SOUP', 128)
- hsoup.DetachResource()
- except Res.Error:
- hsoup = None
- Res.CloseResFile(rf)
- Res.UseResFile(oldrf)
- return hstyle, hsoup
-
- def do_idle(self, event):
- (what, message, when, where, modifiers) = event
- Qd.SetPort(self.wid)
- self.ted.WEIdle()
- if self.ted.WEAdjustCursor(where, BIGREGION):
- return
- Qd.SetCursor(Qd.GetQDGlobalsArrow())
-
- def getscrollbarvalues(self):
- dr = self.ted.WEGetDestRect()
- vr = self.ted.WEGetViewRect()
- vx = self.scalebarvalue(dr[0], dr[2], vr[0], vr[2])
- vy = self.scalebarvalue(dr[1], dr[3], vr[1], vr[3])
- return vx, vy
-
- def scrollbar_callback(self, which, what, value):
- if which == 'y':
- #
- # "line" size is minimum of top and bottom line size
- #
- topline_off,dummy = self.ted.WEGetOffset((1,1))
- topline_num = self.ted.WEOffsetToLine(topline_off)
- toplineheight = self.ted.WEGetHeight(topline_num, topline_num+1)
-
- botlinepos = self.ted.WEGetViewRect()[3]
- botline_off, dummy = self.ted.WEGetOffset((1, botlinepos-1))
- botline_num = self.ted.WEOffsetToLine(botline_off)
- botlineheight = self.ted.WEGetHeight(botline_num, botline_num+1)
-
- if botlineheight == 0:
- botlineheight = self.ted.WEGetHeight(botline_num-1, botline_num)
- if botlineheight < toplineheight:
- lineheight = botlineheight
- else:
- lineheight = toplineheight
- if lineheight <= 0:
- lineheight = 1
- #
- # Now do the command.
- #
- if what == 'set':
- height = self.ted.WEGetHeight(0, 0x3fffffff)
- cur = self.getscrollbarvalues()[1]
- delta = (cur-value)*height/32767
- if what == '-':
- delta = lineheight
- elif what == '--':
- delta = (self.ted.WEGetViewRect()[3]-lineheight)
- if delta <= 0:
- delta = lineheight
- elif what == '+':
- delta = -lineheight
- elif what == '++':
- delta = -(self.ted.WEGetViewRect()[3]-lineheight)
- if delta >= 0:
- delta = -lineheight
- self.ted.WEScroll(0, delta)
- else:
- if what == 'set':
- return # XXXX
- vr = self.ted.WEGetViewRect()
- winwidth = vr[2]-vr[0]
- if what == '-':
- delta = winwidth/10
- elif what == '--':
- delta = winwidth/2
- elif what == '+':
- delta = -winwidth/10
- elif what == '++':
- delta = -winwidth/2
- self.ted.WEScroll(delta, 0)
- # Pin the scroll
- l, t, r, b = self.ted.WEGetDestRect()
- vl, vt, vr, vb = self.ted.WEGetViewRect()
- if t > 0 or l > 0:
- dx = dy = 0
- if t > 0: dy = -t
- if l > 0: dx = -l
- self.ted.WEScroll(dx, dy)
- elif b < vb:
- self.ted.WEScroll(0, vb-b)
-
-
- def do_activate(self, onoff, evt):
- Qd.SetPort(self.wid)
- ScrolledWindow.do_activate(self, onoff, evt)
- if onoff:
- self.ted.WEActivate()
- self.parent.active = self
- self.parent.updatemenubar()
- else:
- self.ted.WEDeactivate()
-
- def do_update(self, wid, event):
- region = wid.GetWindowPort().visRgn
- if Qd.EmptyRgn(region):
- return
- Qd.EraseRgn(region)
- self.ted.WEUpdate(region)
- self.updatescrollbars()
-
- def do_postresize(self, width, height, window):
- l, t, r, b = self.ted.WEGetViewRect()
- vr = (l, t, l+width-15, t+height-15)
- self.ted.WESetViewRect(vr)
- self.wid.InvalWindowRect(vr)
- ScrolledWindow.do_postresize(self, width, height, window)
-
- def do_contentclick(self, local, modifiers, evt):
- (what, message, when, where, modifiers) = evt
- self.ted.WEClick(local, modifiers, when)
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def do_char(self, ch, event):
- self.ted.WESelView()
- (what, message, when, where, modifiers) = event
- self.ted.WEKey(ord(ch), modifiers)
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def close(self):
- if self.ted.WEGetModCount():
- save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?'%self.name, 1)
- if save > 0:
- self.menu_save()
- elif save < 0:
- return
- if self.parent.active == self:
- self.parent.active = None
- self.parent.updatemenubar()
- del self.ted
- self.do_postclose()
-
- def menu_save(self):
- if not self.path:
- self.menu_save_as()
- return # Will call us recursively
- #
- # First save data
- #
- dhandle = self.ted.WEGetText()
- data = dhandle.data
- fp = open(self.path, 'wb') # NOTE: wb, because data has CR for end-of-line
- fp.write(data)
- if data[-1] <> '\r': fp.write('\r')
- fp.close()
- #
- # Now save style and soup
- #
- oldresfile = Res.CurResFile()
- try:
- rf = Res.FSpOpenResFile(self.path, 3)
- except Res.Error:
- Res.FSpCreateResFile(self.path, '????', 'TEXT', macfs.smAllScripts)
- rf = Res.FSpOpenResFile(self.path, 3)
- styles = Res.Resource('')
- soup = Res.Resource('')
- self.ted.WECopyRange(0, 0x3fffffff, None, styles, soup)
- styles.AddResource('styl', 128, '')
- soup.AddResource('SOUP', 128, '')
- Res.CloseResFile(rf)
- Res.UseResFile(oldresfile)
-
- self.ted.WEResetModCount()
-
- def menu_save_as(self):
- path = EasyDialogs.AskFileForSave(message='Save as:')
- if not path: return
- self.path = path
- self.name = os.path.split(self.path)[-1]
- self.wid.SetWTitle(self.name)
- self.menu_save()
-
- def menu_insert(self, fp):
- self.ted.WESelView()
- data = fp.read()
- self.ted.WEInsert(data, None, None)
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_insert_html(self, fp):
- import htmllib
- import formatter
- f = formatter.AbstractFormatter(self)
-
- # Remember where we are, and don't update
- Qd.SetCursor(WATCH)
- start, dummy = self.ted.WEGetSelection()
- self.ted.WEFeatureFlag(WASTEconst.weFInhibitRecal, 1)
-
- self.html_init()
- p = MyHTMLParser(f)
- p.feed(fp.read())
-
- # Restore updating, recalc, set focus
- dummy, end = self.ted.WEGetSelection()
- self.ted.WECalText()
- self.ted.WESetSelection(start, end)
- self.ted.WESelView()
- self.ted.WEFeatureFlag(WASTEconst.weFInhibitRecal, 0)
- self.wid.InvalWindowRect(self.ted.WEGetViewRect())
-
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_cut(self):
- self.ted.WESelView()
- if hasattr(Scrap, 'ZeroScrap'):
- Scrap.ZeroScrap()
- else:
- Scrap.ClearCurrentScrap()
- self.ted.WECut()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_copy(self):
- if hasattr(Scrap, 'ZeroScrap'):
- Scrap.ZeroScrap()
- else:
- Scrap.ClearCurrentScrap()
- self.ted.WECopy()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_paste(self):
- self.ted.WESelView()
- self.ted.WEPaste()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_clear(self):
- self.ted.WESelView()
- self.ted.WEDelete()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_undo(self):
- self.ted.WEUndo()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_setfont(self, font):
- font = Fm.GetFNum(font)
- self.mysetstyle(WASTEconst.weDoFont, (font, 0, 0, (0,0,0)))
- self.parent.updatemenubar()
-
- def menu_modface(self, face):
- self.mysetstyle(WASTEconst.weDoFace|WASTEconst.weDoToggleFace,
- (0, face, 0, (0,0,0)))
-
- def menu_setface(self, face):
- self.mysetstyle(WASTEconst.weDoFace|WASTEconst.weDoReplaceFace,
- (0, face, 0, (0,0,0)))
-
- def menu_setsize(self, size):
- self.mysetstyle(WASTEconst.weDoSize, (0, 0, size, (0,0,0)))
-
- def menu_incsize(self, size):
- self.mysetstyle(WASTEconst.weDoAddSize, (0, 0, size, (0,0,0)))
-
- def mysetstyle(self, which, how):
- self.ted.WESelView()
- self.ted.WESetStyle(which, how)
- self.parent.updatemenubar()
-
- def have_selection(self):
- start, stop = self.ted.WEGetSelection()
- return start < stop
-
- def can_paste(self):
- return self.ted.WECanPaste()
-
- def can_undo(self):
- which, redo = self.ted.WEGetUndoInfo()
- which = UNDOLABELS[which]
- if which == None: return None
- if redo:
- return "Redo "+which
- else:
- return "Undo "+which
-
- def getruninfo(self):
- all = (WASTEconst.weDoFont | WASTEconst.weDoFace | WASTEconst.weDoSize)
- dummy, mode, (font, face, size, color) = self.ted.WEContinuousStyle(all)
- if not (mode & WASTEconst.weDoFont):
- font = None
- else:
- font = Fm.GetFontName(font)
- if not (mode & WASTEconst.weDoFace): fact = None
- if not (mode & WASTEconst.weDoSize): size = None
- return font, face, size
-
- #
- # Methods for writer class for html formatter
- #
-
- def html_init(self):
- self.html_font = [12, 0, 0, 0]
- self.html_style = 0
- self.html_color = (0,0,0)
- self.new_font(self.html_font)
-
- def new_font(self, font):
- if font == None:
- font = (12, 0, 0, 0)
- font = map(lambda x:x, font)
- for i in range(len(font)):
- if font[i] == None:
- font[i] = self.html_font[i]
- [size, italic, bold, tt] = font
- self.html_font = font[:]
- if tt:
- font = Fm.GetFNum('Courier')
- else:
- font = Fm.GetFNum('Times')
- if HTML_SIZE.has_key(size):
- size = HTML_SIZE[size]
- else:
- size = 12
- face = 0
- if bold: face = face | 1
- if italic: face = face | 2
- face = face | self.html_style
- self.ted.WESetStyle(WASTEconst.weDoFont | WASTEconst.weDoFace |
- WASTEconst.weDoSize | WASTEconst.weDoColor,
- (font, face, size, self.html_color))
-
- def new_margin(self, margin, level):
- self.ted.WEInsert('[Margin %s %s]'%(margin, level), None, None)
-
- def new_spacing(self, spacing):
- self.ted.WEInsert('[spacing %s]'%spacing, None, None)
-
- def new_styles(self, styles):
- self.html_style = 0
- self.html_color = (0,0,0)
- if 'anchor' in styles:
- self.html_style = self.html_style | 4
- self.html_color = (0xffff, 0, 0)
- self.new_font(self.html_font)
-
- def send_paragraph(self, blankline):
- self.ted.WEInsert('\r'*(blankline+1), None, None)
-
- def send_line_break(self):
- self.ted.WEInsert('\r', None, None)
-
- def send_hor_rule(self, *args, **kw):
- # Ignore ruler options, for now
- dummydata = Res.Resource('')
- self.ted.WEInsertObject('rulr', dummydata, (0,0))
-
- def send_label_data(self, data):
- self.ted.WEInsert(data, None, None)
-
- def send_flowing_data(self, data):
- self.ted.WEInsert(data, None, None)
-
- def send_literal_data(self, data):
- data = string.replace(data, '\n', '\r')
- data = string.expandtabs(data)
- self.ted.WEInsert(data, None, None)
-
-class Wed(Application):
- def __init__(self):
- Application.__init__(self)
- self.num = 0
- self.active = None
- self.updatemenubar()
- waste.STDObjectHandlers()
- # Handler for horizontal ruler
- waste.WEInstallObjectHandler('rulr', 'new ', self.newRuler)
- waste.WEInstallObjectHandler('rulr', 'draw', self.drawRuler)
-
- def makeusermenus(self):
- self.filemenu = m = Menu(self.menubar, "File")
- self.newitem = MenuItem(m, "New window", "N", self.open)
- self.openitem = MenuItem(m, "Open...", "O", self.openfile)
- self.closeitem = MenuItem(m, "Close", "W", self.closewin)
- m.addseparator()
- self.saveitem = MenuItem(m, "Save", "S", self.save)
- self.saveasitem = MenuItem(m, "Save as...", "", self.saveas)
- m.addseparator()
- self.insertitem = MenuItem(m, "Insert plaintext...", "", self.insertfile)
- self.htmlitem = MenuItem(m, "Insert HTML...", "", self.inserthtml)
- m.addseparator()
- self.quititem = MenuItem(m, "Quit", "Q", self.quit)
-
- self.editmenu = m = Menu(self.menubar, "Edit")
- self.undoitem = MenuItem(m, "Undo", "Z", self.undo)
- self.cutitem = MenuItem(m, "Cut", "X", self.cut)
- self.copyitem = MenuItem(m, "Copy", "C", self.copy)
- self.pasteitem = MenuItem(m, "Paste", "V", self.paste)
- self.clearitem = MenuItem(m, "Clear", "", self.clear)
-
- self.makefontmenu()
-
- # Groups of items enabled together:
- self.windowgroup = [self.closeitem, self.saveitem, self.saveasitem,
- self.editmenu, self.fontmenu, self.facemenu, self.sizemenu,
- self.insertitem]
- self.focusgroup = [self.cutitem, self.copyitem, self.clearitem]
- self.windowgroup_on = -1
- self.focusgroup_on = -1
- self.pastegroup_on = -1
- self.undo_label = "never"
- self.ffs_values = ()
-
- def makefontmenu(self):
- self.fontmenu = Menu(self.menubar, "Font")
- self.fontnames = getfontnames()
- self.fontitems = []
- for n in self.fontnames:
- m = MenuItem(self.fontmenu, n, "", self.selfont)
- self.fontitems.append(m)
- self.facemenu = Menu(self.menubar, "Style")
- self.faceitems = []
- for n, shortcut in STYLES:
- m = MenuItem(self.facemenu, n, shortcut, self.selface)
- self.faceitems.append(m)
- self.facemenu.addseparator()
- self.faceitem_normal = MenuItem(self.facemenu, "Normal", "N",
- self.selfacenormal)
- self.sizemenu = Menu(self.menubar, "Size")
- self.sizeitems = []
- for n in SIZES:
- m = MenuItem(self.sizemenu, repr(n), "", self.selsize)
- self.sizeitems.append(m)
- self.sizemenu.addseparator()
- self.sizeitem_bigger = MenuItem(self.sizemenu, "Bigger", "+",
- self.selsizebigger)
- self.sizeitem_smaller = MenuItem(self.sizemenu, "Smaller", "-",
- self.selsizesmaller)
-
- def selfont(self, id, item, *rest):
- if self.active:
- font = self.fontnames[item-1]
- self.active.menu_setfont(font)
- else:
- EasyDialogs.Message("No active window?")
-
- def selface(self, id, item, *rest):
- if self.active:
- face = (1<<(item-1))
- self.active.menu_modface(face)
- else:
- EasyDialogs.Message("No active window?")
-
- def selfacenormal(self, *rest):
- if self.active:
- self.active.menu_setface(0)
- else:
- EasyDialogs.Message("No active window?")
-
- def selsize(self, id, item, *rest):
- if self.active:
- size = SIZES[item-1]
- self.active.menu_setsize(size)
- else:
- EasyDialogs.Message("No active window?")
-
- def selsizebigger(self, *rest):
- if self.active:
- self.active.menu_incsize(2)
- else:
- EasyDialogs.Message("No active window?")
-
- def selsizesmaller(self, *rest):
- if self.active:
- self.active.menu_incsize(-2)
- else:
- EasyDialogs.Message("No active window?")
-
- def updatemenubar(self):
- changed = 0
- on = (self.active <> None)
- if on <> self.windowgroup_on:
- for m in self.windowgroup:
- m.enable(on)
- self.windowgroup_on = on
- changed = 1
- if on:
- # only if we have an edit menu
- on = self.active.have_selection()
- if on <> self.focusgroup_on:
- for m in self.focusgroup:
- m.enable(on)
- self.focusgroup_on = on
- changed = 1
- on = self.active.can_paste()
- if on <> self.pastegroup_on:
- self.pasteitem.enable(on)
- self.pastegroup_on = on
- changed = 1
- on = self.active.can_undo()
- if on <> self.undo_label:
- if on:
- self.undoitem.enable(1)
- self.undoitem.settext(on)
- self.undo_label = on
- else:
- self.undoitem.settext("Nothing to undo")
- self.undoitem.enable(0)
- changed = 1
- if self.updatefontmenus():
- changed = 1
- if changed:
- DrawMenuBar()
-
- def updatefontmenus(self):
- info = self.active.getruninfo()
- if info == self.ffs_values:
- return 0
- # Remove old checkmarks
- if self.ffs_values == ():
- self.ffs_values = (None, None, None)
- font, face, size = self.ffs_values
- if font <> None:
- fnum = self.fontnames.index(font)
- self.fontitems[fnum].check(0)
- if face <> None:
- for i in range(len(self.faceitems)):
- if face & (1<<i):
- self.faceitems[i].check(0)
- if size <> None:
- for i in range(len(self.sizeitems)):
- if SIZES[i] == size:
- self.sizeitems[i].check(0)
-
- self.ffs_values = info
- # Set new checkmarks
- font, face, size = self.ffs_values
- if font <> None:
- fnum = self.fontnames.index(font)
- self.fontitems[fnum].check(1)
- if face <> None:
- for i in range(len(self.faceitems)):
- if face & (1<<i):
- self.faceitems[i].check(1)
- if size <> None:
- for i in range(len(self.sizeitems)):
- if SIZES[i] == size:
- self.sizeitems[i].check(1)
- # Set outline/normal for sizes
- if font:
- exists = getfontsizes(font, SIZES)
- for i in range(len(self.sizeitems)):
- if exists[i]:
- self.sizeitems[i].setstyle(0)
- else:
- self.sizeitems[i].setstyle(8)
-
- #
- # Apple menu
- #
-
- def do_about(self, id, item, window, event):
- EasyDialogs.Message("A simple single-font text editor based on WASTE")
-
- #
- # File menu
- #
-
- def open(self, *args):
- self._open(0)
-
- def openfile(self, *args):
- self._open(1)
-
- def _open(self, askfile):
- if askfile:
- path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
- if not path:
- return
- name = os.path.split(path)[-1]
- try:
- fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
- data = fp.read()
- fp.close()
- except IOError, arg:
- EasyDialogs.Message("IOERROR: %r" % (arg,))
- return
- else:
- path = None
- name = "Untitled %d"%self.num
- data = ''
- w = WasteWindow(self)
- w.open(path, name, data)
- self.num = self.num + 1
-
- def insertfile(self, *args):
- if self.active:
- path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
- if not path:
- return
- try:
- fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
- except IOError, arg:
- EasyDialogs.Message("IOERROR: %r" % (args,))
- return
- self.active.menu_insert(fp)
- else:
- EasyDialogs.Message("No active window?")
-
- def inserthtml(self, *args):
- if self.active:
- path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
- if not path:
- return
- try:
- fp = open(path, 'r')
- except IOError, arg:
- EasyDialogs.Message("IOERROR: %r" % (arg,))
- return
- self.active.menu_insert_html(fp)
- else:
- EasyDialogs.Message("No active window?")
-
-
- def closewin(self, *args):
- if self.active:
- self.active.close()
- else:
- EasyDialogs.Message("No active window?")
-
- def save(self, *args):
- if self.active:
- self.active.menu_save()
- else:
- EasyDialogs.Message("No active window?")
-
- def saveas(self, *args):
- if self.active:
- self.active.menu_save_as()
- else:
- EasyDialogs.Message("No active window?")
-
-
- def quit(self, *args):
- for w in self._windows.values():
- w.close()
- if self._windows:
- return
- self._quit()
-
- #
- # Edit menu
- #
-
- def undo(self, *args):
- if self.active:
- self.active.menu_undo()
- else:
- EasyDialogs.Message("No active window?")
-
- def cut(self, *args):
- if self.active:
- self.active.menu_cut()
- else:
- EasyDialogs.Message("No active window?")
-
- def copy(self, *args):
- if self.active:
- self.active.menu_copy()
- else:
- EasyDialogs.Message("No active window?")
-
- def paste(self, *args):
- if self.active:
- self.active.menu_paste()
- else:
- EasyDialogs.Message("No active window?")
-
- def clear(self, *args):
- if self.active:
- self.active.menu_clear()
- else:
- EasyDialogs.Message("No active window?")
-
- #
- # Other stuff
- #
-
- def idle(self, event):
- if self.active:
- self.active.do_idle(event)
- else:
- Qd.SetCursor(Qd.GetQDGlobalsArrow())
-
- def newRuler(self, obj):
- """Insert a new ruler. Make it as wide as the window minus 2 pxls"""
- ted = obj.WEGetObjectOwner()
- l, t, r, b = ted.WEGetDestRect()
- return r-l, 4
-
- def drawRuler(self, (l, t, r, b), obj):
- y = (t+b)/2
- Qd.MoveTo(l+2, y)
- Qd.LineTo(r-2, y)
- return 0
-
-class MyHTMLParser(htmllib.HTMLParser):
-
- def anchor_bgn(self, href, name, type):
- self.anchor = href
- if self.anchor:
- self.anchorlist.append(href)
- self.formatter.push_style('anchor')
-
- def anchor_end(self):
- if self.anchor:
- self.anchor = None
- self.formatter.pop_style()
-
-
-def getfontnames():
- names = []
- for i in range(256):
- n = Fm.GetFontName(i)
- if n: names.append(n)
- return names
-
-def getfontsizes(name, sizes):
- exist = []
- num = Fm.GetFNum(name)
- for sz in sizes:
- if Fm.RealFont(num, sz):
- exist.append(1)
- else:
- exist.append(0)
- return exist
-
-def main():
- App = Wed()
- App.mainloop()
-
-if __name__ == '__main__':
- main()
diff --git a/Mac/Demo/waste/swed.py b/Mac/Demo/waste/swed.py
deleted file mode 100644
index 2078cce331..0000000000
--- a/Mac/Demo/waste/swed.py
+++ /dev/null
@@ -1,634 +0,0 @@
-# A minimal text editor.
-#
-# To be done:
-# - Functionality: find, etc.
-
-from Carbon.Menu import DrawMenuBar
-from FrameWork import *
-from Carbon import Win
-from Carbon import Qd
-from Carbon import Res
-from Carbon import Fm
-import waste
-import WASTEconst
-from Carbon import Scrap
-import os
-import macfs
-
-UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
- None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"]
-
-# Style and size menu. Note that style order is important (tied to bit values)
-STYLES = [
- ("Bold", "B"), ("Italic", "I"), ("Underline", "U"), ("Outline", "O"),
- ("Shadow", ""), ("Condensed", ""), ("Extended", "")
- ]
-SIZES = [ 9, 10, 12, 14, 18, 24]
-
-BIGREGION=Qd.NewRgn()
-Qd.SetRectRgn(BIGREGION, -16000, -16000, 16000, 16000)
-
-class WasteWindow(ScrolledWindow):
- def open(self, path, name, data):
- self.path = path
- self.name = name
- r = windowbounds(400, 400)
- w = Win.NewWindow(r, name, 1, 0, -1, 1, 0)
- self.wid = w
- vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15
- dr = (0, 0, 10240, 0)
- Qd.SetPort(w)
- Qd.TextFont(4)
- Qd.TextSize(9)
- flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite | \
- WASTEconst.weDoUndo
- self.ted = waste.WENew(dr, vr, flags)
- self.ted.WEInstallTabHooks()
- style, soup = self.getstylesoup()
- self.ted.WEInsert(data, style, soup)
- self.ted.WESetSelection(0,0)
- self.ted.WECalText()
- self.ted.WEResetModCount()
- w.DrawGrowIcon()
- self.scrollbars()
- self.do_postopen()
- self.do_activate(1, None)
-
- def getstylesoup(self):
- if not self.path:
- return None, None
- oldrf = Res.CurResFile()
- try:
- rf = Res.FSpOpenResFile(self.path, 1)
- except Res.Error:
- return None, None
- try:
- hstyle = Res.Get1Resource('styl', 128)
- hstyle.DetachResource()
- except Res.Error:
- hstyle = None
- try:
- hsoup = Res.Get1Resource('SOUP', 128)
- hsoup.DetachResource()
- except Res.Error:
- hsoup = None
- Res.CloseResFile(rf)
- Res.UseResFile(oldrf)
- return hstyle, hsoup
-
- def do_idle(self, event):
- (what, message, when, where, modifiers) = event
- Qd.SetPort(self.wid)
- self.ted.WEIdle()
- if self.ted.WEAdjustCursor(where, BIGREGION):
- return
- Qd.SetCursor(Qd.GetQDGlobalsArrow())
-
- def getscrollbarvalues(self):
- dr = self.ted.WEGetDestRect()
- vr = self.ted.WEGetViewRect()
- vx = self.scalebarvalue(dr[0], dr[2], vr[0], vr[2])
- vy = self.scalebarvalue(dr[1], dr[3], vr[1], vr[3])
- return vx, vy
-
- def scrollbar_callback(self, which, what, value):
- if which == 'y':
- if what == 'set':
- height = self.ted.WEGetHeight(0, 0x3fffffff)
- cur = self.getscrollbarvalues()[1]
- delta = (cur-value)*height/32767
- if what == '-':
- topline_off,dummy = self.ted.WEGetOffset((1,1))
- topline_num = self.ted.WEOffsetToLine(topline_off)
- delta = self.ted.WEGetHeight(topline_num, topline_num+1)
- elif what == '--':
- delta = (self.ted.WEGetViewRect()[3]-10)
- if delta <= 0:
- delta = 10 # Random value
- elif what == '+':
- # XXXX Wrong: should be bottom line size
- topline_off,dummy = self.ted.WEGetOffset((1,1))
- topline_num = self.ted.WEOffsetToLine(topline_off)
- delta = -self.ted.WEGetHeight(topline_num, topline_num+1)
- elif what == '++':
- delta = -(self.ted.WEGetViewRect()[3]-10)
- if delta >= 0:
- delta = -10
- self.ted.WEScroll(0, delta)
- else:
- if what == 'set':
- return # XXXX
- vr = self.ted.WEGetViewRect()
- winwidth = vr[2]-vr[0]
- if what == '-':
- delta = winwidth/10
- elif what == '--':
- delta = winwidth/2
- elif what == '+':
- delta = -winwidth/10
- elif what == '++':
- delta = -winwidth/2
- self.ted.WEScroll(delta, 0)
- # Pin the scroll
- l, t, r, b = self.ted.WEGetDestRect()
- vl, vt, vr, vb = self.ted.WEGetViewRect()
- if t > 0 or l > 0:
- dx = dy = 0
- if t > 0: dy = -t
- if l > 0: dx = -l
- self.ted.WEScroll(dx, dy)
- elif b < vb:
- self.ted.WEScroll(0, b-vb)
-
-
- def do_activate(self, onoff, evt):
- Qd.SetPort(self.wid)
- ScrolledWindow.do_activate(self, onoff, evt)
- if onoff:
- self.ted.WEActivate()
- self.parent.active = self
- self.parent.updatemenubar()
- else:
- self.ted.WEDeactivate()
-
- def do_update(self, wid, event):
- region = wid.GetWindowPort().visRgn
- if Qd.EmptyRgn(region):
- return
- Qd.EraseRgn(region)
- self.ted.WEUpdate(region)
- self.updatescrollbars()
-
- def do_postresize(self, width, height, window):
- l, t, r, b = self.ted.WEGetViewRect()
- vr = (l, t, l+width-15, t+height-15)
- self.ted.WESetViewRect(vr)
- self.wid.InvalWindowRect(vr)
- ScrolledWindow.do_postresize(self, width, height, window)
-
- def do_contentclick(self, local, modifiers, evt):
- (what, message, when, where, modifiers) = evt
- self.ted.WEClick(local, modifiers, when)
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def do_char(self, ch, event):
- self.ted.WESelView()
- (what, message, when, where, modifiers) = event
- self.ted.WEKey(ord(ch), modifiers)
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def close(self):
- if self.ted.WEGetModCount():
- save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?'%self.name, 1)
- if save > 0:
- self.menu_save()
- elif save < 0:
- return
- if self.parent.active == self:
- self.parent.active = None
- self.parent.updatemenubar()
- del self.ted
- self.do_postclose()
-
- def menu_save(self):
- if not self.path:
- self.menu_save_as()
- return # Will call us recursively
- #
- # First save data
- #
- dhandle = self.ted.WEGetText()
- data = dhandle.data
- fp = open(self.path, 'wb') # NOTE: wb, because data has CR for end-of-line
- fp.write(data)
- if data[-1] <> '\r': fp.write('\r')
- fp.close()
- #
- # Now save style and soup
- #
- oldresfile = Res.CurResFile()
- try:
- rf = Res.FSpOpenResFile(self.path, 3)
- except Res.Error:
- Res.FSpCreateResFile(self.path, '????', 'TEXT', macfs.smAllScripts)
- rf = Res.FSpOpenResFile(self.path, 3)
- styles = Res.Resource('')
- soup = Res.Resource('')
- self.ted.WECopyRange(0, 0x3fffffff, None, styles, soup)
- styles.AddResource('styl', 128, '')
- soup.AddResource('SOUP', 128, '')
- Res.CloseResFile(rf)
- Res.UseResFile(oldresfile)
-
- self.ted.WEResetModCount()
-
- def menu_save_as(self):
- path = EasyDialogs.AskFileForSave(message='Save as:')
- if not path: return
- self.path = path
- self.name = os.path.split(self.path)[-1]
- self.wid.SetWTitle(self.name)
- self.menu_save()
-
- def menu_cut(self):
- self.ted.WESelView()
- if hasattr(Scrap, 'ZeroScrap'):
- Scrap.ZeroScrap()
- else:
- Scrap.ClearCurrentScrap()
- self.ted.WECut()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_copy(self):
- if hasattr(Scrap, 'ZeroScrap'):
- Scrap.ZeroScrap()
- else:
- Scrap.ClearCurrentScrap()
- self.ted.WECopy()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_paste(self):
- self.ted.WESelView()
- self.ted.WEPaste()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_clear(self):
- self.ted.WESelView()
- self.ted.WEDelete()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_undo(self):
- self.ted.WEUndo()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_setfont(self, font):
- font = Fm.GetFNum(font)
- self.mysetstyle(WASTEconst.weDoFont, (font, 0, 0, (0,0,0)))
- self.parent.updatemenubar()
-
- def menu_modface(self, face):
- self.mysetstyle(WASTEconst.weDoFace|WASTEconst.weDoToggleFace,
- (0, face, 0, (0,0,0)))
-
- def menu_setface(self, face):
- self.mysetstyle(WASTEconst.weDoFace|WASTEconst.weDoReplaceFace,
- (0, face, 0, (0,0,0)))
-
- def menu_setsize(self, size):
- self.mysetstyle(WASTEconst.weDoSize, (0, 0, size, (0,0,0)))
-
- def menu_incsize(self, size):
- self.mysetstyle(WASTEconst.weDoAddSize, (0, 0, size, (0,0,0)))
-
- def mysetstyle(self, which, how):
- self.ted.WESelView()
- self.ted.WESetStyle(which, how)
- self.parent.updatemenubar()
-
- def have_selection(self):
- start, stop = self.ted.WEGetSelection()
- return start < stop
-
- def can_paste(self):
- return self.ted.WECanPaste()
-
- def can_undo(self):
- which, redo = self.ted.WEGetUndoInfo()
- which = UNDOLABELS[which]
- if which == None: return None
- if redo:
- return "Redo "+which
- else:
- return "Undo "+which
-
- def getruninfo(self):
- all = (WASTEconst.weDoFont | WASTEconst.weDoFace | WASTEconst.weDoSize)
- dummy, mode, (font, face, size, color) = self.ted.WEContinuousStyle(all)
- if not (mode & WASTEconst.weDoFont):
- font = None
- else:
- font = Fm.GetFontName(font)
- if not (mode & WASTEconst.weDoFace): fact = None
- if not (mode & WASTEconst.weDoSize): size = None
- return font, face, size
-
-class Wed(Application):
- def __init__(self):
- Application.__init__(self)
- self.num = 0
- self.active = None
- self.updatemenubar()
- waste.STDObjectHandlers()
-
- def makeusermenus(self):
- self.filemenu = m = Menu(self.menubar, "File")
- self.newitem = MenuItem(m, "New window", "N", self.open)
- self.openitem = MenuItem(m, "Open...", "O", self.openfile)
- self.closeitem = MenuItem(m, "Close", "W", self.closewin)
- m.addseparator()
- self.saveitem = MenuItem(m, "Save", "S", self.save)
- self.saveasitem = MenuItem(m, "Save as...", "", self.saveas)
- m.addseparator()
- self.quititem = MenuItem(m, "Quit", "Q", self.quit)
-
- self.editmenu = m = Menu(self.menubar, "Edit")
- self.undoitem = MenuItem(m, "Undo", "Z", self.undo)
- self.cutitem = MenuItem(m, "Cut", "X", self.cut)
- self.copyitem = MenuItem(m, "Copy", "C", self.copy)
- self.pasteitem = MenuItem(m, "Paste", "V", self.paste)
- self.clearitem = MenuItem(m, "Clear", "", self.clear)
-
- self.makefontmenu()
-
- # Groups of items enabled together:
- self.windowgroup = [self.closeitem, self.saveitem, self.saveasitem,
- self.editmenu, self.fontmenu, self.facemenu, self.sizemenu]
- self.focusgroup = [self.cutitem, self.copyitem, self.clearitem]
- self.windowgroup_on = -1
- self.focusgroup_on = -1
- self.pastegroup_on = -1
- self.undo_label = "never"
- self.ffs_values = ()
-
- def makefontmenu(self):
- self.fontmenu = Menu(self.menubar, "Font")
- self.fontnames = getfontnames()
- self.fontitems = []
- for n in self.fontnames:
- m = MenuItem(self.fontmenu, n, "", self.selfont)
- self.fontitems.append(m)
- self.facemenu = Menu(self.menubar, "Style")
- self.faceitems = []
- for n, shortcut in STYLES:
- m = MenuItem(self.facemenu, n, shortcut, self.selface)
- self.faceitems.append(m)
- self.facemenu.addseparator()
- self.faceitem_normal = MenuItem(self.facemenu, "Normal", "N",
- self.selfacenormal)
- self.sizemenu = Menu(self.menubar, "Size")
- self.sizeitems = []
- for n in SIZES:
- m = MenuItem(self.sizemenu, repr(n), "", self.selsize)
- self.sizeitems.append(m)
- self.sizemenu.addseparator()
- self.sizeitem_bigger = MenuItem(self.sizemenu, "Bigger", "+",
- self.selsizebigger)
- self.sizeitem_smaller = MenuItem(self.sizemenu, "Smaller", "-",
- self.selsizesmaller)
-
- def selfont(self, id, item, *rest):
- if self.active:
- font = self.fontnames[item-1]
- self.active.menu_setfont(font)
- else:
- EasyDialogs.Message("No active window?")
-
- def selface(self, id, item, *rest):
- if self.active:
- face = (1<<(item-1))
- self.active.menu_modface(face)
- else:
- EasyDialogs.Message("No active window?")
-
- def selfacenormal(self, *rest):
- if self.active:
- self.active.menu_setface(0)
- else:
- EasyDialogs.Message("No active window?")
-
- def selsize(self, id, item, *rest):
- if self.active:
- size = SIZES[item-1]
- self.active.menu_setsize(size)
- else:
- EasyDialogs.Message("No active window?")
-
- def selsizebigger(self, *rest):
- if self.active:
- self.active.menu_incsize(2)
- else:
- EasyDialogs.Message("No active window?")
-
- def selsizesmaller(self, *rest):
- if self.active:
- self.active.menu_incsize(-2)
- else:
- EasyDialogs.Message("No active window?")
-
- def updatemenubar(self):
- changed = 0
- on = (self.active <> None)
- if on <> self.windowgroup_on:
- for m in self.windowgroup:
- m.enable(on)
- self.windowgroup_on = on
- changed = 1
- if on:
- # only if we have an edit menu
- on = self.active.have_selection()
- if on <> self.focusgroup_on:
- for m in self.focusgroup:
- m.enable(on)
- self.focusgroup_on = on
- changed = 1
- on = self.active.can_paste()
- if on <> self.pastegroup_on:
- self.pasteitem.enable(on)
- self.pastegroup_on = on
- changed = 1
- on = self.active.can_undo()
- if on <> self.undo_label:
- if on:
- self.undoitem.enable(1)
- self.undoitem.settext(on)
- self.undo_label = on
- else:
- self.undoitem.settext("Nothing to undo")
- self.undoitem.enable(0)
- changed = 1
- if self.updatefontmenus():
- changed = 1
- if changed:
- DrawMenuBar()
-
- def updatefontmenus(self):
- info = self.active.getruninfo()
- if info == self.ffs_values:
- return 0
- # Remove old checkmarks
- if self.ffs_values == ():
- self.ffs_values = (None, None, None)
- font, face, size = self.ffs_values
- if font <> None:
- fnum = self.fontnames.index(font)
- self.fontitems[fnum].check(0)
- if face <> None:
- for i in range(len(self.faceitems)):
- if face & (1<<i):
- self.faceitems[i].check(0)
- if size <> None:
- for i in range(len(self.sizeitems)):
- if SIZES[i] == size:
- self.sizeitems[i].check(0)
-
- self.ffs_values = info
- # Set new checkmarks
- font, face, size = self.ffs_values
- if font <> None:
- fnum = self.fontnames.index(font)
- self.fontitems[fnum].check(1)
- if face <> None:
- for i in range(len(self.faceitems)):
- if face & (1<<i):
- self.faceitems[i].check(1)
- if size <> None:
- for i in range(len(self.sizeitems)):
- if SIZES[i] == size:
- self.sizeitems[i].check(1)
- # Set outline/normal for sizes
- if font:
- exists = getfontsizes(font, SIZES)
- for i in range(len(self.sizeitems)):
- if exists[i]:
- self.sizeitems[i].setstyle(0)
- else:
- self.sizeitems[i].setstyle(8)
-
- #
- # Apple menu
- #
-
- def do_about(self, id, item, window, event):
- EasyDialogs.Message("A simple single-font text editor based on WASTE")
-
- #
- # File menu
- #
-
- def open(self, *args):
- self._open(0)
-
- def openfile(self, *args):
- self._open(1)
-
- def _open(self, askfile):
- if askfile:
- path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
- if not path:
- return
- name = os.path.split(path)[-1]
- try:
- fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
- data = fp.read()
- fp.close()
- except IOError, arg:
- EasyDialogs.Message("IOERROR: %r" % (arg,))
- return
- else:
- path = None
- name = "Untitled %d"%self.num
- data = ''
- w = WasteWindow(self)
- w.open(path, name, data)
- self.num = self.num + 1
-
- def closewin(self, *args):
- if self.active:
- self.active.close()
- else:
- EasyDialogs.Message("No active window?")
-
- def save(self, *args):
- if self.active:
- self.active.menu_save()
- else:
- EasyDialogs.Message("No active window?")
-
- def saveas(self, *args):
- if self.active:
- self.active.menu_save_as()
- else:
- EasyDialogs.Message("No active window?")
-
-
- def quit(self, *args):
- for w in self._windows.values():
- w.close()
- if self._windows:
- return
- self._quit()
-
- #
- # Edit menu
- #
-
- def undo(self, *args):
- if self.active:
- self.active.menu_undo()
- else:
- EasyDialogs.Message("No active window?")
-
- def cut(self, *args):
- if self.active:
- self.active.menu_cut()
- else:
- EasyDialogs.Message("No active window?")
-
- def copy(self, *args):
- if self.active:
- self.active.menu_copy()
- else:
- EasyDialogs.Message("No active window?")
-
- def paste(self, *args):
- if self.active:
- self.active.menu_paste()
- else:
- EasyDialogs.Message("No active window?")
-
- def clear(self, *args):
- if self.active:
- self.active.menu_clear()
- else:
- EasyDialogs.Message("No active window?")
-
- #
- # Other stuff
- #
-
- def idle(self, event):
- if self.active:
- self.active.do_idle(event)
- else:
- Qd.SetCursor(Qd.GetQDGlobalsArrow())
-
-def getfontnames():
- names = []
- for i in range(256):
- n = Fm.GetFontName(i)
- if n: names.append(n)
- return names
-
-def getfontsizes(name, sizes):
- exist = []
- num = Fm.GetFNum(name)
- for sz in sizes:
- if Fm.RealFont(num, sz):
- exist.append(1)
- else:
- exist.append(0)
- return exist
-
-def main():
- App = Wed()
- App.mainloop()
-
-if __name__ == '__main__':
- main()
diff --git a/Mac/Demo/waste/wed.py b/Mac/Demo/waste/wed.py
deleted file mode 100644
index 28ee938f71..0000000000
--- a/Mac/Demo/waste/wed.py
+++ /dev/null
@@ -1,426 +0,0 @@
-# A minimal text editor.
-#
-# To be done:
-# - Functionality: find, etc.
-
-from Carbon.Menu import DrawMenuBar
-from FrameWork import *
-from Carbon import Win
-from Carbon import Qd
-from Carbon import Res
-import waste
-import WASTEconst
-from Carbon import Scrap
-import os
-import EasyDialogs
-
-UNDOLABELS = [ # Indexed by WEGetUndoInfo() value
- None, "", "typing", "Cut", "Paste", "Clear", "Drag", "Style"]
-
-BIGREGION=Qd.NewRgn()
-Qd.SetRectRgn(BIGREGION, -16000, -16000, 16000, 16000)
-
-class WasteWindow(ScrolledWindow):
- def open(self, path, name, data):
- self.path = path
- self.name = name
- r = windowbounds(400, 400)
- w = Win.NewWindow(r, name, 1, 0, -1, 1, 0)
- self.wid = w
- vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15
- dr = (0, 0, 10240, 0)
- Qd.SetPort(w)
- Qd.TextFont(4)
- Qd.TextSize(9)
- flags = WASTEconst.weDoAutoScroll | WASTEconst.weDoOutlineHilite | \
- WASTEconst.weDoMonoStyled | WASTEconst.weDoUndo
- self.ted = waste.WENew(dr, vr, flags)
- self.tedtexthandle = Res.Resource(data)
- self.ted.WEUseText(self.tedtexthandle)
- self.ted.WECalText()
- w.DrawGrowIcon()
- self.scrollbars()
- self.changed = 0
- self.do_postopen()
- self.do_activate(1, None)
-
- def do_idle(self, event):
- (what, message, when, where, modifiers) = event
- Qd.SetPort(self.wid)
- self.ted.WEIdle()
- if self.ted.WEAdjustCursor(where, BIGREGION):
- return
- Qd.SetCursor(Qd.GetQDGlobalsArrow())
-
- def getscrollbarvalues(self):
- dr = self.ted.WEGetDestRect()
- vr = self.ted.WEGetViewRect()
- vx = self.scalebarvalue(dr[0], dr[2], vr[0], vr[2])
- vy = self.scalebarvalue(dr[1], dr[3], vr[1], vr[3])
-## print dr, vr, vx, vy
- return vx, vy
-
- def scrollbar_callback(self, which, what, value):
- if which == 'y':
- if what == 'set':
- height = self.ted.WEGetHeight(0, 0x3fffffff)
- cur = self.getscrollbarvalues()[1]
- delta = (cur-value)*height/32767
- if what == '-':
- topline_off,dummy = self.ted.WEGetOffset((1,1))
- topline_num = self.ted.WEOffsetToLine(topline_off)
- delta = self.ted.WEGetHeight(topline_num, topline_num+1)
- elif what == '--':
- delta = (self.ted.WEGetViewRect()[3]-10)
- if delta <= 0:
- delta = 10 # Random value
- elif what == '+':
- # XXXX Wrong: should be bottom line size
- topline_off,dummy = self.ted.WEGetOffset((1,1))
- topline_num = self.ted.WEOffsetToLine(topline_off)
- delta = -self.ted.WEGetHeight(topline_num, topline_num+1)
- elif what == '++':
- delta = -(self.ted.WEGetViewRect()[3]-10)
- if delta >= 0:
- delta = -10
- self.ted.WEScroll(0, delta)
-## print 'SCROLL Y', delta
- else:
- if what == 'set':
- return # XXXX
- vr = self.ted.WEGetViewRect()
- winwidth = vr[2]-vr[0]
- if what == '-':
- delta = winwidth/10
- elif what == '--':
- delta = winwidth/2
- elif what == '+':
- delta = -winwidth/10
- elif what == '++':
- delta = -winwidth/2
- self.ted.WEScroll(delta, 0)
- # Pin the scroll
- l, t, r, b = self.ted.WEGetDestRect()
- vl, vt, vr, vb = self.ted.WEGetViewRect()
- if t > 0 or l > 0:
- dx = dy = 0
- if t > 0: dy = -t
- if l > 0: dx = -l
-## print 'Extra scroll', dx, dy
- self.ted.WEScroll(dx, dy)
- elif b < vb:
-## print 'Extra downscroll', b-vb
- self.ted.WEScroll(0, b-vb)
-
-
- def do_activate(self, onoff, evt):
-## print "ACTIVATE", onoff
- Qd.SetPort(self.wid)
- ScrolledWindow.do_activate(self, onoff, evt)
- if onoff:
- self.ted.WEActivate()
- self.parent.active = self
- self.parent.updatemenubar()
- else:
- self.ted.WEDeactivate()
-
- def do_update(self, wid, event):
- region = wid.GetWindowPort().visRgn
- if Qd.EmptyRgn(region):
- return
- Qd.EraseRgn(region)
- self.ted.WEUpdate(region)
- self.updatescrollbars()
-
- def do_postresize(self, width, height, window):
- l, t, r, b = self.ted.WEGetViewRect()
- vr = (l, t, l+width-15, t+height-15)
- self.ted.WESetViewRect(vr)
- self.wid.InvalWindowRect(vr)
- ScrolledWindow.do_postresize(self, width, height, window)
-
- def do_contentclick(self, local, modifiers, evt):
- (what, message, when, where, modifiers) = evt
- self.ted.WEClick(local, modifiers, when)
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def do_char(self, ch, event):
- self.ted.WESelView()
- (what, message, when, where, modifiers) = event
- self.ted.WEKey(ord(ch), modifiers)
- self.changed = 1
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def close(self):
- if self.changed:
- save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?'%self.name, 1)
- if save > 0:
- self.menu_save()
- elif save < 0:
- return
- if self.parent.active == self:
- self.parent.active = None
- self.parent.updatemenubar()
- del self.ted
- del self.tedtexthandle
- self.do_postclose()
-
- def menu_save(self):
- if not self.path:
- self.menu_save_as()
- return # Will call us recursively
-## print 'Saving to ', self.path
- dhandle = self.ted.WEGetText()
- data = dhandle.data
- fp = open(self.path, 'wb') # NOTE: wb, because data has CR for end-of-line
- fp.write(data)
- if data[-1] <> '\r': fp.write('\r')
- fp.close()
- self.changed = 0
-
- def menu_save_as(self):
- path = EasyDialogs.AskFileForSave(message='Save as:')
- if not path: return
- self.path = path
- self.name = os.path.split(self.path)[-1]
- self.wid.SetWTitle(self.name)
- self.menu_save()
-
- def menu_cut(self):
- self.ted.WESelView()
- if hasattr(Scrap, 'ZeroScrap'):
- Scrap.ZeroScrap()
- else:
- Scrap.ClearCurrentScrap()
- self.ted.WECut()
- self.updatescrollbars()
- self.parent.updatemenubar()
- self.changed = 1
-
- def menu_copy(self):
- if hasattr(Scrap, 'ZeroScrap'):
- Scrap.ZeroScrap()
- else:
- Scrap.ClearCurrentScrap()
- self.ted.WECopy()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def menu_paste(self):
- self.ted.WESelView()
- self.ted.WEPaste()
- self.updatescrollbars()
- self.parent.updatemenubar()
- self.changed = 1
-
- def menu_clear(self):
- self.ted.WESelView()
- self.ted.WEDelete()
- self.updatescrollbars()
- self.parent.updatemenubar()
- self.changed = 1
-
- def menu_undo(self):
- self.ted.WEUndo()
- self.updatescrollbars()
- self.parent.updatemenubar()
-
- def have_selection(self):
- start, stop = self.ted.WEGetSelection()
- return start < stop
-
- def can_paste(self):
- return self.ted.WECanPaste()
-
- def can_undo(self):
- which, redo = self.ted.WEGetUndoInfo()
- which = UNDOLABELS[which]
- if which == None: return None
- if redo:
- return "Redo "+which
- else:
- return "Undo "+which
-
-class Wed(Application):
- def __init__(self):
- Application.__init__(self)
- self.num = 0
- self.active = None
- self.updatemenubar()
-
- def makeusermenus(self):
- self.filemenu = m = Menu(self.menubar, "File")
- self.newitem = MenuItem(m, "New window", "N", self.open)
- self.openitem = MenuItem(m, "Open...", "O", self.openfile)
- self.closeitem = MenuItem(m, "Close", "W", self.closewin)
- m.addseparator()
- self.saveitem = MenuItem(m, "Save", "S", self.save)
- self.saveasitem = MenuItem(m, "Save as...", "", self.saveas)
- m.addseparator()
- self.quititem = MenuItem(m, "Quit", "Q", self.quit)
-
- self.editmenu = m = Menu(self.menubar, "Edit")
- self.undoitem = MenuItem(m, "Undo", "Z", self.undo)
- self.cutitem = MenuItem(m, "Cut", "X", self.cut)
- self.copyitem = MenuItem(m, "Copy", "C", self.copy)
- self.pasteitem = MenuItem(m, "Paste", "V", self.paste)
- self.clearitem = MenuItem(m, "Clear", "", self.clear)
-
- # Groups of items enabled together:
- self.windowgroup = [self.closeitem, self.saveitem, self.saveasitem, self.editmenu]
- self.focusgroup = [self.cutitem, self.copyitem, self.clearitem]
- self.windowgroup_on = -1
- self.focusgroup_on = -1
- self.pastegroup_on = -1
- self.undo_label = "never"
-
- def updatemenubar(self):
- changed = 0
- on = (self.active <> None)
- if on <> self.windowgroup_on:
- for m in self.windowgroup:
- m.enable(on)
- self.windowgroup_on = on
- changed = 1
- if on:
- # only if we have an edit menu
- on = self.active.have_selection()
- if on <> self.focusgroup_on:
- for m in self.focusgroup:
- m.enable(on)
- self.focusgroup_on = on
- changed = 1
- on = self.active.can_paste()
- if on <> self.pastegroup_on:
- self.pasteitem.enable(on)
- self.pastegroup_on = on
- changed = 1
- on = self.active.can_undo()
- if on <> self.undo_label:
- if on:
- self.undoitem.enable(1)
- self.undoitem.settext(on)
- self.undo_label = on
- else:
- self.undoitem.settext("Nothing to undo")
- self.undoitem.enable(0)
- changed = 1
- if changed:
- DrawMenuBar()
-
- #
- # Apple menu
- #
-
- def do_about(self, id, item, window, event):
- EasyDialogs.Message("A simple single-font text editor based on WASTE")
-
- #
- # File menu
- #
-
- def open(self, *args):
- self._open(0)
-
- def openfile(self, *args):
- self._open(1)
-
- def _open(self, askfile):
- if askfile:
- path = EasyDialogs.AskFileForOpen(typeList=('TEXT',))
- if not path:
- return
- name = os.path.split(path)[-1]
- try:
- fp = open(path, 'rb') # NOTE binary, we need cr as end-of-line
- data = fp.read()
- fp.close()
- except IOError, arg:
- EasyDialogs.Message("IOERROR: %r" % (arg,))
- return
- else:
- path = None
- name = "Untitled %d"%self.num
- data = ''
- w = WasteWindow(self)
- w.open(path, name, data)
- self.num = self.num + 1
-
- def closewin(self, *args):
- if self.active:
- self.active.close()
- else:
- EasyDialogs.Message("No active window?")
-
- def save(self, *args):
- if self.active:
- self.active.menu_save()
- else:
- EasyDialogs.Message("No active window?")
-
- def saveas(self, *args):
- if self.active:
- self.active.menu_save_as()
- else:
- EasyDialogs.Message("No active window?")
-
-
- def quit(self, *args):
- for w in self._windows.values():
- w.close()
- if self._windows:
- return
- self._quit()
-
- #
- # Edit menu
- #
-
- def undo(self, *args):
- if self.active:
- self.active.menu_undo()
- else:
- EasyDialogs.Message("No active window?")
-
- def cut(self, *args):
- if self.active:
- self.active.menu_cut()
- else:
- EasyDialogs.Message("No active window?")
-
- def copy(self, *args):
- if self.active:
- self.active.menu_copy()
- else:
- EasyDialogs.Message("No active window?")
-
- def paste(self, *args):
- if self.active:
- self.active.menu_paste()
- else:
- EasyDialogs.Message("No active window?")
-
- def clear(self, *args):
- if self.active:
- self.active.menu_clear()
- else:
- EasyDialogs.Message("No active window?")
-
- #
- # Other stuff
- #
-
- def idle(self, event):
- if self.active:
- self.active.do_idle(event)
- else:
- Qd.SetCursor(Qd.GetQDGlobalsArrow())
-
-def main():
- App = Wed()
- App.mainloop()
-
-if __name__ == '__main__':
- main()
diff --git a/Mac/OSX/Extras.ReadMe.txt b/Mac/Extras.ReadMe.txt
index 2d7fd42ac6..2d7fd42ac6 100644
--- a/Mac/OSX/Extras.ReadMe.txt
+++ b/Mac/Extras.ReadMe.txt
diff --git a/Mac/OSX/Extras.install.py b/Mac/Extras.install.py
index ce00af3821..ce00af3821 100644
--- a/Mac/OSX/Extras.install.py
+++ b/Mac/Extras.install.py
diff --git a/Mac/OSX/IDLE/Info.plist b/Mac/IDLE/Info.plist.in
index bbe2ea1182..58e913c569 100644
--- a/Mac/OSX/IDLE/Info.plist
+++ b/Mac/IDLE/Info.plist.in
@@ -36,7 +36,7 @@
<key>CFBundleExecutable</key>
<string>IDLE</string>
<key>CFBundleGetInfoString</key>
- <string>2.5, © 001-2006 Python Software Foundation</string>
+ <string>%VERSION%, © 001-2006 Python Software Foundation</string>
<key>CFBundleIconFile</key>
<string>IDLE.icns</string>
<key>CFBundleIdentifier</key>
@@ -48,8 +48,8 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>2.5</string>
+ <string>%VERSION%</string>
<key>CFBundleVersion</key>
- <string>2.5</string>
+ <string>%VERSION%</string>
</dict>
</plist>
diff --git a/Mac/OSX/IDLE/Makefile.in b/Mac/IDLE/Makefile.in
index a96e7eff52..2f63892a07 100644
--- a/Mac/OSX/IDLE/Makefile.in
+++ b/Mac/IDLE/Makefile.in
@@ -8,28 +8,30 @@ LDFLAGS=@LDFLAGS@
srcdir= @srcdir@
VERSION= @VERSION@
UNIVERSALSDK=@UNIVERSALSDK@
-builddir= ../../..
+builddir= ../..
RUNSHARED= @RUNSHARED@
BUILDEXE= @BUILDEXEEXT@
-BUILDPYTHON= ../../../python$(BUILDEXE)
+BUILDPYTHON= $(builddir)/python$(BUILDEXE)
# Deployment target selected during configure, to be checked
# by distutils
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
-BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
+BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
all: IDLE.app
-install: IDLE.app
+install: IDLE.app $(srcdir)/config-main.def $(srcdir)/config-extensions.def
test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
-test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
cp -PR IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)"
touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
+ cp $(srcdir)/config-main.def "$(DESTDIR)$(prefix)/lib/python$(VERSION)/idlelib/config-main.def"
+ cp $(srcdir)/config-extensions.def "$(DESTDIR)$(prefix)/lib/python$(VERSION)/idlelib/config-extensions.def"
clean:
rm -rf IDLE.app
@@ -37,16 +39,21 @@ clean:
IDLE.app: \
$(srcdir)/../Icons/IDLE.icns $(srcdir)/idlemain.py \
$(srcdir)/../Icons/PythonSource.icns \
- $(srcdir)/../Icons/PythonCompiled.icns
+ $(srcdir)/../Icons/PythonCompiled.icns Info.plist
rm -fr IDLE.app
$(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
--builddir=. \
--name=IDLE \
--link-exec \
- --plist=$(srcdir)/Info.plist \
+ --plist=Info.plist \
--mainprogram=$(srcdir)/idlemain.py \
--iconfile=$(srcdir)/../Icons/IDLE.icns \
--resource=$(srcdir)/../Icons/PythonSource.icns \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
build
+
+
+Info.plist: $(srcdir)/Info.plist.in
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
+
diff --git a/Mac/IDLE/config-extensions.def b/Mac/IDLE/config-extensions.def
new file mode 100644
index 0000000000..c17f068e2d
--- /dev/null
+++ b/Mac/IDLE/config-extensions.def
@@ -0,0 +1,88 @@
+# config-extensions.def
+#
+# IDLE reads several config files to determine user preferences. This
+# file is the default configuration file for IDLE extensions settings.
+#
+# Each extension must have at least one section, named after the extension
+# module. This section must contain an 'enable' item (=1 to enable the
+# extension, =0 to disable it), it may contain 'enable_editor' or 'enable_shell'
+# items, to apply it only to editor/shell windows, and may also contain any
+# other general configuration items for the extension.
+#
+# Each extension must define at least one section named ExtensionName_bindings
+# or ExtensionName_cfgBindings. If present, ExtensionName_bindings defines
+# virtual event bindings for the extension that are not user re-configurable.
+# If present, ExtensionName_cfgBindings defines virtual event bindings for the
+# extension that may be sensibly re-configured.
+#
+# If there are no keybindings for a menus' virtual events, include lines like
+# <<toggle-code-context>>= (See [CodeContext], below.)
+#
+# Currently it is necessary to manually modify this file to change extension
+# key bindings and default values. To customize, create
+# ~/.idlerc/config-extensions.cfg and append the appropriate customized
+# section(s). Those sections will override the defaults in this file.
+#
+# Note: If a keybinding is already in use when the extension is
+# loaded, the extension's virtual event's keybinding will be set to ''.
+#
+# See config-keys.def for notes on specifying keys and extend.txt for
+# information on creating IDLE extensions.
+
+[FormatParagraph]
+enable=1
+[FormatParagraph_cfgBindings]
+format-paragraph=<Option-Key-q>
+
+[AutoExpand]
+enable=1
+[AutoExpand_cfgBindings]
+expand-word=<Option-Key-slash>
+
+[ZoomHeight]
+enable=1
+[ZoomHeight_cfgBindings]
+zoom-height=<Option-Key-0>
+
+[ScriptBinding]
+enable=1
+[ScriptBinding_cfgBindings]
+run-module=<Key-F5>
+check-module=<Option-Key-x>
+
+[CallTips]
+enable=1
+[CallTips_cfgBindings]
+force-open-calltip=<Control-Key-backslash>
+[CallTips_bindings]
+try-open-calltip=<KeyRelease-parenleft>
+refresh-calltip=<KeyRelease-parenright> <KeyRelease-0>
+
+[ParenMatch]
+enable=1
+style= expression
+flash-delay= 500
+bell= 1
+[ParenMatch_cfgBindings]
+flash-paren=<Control-Key-0>
+[ParenMatch_bindings]
+paren-closed=<KeyRelease-parenright> <KeyRelease-bracketright> <KeyRelease-braceright>
+
+[AutoComplete]
+enable=1
+popupwait=2000
+[AutoComplete_cfgBindings]
+force-open-completions=<Control-Key-space>
+[AutoComplete_bindings]
+autocomplete=<Key-Tab>
+try-open-completions=<KeyRelease-period> <KeyRelease-slash> <KeyRelease-backslash>
+
+[CodeContext]
+enable=1
+enable_shell=0
+numlines=3
+visible=0
+bgcolor=LightGray
+fgcolor=Black
+[CodeContext_bindings]
+toggle-code-context=
diff --git a/Mac/IDLE/config-main.def b/Mac/IDLE/config-main.def
new file mode 100644
index 0000000000..1cdc0c541d
--- /dev/null
+++ b/Mac/IDLE/config-main.def
@@ -0,0 +1,79 @@
+# IDLE reads several config files to determine user preferences. This
+# file is the default config file for general idle settings.
+#
+# When IDLE starts, it will look in
+# the following two sets of files, in order:
+#
+# default configuration
+# ---------------------
+# config-main.def the default general config file
+# config-extensions.def the default extension config file
+# config-highlight.def the default highlighting config file
+# config-keys.def the default keybinding config file
+#
+# user configuration
+# -------------------
+# ~/.idlerc/config-main.cfg the user general config file
+# ~/.idlerc/config-extensions.cfg the user extension config file
+# ~/.idlerc/config-highlight.cfg the user highlighting config file
+# ~/.idlerc/config-keys.cfg the user keybinding config file
+#
+# On Windows2000 and Windows XP the .idlerc directory is at
+# Documents and Settings\<username>\.idlerc
+#
+# On Windows98 it is at c:\.idlerc
+#
+# Any options the user saves through the config dialog will be saved to
+# the relevant user config file. Reverting any general setting to the
+# default causes that entry to be wiped from the user file and re-read
+# from the default file. User highlighting themes or keybinding sets are
+# retained unless specifically deleted within the config dialog. Choosing
+# one of the default themes or keysets just applies the relevant settings
+# from the default file.
+#
+# Additional help sources are listed in the [HelpFiles] section and must be
+# viewable by a web browser (or the Windows Help viewer in the case of .chm
+# files). These sources will be listed on the Help menu. The pattern is
+# <sequence_number = menu item;/path/to/help/source>
+# You can't use a semi-colon in a menu item or path. The path will be platform
+# specific because of path separators, drive specs etc.
+#
+# It is best to use the Configuration GUI to set up additional help sources!
+# Example:
+#1 = My Extra Help Source;/usr/share/doc/foo/index.html
+#2 = Another Help Source;/path/to/another.pdf
+
+[General]
+editor-on-startup= 0
+autosave= 0
+print-command-posix=lpr %s
+print-command-win=start /min notepad /p %s
+delete-exitfunc= 1
+
+[EditorWindow]
+width= 80
+height= 40
+font= courier
+font-size= 10
+font-bold= 0
+encoding= none
+
+[FormatParagraph]
+paragraph=70
+
+[Indent]
+use-spaces= 1
+num-spaces= 4
+
+[Theme]
+default= 1
+name= IDLE Classic
+
+[Keys]
+default= 1
+name= IDLE Classic Mac
+
+[History]
+cyclic=1
+
+[HelpFiles]
diff --git a/Mac/OSX/IDLE/idlemain.py b/Mac/IDLE/idlemain.py
index aa75d4cb15..aa75d4cb15 100644
--- a/Mac/OSX/IDLE/idlemain.py
+++ b/Mac/IDLE/idlemain.py
diff --git a/Mac/OSX/Icons/Disk Image.icns b/Mac/Icons/Disk Image.icns
index 35f16bf6e5..35f16bf6e5 100644
--- a/Mac/OSX/Icons/Disk Image.icns
+++ b/Mac/Icons/Disk Image.icns
Binary files differ
diff --git a/Mac/OSX/Icons/IDLE.icns b/Mac/Icons/IDLE.icns
index c12c9da52a..c12c9da52a 100644
--- a/Mac/OSX/Icons/IDLE.icns
+++ b/Mac/Icons/IDLE.icns
Binary files differ
diff --git a/Mac/OSX/Icons/Python Folder.icns b/Mac/Icons/Python Folder.icns
index ae766ee158..ae766ee158 100644
--- a/Mac/OSX/Icons/Python Folder.icns
+++ b/Mac/Icons/Python Folder.icns
Binary files differ
diff --git a/Mac/OSX/Icons/PythonCompiled.icns b/Mac/Icons/PythonCompiled.icns
index 7d9f3202c7..7d9f3202c7 100644
--- a/Mac/OSX/Icons/PythonCompiled.icns
+++ b/Mac/Icons/PythonCompiled.icns
Binary files differ
diff --git a/Mac/OSX/Icons/PythonLauncher.icns b/Mac/Icons/PythonLauncher.icns
index e09fd381e4..e09fd381e4 100644
--- a/Mac/OSX/Icons/PythonLauncher.icns
+++ b/Mac/Icons/PythonLauncher.icns
Binary files differ
diff --git a/Mac/OSX/Icons/PythonSource.icns b/Mac/Icons/PythonSource.icns
index 9e35c1ecbe..9e35c1ecbe 100644
--- a/Mac/OSX/Icons/PythonSource.icns
+++ b/Mac/Icons/PythonSource.icns
Binary files differ
diff --git a/Mac/OSX/Icons/ReadMe.txt b/Mac/Icons/ReadMe.txt
index 226836abd7..226836abd7 100644
--- a/Mac/OSX/Icons/ReadMe.txt
+++ b/Mac/Icons/ReadMe.txt
diff --git a/Mac/OSX/Makefile.in b/Mac/Makefile.in
index a44191d055..82514b2fb2 100644
--- a/Mac/OSX/Makefile.in
+++ b/Mac/Makefile.in
@@ -3,23 +3,23 @@
# commandline in that case.
VERSION=@VERSION@
-builddir = ../..
-srcdir = @srcdir@
+builddir = ..
+srcdir=@srcdir@
prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
LIBDEST=$(prefix)/lib/python$(VERSION)
-BUILDPYTHON=$(builddir)/python.exe
+RUNSHARED=@RUNSHARED@
+BUILDEXE=@BUILDEXEEXT@
+BUILDPYTHON=$(builddir)/python$(BUILDEXE)
DESTDIR=
+LDFLAGS=@LDFLAGS@
+FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
# These are normally glimpsed from the previous set
-bindir=@exec_prefix@/bin
+bindir=$(prefix)/bin
PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
APPINSTALLDIR=$(prefix)/Resources/Python.app
# Variables for installing the "normal" unix binaries
-INSTALLED_PYDOC=$(prefix)/bin/pydoc
-INSTALLED_IDLE=$(prefix)/bin/idle
-INSTALLED_PYTHON=$(prefix)/bin/python
-INSTALLED_PYTHONW=$(prefix)/bin/pythonw
INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/Python
# Items more-or-less copied from the main Makefile
@@ -34,15 +34,15 @@ LN=@LN@
STRIPFLAG=-s
CPMAC=/Developer/Tools/CpMac
-APPTEMPLATE=$(srcdir)/../OSXResources/app
+APPTEMPLATE=$(srcdir)/Resources/app
APPSUBDIRS=MacOS Resources Resources/English.lproj \
Resources/English.lproj/Documentation \
Resources/English.lproj/Documentation/doc \
Resources/English.lproj/Documentation/ide
-DOCDIR=$(srcdir)/../OSXResources/app/Resources/English.lproj/Documentation
+DOCDIR=$(srcdir)/Resources/app/Resources/English.lproj/Documentation
DOCINDEX=$(DOCDIR)/"Documentation idx"
-CACHERSRC=$(srcdir)/../scripts/cachersrc.py
-compileall=$(srcdir)/../../Lib/compileall.py
+CACHERSRC=$(srcdir)/scripts/cachersrc.py
+compileall=$(srcdir)/../Lib/compileall.py
installapps: install_Python install_BuildApplet install_PythonLauncher \
install_IDLE checkapplepython install_pythonw install_versionedtools
@@ -58,14 +58,30 @@ install_pythonw: pythonw
# actual installation inside the framework.
#
installunixtools:
- if [ ! -d "$(DESTDIR)/usr/local/bin" ]; then \
- $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)/usr/local/bin" ;\
+ if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
+ $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
fi
- for fn in `ls "$(DESTDIR)$(prefix)/bin/"` ; \
+ for fn in python pythonw idle pydoc python-config smtpd.py \
+ python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
+ pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
do \
- ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)/usr/local/bin/$${fn}" ;\
+ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
+#
+# Like installunixtools, but only install links to the versioned binaries.
+#
+altinstallunixtools:
+ if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \
+ $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
+ fi
+ for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
+ pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
+ do \
+ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
+ done
+
+
# By default most tools are installed without a version in their basename, to
# make it easier to install (and use) several python versions side-by-side move
# the tools to a version-specific name and add the non-versioned name as an
@@ -145,11 +161,11 @@ install_IDLE:
cd IDLE && make install
install_BuildApplet:
- $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \
+ $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
--destroot "$(DESTDIR)" \
--python $(INSTALLED_PYTHONAPP) \
--output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
- $(srcdir)/../scripts/BuildApplet.py
+ $(srcdir)/scripts/BuildApplet.py
MACLIBDEST=$(LIBDEST)/plat-mac
MACTOOLSDEST=$(prefix)/Mac/Tools
@@ -207,29 +223,25 @@ installmacsubtree:
done
- $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
- $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
- $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
-
-#
-# We use the full name here in stead of $(INSTALLED_PYTHONAPP), because
-# the latter may be overridden by Makefile.jaguar when building for a pre-installed
-$(INSTALLED_PYTHONAPP)/Contents/MacOS/Python: install_Python
+ $(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
+ $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
+ $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
-# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
-# At least this rule will give an error if it doesn't exist.
+$(INSTALLED_PYTHONAPP): install_Python
-installextras:
+installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
$(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
- $(INSTALL) $(srcdir)/Mac/OSX/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
- $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Demo \
+ $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
+ $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
"$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
+ $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
+ "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
-checkapplepython:
- @if ! $(BUILDPYTHON) $(srcdir)/fixapplepython23.py -n; then \
+checkapplepython: $(srcdir)/Tools/fixapplepython23.py
+ @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
- echo "* WARNING: Run $(srcdir)/fixapplepython23.py with \"sudo\" to fix this."; \
+ echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
fi
@@ -237,5 +249,3 @@ clean:
rm pythonw
cd PythonLauncher && make clean
cd IDLE && make clean
-
-
diff --git a/Mac/Modules/waste/wastemodule.c b/Mac/Modules/waste/wastemodule.c
deleted file mode 100644
index b8234f0ce2..0000000000
--- a/Mac/Modules/waste/wastemodule.c
+++ /dev/null
@@ -1,2596 +0,0 @@
-
-/* ========================== Module waste ========================== */
-
-#include "Python.h"
-
-
-
-#include "pymactoolbox.h"
-
-/* Macro to test whether a weak-loaded CFM function exists */
-#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
- PyErr_SetString(PyExc_NotImplementedError, \
- "Not available in this shared library/OS version"); \
- return NULL; \
- }} while(0)
-
-
-#include <WASTE.h>
-#include <WEObjectHandlers.h>
-#include <WETabs.h>
-
-/* Exported by Qdmodule.c: */
-extern PyObject *QdRGB_New(RGBColor *);
-extern int QdRGB_Convert(PyObject *, RGBColor *);
-
-/* Exported by AEModule.c: */
-extern PyObject *AEDesc_New(AppleEvent *);
-extern int AEDesc_Convert(PyObject *, AppleEvent *);
-
-/* Forward declaration */
-static PyObject *WEOObj_New(WEObjectReference);
-static PyObject *ExistingwasteObj_New(WEReference);
-
-/*
-** Parse/generate TextStyle records
-*/
-static PyObject *
-TextStyle_New(TextStylePtr itself)
-{
-
- return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
- &itself->tsColor);
-}
-
-static int
-TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
-{
- long font, face, size;
-
- if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
- return 0;
- p_itself->tsFont = (short)font;
- p_itself->tsFace = (Style)face;
- p_itself->tsSize = (short)size;
- return 1;
-}
-
-/*
-** Parse/generate RunInfo records
-*/
-static PyObject *
-RunInfo_New(WERunInfo *itself)
-{
-
- return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
- itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
-}
-
-/* Conversion of long points and rects */
-int
-LongRect_Convert(PyObject *v, LongRect *r)
-{
- return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
-}
-
-PyObject *
-LongRect_New(LongRect *r)
-{
- return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
-}
-
-int
-LongPt_Convert(PyObject *v, LongPt *p)
-{
- return PyArg_Parse(v, "(ll)", &p->h, &p->v);
-}
-
-PyObject *
-LongPt_New(LongPt *p)
-{
- return Py_BuildValue("(ll)", p->h, p->v);
-}
-
-/* Stuff for the callbacks: */
-static PyObject *callbackdict;
-WENewObjectUPP upp_new_handler;
-WEDisposeObjectUPP upp_dispose_handler;
-WEDrawObjectUPP upp_draw_handler;
-WEClickObjectUPP upp_click_handler;
-
-static OSErr
-any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
-{
- FlavorType tp;
- PyObject *key, *func;
-
- if ( args == NULL ) return errAECorruptData;
-
- tp = WEGetObjectType(who);
-
- if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
- return errAECorruptData;
- if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
- Py_DECREF(key);
- return errAEHandlerNotFound;
- }
- Py_INCREF(func);
- *rv = PyEval_CallObject(func, args);
- Py_DECREF(func);
- Py_DECREF(key);
- if ( *rv == NULL ) {
- PySys_WriteStderr("--Exception in callback: ");
- PyErr_Print();
- return errAEReplyNotArrived;
- }
- return 0;
-}
-
-static pascal OSErr
-my_new_handler(Point *objectSize, WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- OSErr err;
-
- args=Py_BuildValue("(O&)", WEOObj_New, objref);
- err = any_handler(weNewHandler, objref, args, &rv);
- if (!err) {
- if (!PyMac_GetPoint(rv, objectSize) )
- err = errAECoercionFail;
- }
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return err;
-}
-
-static pascal OSErr
-my_dispose_handler(WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- OSErr err;
-
- args=Py_BuildValue("(O&)", WEOObj_New, objref);
- err = any_handler(weDisposeHandler, objref, args, &rv);
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return err;
-}
-
-static pascal OSErr
-my_draw_handler(const Rect *destRect, WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- OSErr err;
-
- args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
- err = any_handler(weDrawHandler, objref, args, &rv);
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return err;
-}
-
-static pascal Boolean
-my_click_handler(Point hitPt, EventModifiers modifiers,
- unsigned long clickTime, WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- int retvalue;
- OSErr err;
-
- args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
- (long)modifiers, (long)clickTime, WEOObj_New, objref);
- err = any_handler(weClickHandler, objref, args, &rv);
- if (!err)
- retvalue = PyInt_AsLong(rv);
- else
- retvalue = 0;
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return retvalue;
-}
-
-
-
-static PyObject *waste_Error;
-
-/* ------------------------ Object type WEO ------------------------- */
-
-PyTypeObject WEO_Type;
-
-#define WEOObj_Check(x) ((x)->ob_type == &WEO_Type || PyObject_TypeCheck((x), &WEO_Type))
-
-typedef struct WEOObject {
- PyObject_HEAD
- WEObjectReference ob_itself;
-} WEOObject;
-
-PyObject *WEOObj_New(WEObjectReference itself)
-{
- WEOObject *it;
- if (itself == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
- }
- it = PyObject_NEW(WEOObject, &WEO_Type);
- if (it == NULL) return NULL;
- it->ob_itself = itself;
- return (PyObject *)it;
-}
-
-int WEOObj_Convert(PyObject *v, WEObjectReference *p_itself)
-{
- if (!WEOObj_Check(v))
- {
- PyErr_SetString(PyExc_TypeError, "WEO required");
- return 0;
- }
- *p_itself = ((WEOObject *)v)->ob_itself;
- return 1;
-}
-
-static void WEOObj_dealloc(WEOObject *self)
-{
- /* Cleanup of self->ob_itself goes here */
- self->ob_type->tp_free((PyObject *)self);
-}
-
-static PyObject *WEOObj_WEGetObjectType(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- FlavorType _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetObjectType(_self->ob_itself);
- _res = Py_BuildValue("O&",
- PyMac_BuildOSType, _rv);
- return _res;
-}
-
-static PyObject *WEOObj_WEGetObjectDataHandle(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Handle _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetObjectDataHandle(_self->ob_itself);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *WEOObj_WEGetObjectOwner(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- WEReference _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetObjectOwner(_self->ob_itself);
- _res = Py_BuildValue("O&",
- ExistingwasteObj_New, _rv);
- return _res;
-}
-
-static PyObject *WEOObj_WEGetObjectOffset(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetObjectOffset(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *WEOObj_WEGetObjectSize(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Point _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetObjectSize(_self->ob_itself);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, _rv);
- return _res;
-}
-
-static PyObject *WEOObj_WESetObjectSize(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- Point inObjectSize;
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &inObjectSize))
- return NULL;
- _err = WESetObjectSize(_self->ob_itself,
- inObjectSize);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *WEOObj_WEGetObjectFrame(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- LongRect outObjectFrame;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEGetObjectFrame(_self->ob_itself,
- &outObjectFrame);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- LongRect_New, &outObjectFrame);
- return _res;
-}
-
-static PyObject *WEOObj_WEGetObjectRefCon(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetObjectRefCon(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *WEOObj_WESetObjectRefCon(WEOObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inRefCon;
- if (!PyArg_ParseTuple(_args, "l",
- &inRefCon))
- return NULL;
- WESetObjectRefCon(_self->ob_itself,
- inRefCon);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyMethodDef WEOObj_methods[] = {
- {"WEGetObjectType", (PyCFunction)WEOObj_WEGetObjectType, 1,
- PyDoc_STR("() -> (FlavorType _rv)")},
- {"WEGetObjectDataHandle", (PyCFunction)WEOObj_WEGetObjectDataHandle, 1,
- PyDoc_STR("() -> (Handle _rv)")},
- {"WEGetObjectOwner", (PyCFunction)WEOObj_WEGetObjectOwner, 1,
- PyDoc_STR("() -> (WEReference _rv)")},
- {"WEGetObjectOffset", (PyCFunction)WEOObj_WEGetObjectOffset, 1,
- PyDoc_STR("() -> (SInt32 _rv)")},
- {"WEGetObjectSize", (PyCFunction)WEOObj_WEGetObjectSize, 1,
- PyDoc_STR("() -> (Point _rv)")},
- {"WESetObjectSize", (PyCFunction)WEOObj_WESetObjectSize, 1,
- PyDoc_STR("(Point inObjectSize) -> None")},
- {"WEGetObjectFrame", (PyCFunction)WEOObj_WEGetObjectFrame, 1,
- PyDoc_STR("() -> (LongRect outObjectFrame)")},
- {"WEGetObjectRefCon", (PyCFunction)WEOObj_WEGetObjectRefCon, 1,
- PyDoc_STR("() -> (SInt32 _rv)")},
- {"WESetObjectRefCon", (PyCFunction)WEOObj_WESetObjectRefCon, 1,
- PyDoc_STR("(SInt32 inRefCon) -> None")},
- {NULL, NULL, 0}
-};
-
-#define WEOObj_getsetlist NULL
-
-
-#define WEOObj_compare NULL
-
-#define WEOObj_repr NULL
-
-#define WEOObj_hash NULL
-#define WEOObj_tp_init 0
-
-#define WEOObj_tp_alloc PyType_GenericAlloc
-
-static PyObject *WEOObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
-{
- PyObject *_self;
- WEObjectReference itself;
- char *kw[] = {"itself", 0};
-
- if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, WEOObj_Convert, &itself)) return NULL;
- if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
- ((WEOObject *)_self)->ob_itself = itself;
- return _self;
-}
-
-#define WEOObj_tp_free PyObject_Del
-
-
-PyTypeObject WEO_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "waste.WEO", /*tp_name*/
- sizeof(WEOObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor) WEOObj_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc)0, /*tp_getattr*/
- (setattrfunc)0, /*tp_setattr*/
- (cmpfunc) WEOObj_compare, /*tp_compare*/
- (reprfunc) WEOObj_repr, /*tp_repr*/
- (PyNumberMethods *)0, /* tp_as_number */
- (PySequenceMethods *)0, /* tp_as_sequence */
- (PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) WEOObj_hash, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- PyObject_GenericGetAttr, /*tp_getattro*/
- PyObject_GenericSetAttr, /*tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
- 0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- WEOObj_methods, /* tp_methods */
- 0, /*tp_members*/
- WEOObj_getsetlist, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- WEOObj_tp_init, /* tp_init */
- WEOObj_tp_alloc, /* tp_alloc */
- WEOObj_tp_new, /* tp_new */
- WEOObj_tp_free, /* tp_free */
-};
-
-/* ---------------------- End object type WEO ----------------------- */
-
-
-/* ----------------------- Object type waste ------------------------ */
-
-PyTypeObject waste_Type;
-
-#define wasteObj_Check(x) ((x)->ob_type == &waste_Type || PyObject_TypeCheck((x), &waste_Type))
-
-typedef struct wasteObject {
- PyObject_HEAD
- WEReference ob_itself;
-} wasteObject;
-
-PyObject *wasteObj_New(WEReference itself)
-{
- wasteObject *it;
- if (itself == NULL) {
- PyErr_SetString(waste_Error,"Cannot create null WE");
- return NULL;
- }
- it = PyObject_NEW(wasteObject, &waste_Type);
- if (it == NULL) return NULL;
- it->ob_itself = itself;
- WESetInfo(weRefCon, (void *)&it, itself);
- return (PyObject *)it;
-}
-
-int wasteObj_Convert(PyObject *v, WEReference *p_itself)
-{
- if (!wasteObj_Check(v))
- {
- PyErr_SetString(PyExc_TypeError, "waste required");
- return 0;
- }
- *p_itself = ((wasteObject *)v)->ob_itself;
- return 1;
-}
-
-static void wasteObj_dealloc(wasteObject *self)
-{
- WEDispose(self->ob_itself);
- self->ob_type->tp_free((PyObject *)self);
-}
-
-static PyObject *wasteObj_WEGetText(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Handle _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetText(_self->ob_itself);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetChar(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt16 _rv;
- SInt32 inOffset;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WEGetChar(inOffset,
- _self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetTextLength(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetTextLength(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetSelection(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 outSelStart;
- SInt32 outSelEnd;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEGetSelection(&outSelStart,
- &outSelEnd,
- _self->ob_itself);
- _res = Py_BuildValue("ll",
- outSelStart,
- outSelEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetDestRect(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongRect outDestRect;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEGetDestRect(&outDestRect,
- _self->ob_itself);
- _res = Py_BuildValue("O&",
- LongRect_New, &outDestRect);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetViewRect(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongRect outViewRect;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEGetViewRect(&outViewRect,
- _self->ob_itself);
- _res = Py_BuildValue("O&",
- LongRect_New, &outViewRect);
- return _res;
-}
-
-static PyObject *wasteObj_WEIsActive(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEIsActive(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetClickCount(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- UInt16 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetClickCount(_self->ob_itself);
- _res = Py_BuildValue("H",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WESetSelection(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inSelStart;
- SInt32 inSelEnd;
- if (!PyArg_ParseTuple(_args, "ll",
- &inSelStart,
- &inSelEnd))
- return NULL;
- WESetSelection(inSelStart,
- inSelEnd,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WESetDestRect(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongRect inDestRect;
- if (!PyArg_ParseTuple(_args, "O&",
- LongRect_Convert, &inDestRect))
- return NULL;
- WESetDestRect(&inDestRect,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WESetViewRect(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongRect inViewRect;
- if (!PyArg_ParseTuple(_args, "O&",
- LongRect_Convert, &inViewRect))
- return NULL;
- WESetViewRect(&inViewRect,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEContinuousStyle(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- WEStyleMode ioMode;
- TextStyle outTextStyle;
- if (!PyArg_ParseTuple(_args, "H",
- &ioMode))
- return NULL;
- _rv = WEContinuousStyle(&ioMode,
- &outTextStyle,
- _self->ob_itself);
- _res = Py_BuildValue("bHO&",
- _rv,
- ioMode,
- TextStyle_New, &outTextStyle);
- return _res;
-}
-
-static PyObject *wasteObj_WECountRuns(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WECountRuns(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEOffsetToRun(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- SInt32 inOffset;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WEOffsetToRun(inOffset,
- _self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetRunRange(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inStyleRunIndex;
- SInt32 outStyleRunStart;
- SInt32 outStyleRunEnd;
- if (!PyArg_ParseTuple(_args, "l",
- &inStyleRunIndex))
- return NULL;
- WEGetRunRange(inStyleRunIndex,
- &outStyleRunStart,
- &outStyleRunEnd,
- _self->ob_itself);
- _res = Py_BuildValue("ll",
- outStyleRunStart,
- outStyleRunEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetRunInfo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inOffset;
- WERunInfo outStyleRunInfo;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- WEGetRunInfo(inOffset,
- &outStyleRunInfo,
- _self->ob_itself);
- _res = Py_BuildValue("O&",
- RunInfo_New, &outStyleRunInfo);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetIndRunInfo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inStyleRunIndex;
- WERunInfo outStyleRunInfo;
- if (!PyArg_ParseTuple(_args, "l",
- &inStyleRunIndex))
- return NULL;
- WEGetIndRunInfo(inStyleRunIndex,
- &outStyleRunInfo,
- _self->ob_itself);
- _res = Py_BuildValue("O&",
- RunInfo_New, &outStyleRunInfo);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetRunDirection(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- SInt32 inOffset;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WEGetRunDirection(inOffset,
- _self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WECountParaRuns(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WECountParaRuns(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEOffsetToParaRun(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- SInt32 inOffset;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WEOffsetToParaRun(inOffset,
- _self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetParaRunRange(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inParagraphRunIndex;
- SInt32 outParagraphRunStart;
- SInt32 outParagraphRunEnd;
- if (!PyArg_ParseTuple(_args, "l",
- &inParagraphRunIndex))
- return NULL;
- WEGetParaRunRange(inParagraphRunIndex,
- &outParagraphRunStart,
- &outParagraphRunEnd,
- _self->ob_itself);
- _res = Py_BuildValue("ll",
- outParagraphRunStart,
- outParagraphRunEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WECountLines(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WECountLines(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEOffsetToLine(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- SInt32 inOffset;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WEOffsetToLine(inOffset,
- _self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetLineRange(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inLineIndex;
- SInt32 outLineStart;
- SInt32 outLineEnd;
- if (!PyArg_ParseTuple(_args, "l",
- &inLineIndex))
- return NULL;
- WEGetLineRange(inLineIndex,
- &outLineStart,
- &outLineEnd,
- _self->ob_itself);
- _res = Py_BuildValue("ll",
- outLineStart,
- outLineEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetHeight(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- SInt32 inStartLineIndex;
- SInt32 inEndLineIndex;
- if (!PyArg_ParseTuple(_args, "ll",
- &inStartLineIndex,
- &inEndLineIndex))
- return NULL;
- _rv = WEGetHeight(inStartLineIndex,
- inEndLineIndex,
- _self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetOffset(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- LongPt inPoint;
- WEEdge outEdge;
- if (!PyArg_ParseTuple(_args, "O&",
- LongPt_Convert, &inPoint))
- return NULL;
- _rv = WEGetOffset(&inPoint,
- &outEdge,
- _self->ob_itself);
- _res = Py_BuildValue("lB",
- _rv,
- outEdge);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetPoint(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inOffset;
- SInt16 inDirection;
- LongPt outPoint;
- SInt16 outLineHeight;
- if (!PyArg_ParseTuple(_args, "lh",
- &inOffset,
- &inDirection))
- return NULL;
- WEGetPoint(inOffset,
- inDirection,
- &outPoint,
- &outLineHeight,
- _self->ob_itself);
- _res = Py_BuildValue("O&h",
- LongPt_New, &outPoint,
- outLineHeight);
- return _res;
-}
-
-static PyObject *wasteObj_WEFindWord(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inOffset;
- WEEdge inEdge;
- SInt32 outWordStart;
- SInt32 outWordEnd;
- if (!PyArg_ParseTuple(_args, "lB",
- &inOffset,
- &inEdge))
- return NULL;
- WEFindWord(inOffset,
- inEdge,
- &outWordStart,
- &outWordEnd,
- _self->ob_itself);
- _res = Py_BuildValue("ll",
- outWordStart,
- outWordEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WEFindLine(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inOffset;
- WEEdge inEdge;
- SInt32 outLineStart;
- SInt32 outLineEnd;
- if (!PyArg_ParseTuple(_args, "lB",
- &inOffset,
- &inEdge))
- return NULL;
- WEFindLine(inOffset,
- inEdge,
- &outLineStart,
- &outLineEnd,
- _self->ob_itself);
- _res = Py_BuildValue("ll",
- outLineStart,
- outLineEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WEFindParagraph(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inOffset;
- WEEdge inEdge;
- SInt32 outParagraphStart;
- SInt32 outParagraphEnd;
- if (!PyArg_ParseTuple(_args, "lB",
- &inOffset,
- &inEdge))
- return NULL;
- WEFindParagraph(inOffset,
- inEdge,
- &outParagraphStart,
- &outParagraphEnd,
- _self->ob_itself);
- _res = Py_BuildValue("ll",
- outParagraphStart,
- outParagraphEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WEFind(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- char* inKey;
- SInt32 inKeyLength;
- TextEncoding inKeyEncoding;
- OptionBits inMatchOptions;
- SInt32 inRangeStart;
- SInt32 inRangeEnd;
- SInt32 outMatchStart;
- SInt32 outMatchEnd;
- if (!PyArg_ParseTuple(_args, "slllll",
- &inKey,
- &inKeyLength,
- &inKeyEncoding,
- &inMatchOptions,
- &inRangeStart,
- &inRangeEnd))
- return NULL;
- _err = WEFind(inKey,
- inKeyLength,
- inKeyEncoding,
- inMatchOptions,
- inRangeStart,
- inRangeEnd,
- &outMatchStart,
- &outMatchEnd,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("ll",
- outMatchStart,
- outMatchEnd);
- return _res;
-}
-
-static PyObject *wasteObj_WEStreamRange(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- SInt32 inRangeStart;
- SInt32 inRangeEnd;
- FlavorType inRequestedType;
- OptionBits inStreamOptions;
- Handle outData;
- if (!PyArg_ParseTuple(_args, "llO&lO&",
- &inRangeStart,
- &inRangeEnd,
- PyMac_GetOSType, &inRequestedType,
- &inStreamOptions,
- ResObj_Convert, &outData))
- return NULL;
- _err = WEStreamRange(inRangeStart,
- inRangeEnd,
- inRequestedType,
- inStreamOptions,
- outData,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WECopyRange(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- SInt32 inRangeStart;
- SInt32 inRangeEnd;
- Handle outText;
- StScrpHandle outStyles;
- WESoupHandle outSoup;
- if (!PyArg_ParseTuple(_args, "llO&O&O&",
- &inRangeStart,
- &inRangeEnd,
- OptResObj_Convert, &outText,
- OptResObj_Convert, &outStyles,
- OptResObj_Convert, &outSoup))
- return NULL;
- _err = WECopyRange(inRangeStart,
- inRangeEnd,
- outText,
- outStyles,
- outSoup,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEGetTextRangeAsUnicode(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- SInt32 inRangeStart;
- SInt32 inRangeEnd;
- Handle outUnicodeText;
- Handle ioCharFormat;
- Handle ioParaFormat;
- TextEncodingVariant inUnicodeVariant;
- TextEncodingFormat inTransformationFormat;
- OptionBits inGetOptions;
- if (!PyArg_ParseTuple(_args, "llO&O&O&lll",
- &inRangeStart,
- &inRangeEnd,
- ResObj_Convert, &outUnicodeText,
- ResObj_Convert, &ioCharFormat,
- ResObj_Convert, &ioParaFormat,
- &inUnicodeVariant,
- &inTransformationFormat,
- &inGetOptions))
- return NULL;
- _err = WEGetTextRangeAsUnicode(inRangeStart,
- inRangeEnd,
- outUnicodeText,
- ioCharFormat,
- ioParaFormat,
- inUnicodeVariant,
- inTransformationFormat,
- inGetOptions,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEGetAlignment(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- WEAlignment _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetAlignment(_self->ob_itself);
- _res = Py_BuildValue("B",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WESetAlignment(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- WEAlignment inAlignment;
- if (!PyArg_ParseTuple(_args, "B",
- &inAlignment))
- return NULL;
- WESetAlignment(inAlignment,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEGetDirection(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- WEDirection _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetDirection(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WESetDirection(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- WEDirection inDirection;
- if (!PyArg_ParseTuple(_args, "h",
- &inDirection))
- return NULL;
- WESetDirection(inDirection,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WECalText(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WECalText(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEUpdate(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- RgnHandle inUpdateRgn;
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &inUpdateRgn))
- return NULL;
- WEUpdate(inUpdateRgn,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEScroll(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inHorizontalOffset;
- SInt32 inVerticalOffset;
- if (!PyArg_ParseTuple(_args, "ll",
- &inHorizontalOffset,
- &inVerticalOffset))
- return NULL;
- WEScroll(inHorizontalOffset,
- inVerticalOffset,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEPinScroll(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 inHorizontalOffset;
- SInt32 inVerticalOffset;
- if (!PyArg_ParseTuple(_args, "ll",
- &inHorizontalOffset,
- &inVerticalOffset))
- return NULL;
- WEPinScroll(inHorizontalOffset,
- inVerticalOffset,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WESelView(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WESelView(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEActivate(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEActivate(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEDeactivate(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEDeactivate(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEKey(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- CharParameter inKey;
- EventModifiers inModifiers;
- if (!PyArg_ParseTuple(_args, "hH",
- &inKey,
- &inModifiers))
- return NULL;
- WEKey(inKey,
- inModifiers,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEClick(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Point inHitPoint;
- EventModifiers inModifiers;
- UInt32 inClickTime;
- if (!PyArg_ParseTuple(_args, "O&Hl",
- PyMac_GetPoint, &inHitPoint,
- &inModifiers,
- &inClickTime))
- return NULL;
- WEClick(inHitPoint,
- inModifiers,
- inClickTime,
- _self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEAdjustCursor(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- Point inMouseLoc;
- RgnHandle ioMouseRgn;
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetPoint, &inMouseLoc,
- ResObj_Convert, &ioMouseRgn))
- return NULL;
- _rv = WEAdjustCursor(inMouseLoc,
- ioMouseRgn,
- _self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEIdle(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- UInt32 outMaxSleep;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEIdle(&outMaxSleep,
- _self->ob_itself);
- _res = Py_BuildValue("l",
- outMaxSleep);
- return _res;
-}
-
-static PyObject *wasteObj_WEInsert(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- char *inTextPtr__in__;
- long inTextPtr__len__;
- int inTextPtr__in_len__;
- StScrpHandle inStyles;
- WESoupHandle inSoup;
- if (!PyArg_ParseTuple(_args, "s#O&O&",
- &inTextPtr__in__, &inTextPtr__in_len__,
- OptResObj_Convert, &inStyles,
- OptResObj_Convert, &inSoup))
- return NULL;
- inTextPtr__len__ = inTextPtr__in_len__;
- _err = WEInsert(inTextPtr__in__, inTextPtr__len__,
- inStyles,
- inSoup,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEInsertFormattedText(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- char *inTextPtr__in__;
- long inTextPtr__len__;
- int inTextPtr__in_len__;
- StScrpHandle inStyles;
- WESoupHandle inSoup;
- Handle inParaFormat;
- Handle inRulerScrap;
- if (!PyArg_ParseTuple(_args, "s#O&O&O&O&",
- &inTextPtr__in__, &inTextPtr__in_len__,
- OptResObj_Convert, &inStyles,
- OptResObj_Convert, &inSoup,
- ResObj_Convert, &inParaFormat,
- ResObj_Convert, &inRulerScrap))
- return NULL;
- inTextPtr__len__ = inTextPtr__in_len__;
- _err = WEInsertFormattedText(inTextPtr__in__, inTextPtr__len__,
- inStyles,
- inSoup,
- inParaFormat,
- inRulerScrap,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEDelete(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEDelete(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEUseText(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- Handle inText;
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &inText))
- return NULL;
- _err = WEUseText(inText,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEChangeCase(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 inCase;
- if (!PyArg_ParseTuple(_args, "h",
- &inCase))
- return NULL;
- _err = WEChangeCase(inCase,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WESetOneAttribute(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- SInt32 inRangeStart;
- SInt32 inRangeEnd;
- WESelector inAttributeSelector;
- char *inAttributeValue__in__;
- long inAttributeValue__len__;
- int inAttributeValue__in_len__;
- if (!PyArg_ParseTuple(_args, "llO&s#",
- &inRangeStart,
- &inRangeEnd,
- PyMac_GetOSType, &inAttributeSelector,
- &inAttributeValue__in__, &inAttributeValue__in_len__))
- return NULL;
- inAttributeValue__len__ = inAttributeValue__in_len__;
- _err = WESetOneAttribute(inRangeStart,
- inRangeEnd,
- inAttributeSelector,
- inAttributeValue__in__, inAttributeValue__len__,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WESetStyle(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- WEStyleMode inMode;
- TextStyle inTextStyle;
- if (!PyArg_ParseTuple(_args, "HO&",
- &inMode,
- TextStyle_Convert, &inTextStyle))
- return NULL;
- _err = WESetStyle(inMode,
- &inTextStyle,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEUseStyleScrap(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- StScrpHandle inStyles;
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &inStyles))
- return NULL;
- _err = WEUseStyleScrap(inStyles,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEUndo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEUndo(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WERedo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WERedo(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEClearUndo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEClearUndo(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEGetUndoInfo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- WEActionKind _rv;
- Boolean outRedoFlag;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetUndoInfo(&outRedoFlag,
- _self->ob_itself);
- _res = Py_BuildValue("hb",
- _rv,
- outRedoFlag);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetIndUndoInfo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- WEActionKind _rv;
- SInt32 inUndoLevel;
- if (!PyArg_ParseTuple(_args, "l",
- &inUndoLevel))
- return NULL;
- _rv = WEGetIndUndoInfo(inUndoLevel,
- _self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEIsTyping(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEIsTyping(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEBeginAction(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEBeginAction(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEEndAction(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- WEActionKind inActionKind;
- if (!PyArg_ParseTuple(_args, "h",
- &inActionKind))
- return NULL;
- _err = WEEndAction(inActionKind,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEGetModCount(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- UInt32 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetModCount(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEResetModCount(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEResetModCount(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEInsertObject(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- FlavorType inObjectType;
- Handle inObjectDataHandle;
- Point inObjectSize;
- if (!PyArg_ParseTuple(_args, "O&O&O&",
- PyMac_GetOSType, &inObjectType,
- ResObj_Convert, &inObjectDataHandle,
- PyMac_GetPoint, &inObjectSize))
- return NULL;
- _err = WEInsertObject(inObjectType,
- inObjectDataHandle,
- inObjectSize,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEGetSelectedObject(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- WEObjectReference outObject;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEGetSelectedObject(&outObject,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- WEOObj_New, outObject);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetObjectAtOffset(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- SInt32 inOffset;
- WEObjectReference outObject;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _err = WEGetObjectAtOffset(inOffset,
- &outObject,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- WEOObj_New, outObject);
- return _res;
-}
-
-static PyObject *wasteObj_WEFindNextObject(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt32 _rv;
- SInt32 inOffset;
- WEObjectReference outObject;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WEFindNextObject(inOffset,
- &outObject,
- _self->ob_itself);
- _res = Py_BuildValue("lO&",
- _rv,
- WEOObj_New, outObject);
- return _res;
-}
-
-static PyObject *wasteObj_WEUseSoup(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- WESoupHandle inSoup;
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &inSoup))
- return NULL;
- _err = WEUseSoup(inSoup,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WECut(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WECut(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WECopy(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WECopy(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEPaste(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEPaste(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WECanPaste(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WECanPaste(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetHiliteRgn(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- RgnHandle _rv;
- SInt32 inRangeStart;
- SInt32 inRangeEnd;
- if (!PyArg_ParseTuple(_args, "ll",
- &inRangeStart,
- &inRangeEnd))
- return NULL;
- _rv = WEGetHiliteRgn(inRangeStart,
- inRangeEnd,
- _self->ob_itself);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WECharByte(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt16 _rv;
- SInt32 inOffset;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WECharByte(inOffset,
- _self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WECharType(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt16 _rv;
- SInt32 inOffset;
- if (!PyArg_ParseTuple(_args, "l",
- &inOffset))
- return NULL;
- _rv = WECharType(inOffset,
- _self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEStopInlineSession(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- WEStopInlineSession(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEFeatureFlag(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt16 _rv;
- SInt16 inFeature;
- SInt16 inAction;
- if (!PyArg_ParseTuple(_args, "hh",
- &inFeature,
- &inAction))
- return NULL;
- _rv = WEFeatureFlag(inFeature,
- inAction,
- _self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetUserInfo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- WESelector inUserTag;
- SInt32 outUserInfo;
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetOSType, &inUserTag))
- return NULL;
- _err = WEGetUserInfo(inUserTag,
- &outUserInfo,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outUserInfo);
- return _res;
-}
-
-static PyObject *wasteObj_WESetUserInfo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- WESelector inUserTag;
- SInt32 inUserInfo;
- if (!PyArg_ParseTuple(_args, "O&l",
- PyMac_GetOSType, &inUserTag,
- &inUserInfo))
- return NULL;
- _err = WESetUserInfo(inUserTag,
- inUserInfo,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WERemoveUserInfo(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- WESelector inUserTag;
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetOSType, &inUserTag))
- return NULL;
- _err = WERemoveUserInfo(inUserTag,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEInstallTabHooks(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEInstallTabHooks(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WERemoveTabHooks(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WERemoveTabHooks(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *wasteObj_WEIsTabHooks(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEIsTabHooks(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WEGetTabSize(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- SInt16 _rv;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = WEGetTabSize(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
-}
-
-static PyObject *wasteObj_WESetTabSize(wasteObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 tabWidth;
- if (!PyArg_ParseTuple(_args, "h",
- &tabWidth))
- return NULL;
- _err = WESetTabSize(tabWidth,
- _self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyMethodDef wasteObj_methods[] = {
- {"WEGetText", (PyCFunction)wasteObj_WEGetText, 1,
- PyDoc_STR("() -> (Handle _rv)")},
- {"WEGetChar", (PyCFunction)wasteObj_WEGetChar, 1,
- PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
- {"WEGetTextLength", (PyCFunction)wasteObj_WEGetTextLength, 1,
- PyDoc_STR("() -> (SInt32 _rv)")},
- {"WEGetSelection", (PyCFunction)wasteObj_WEGetSelection, 1,
- PyDoc_STR("() -> (SInt32 outSelStart, SInt32 outSelEnd)")},
- {"WEGetDestRect", (PyCFunction)wasteObj_WEGetDestRect, 1,
- PyDoc_STR("() -> (LongRect outDestRect)")},
- {"WEGetViewRect", (PyCFunction)wasteObj_WEGetViewRect, 1,
- PyDoc_STR("() -> (LongRect outViewRect)")},
- {"WEIsActive", (PyCFunction)wasteObj_WEIsActive, 1,
- PyDoc_STR("() -> (Boolean _rv)")},
- {"WEGetClickCount", (PyCFunction)wasteObj_WEGetClickCount, 1,
- PyDoc_STR("() -> (UInt16 _rv)")},
- {"WESetSelection", (PyCFunction)wasteObj_WESetSelection, 1,
- PyDoc_STR("(SInt32 inSelStart, SInt32 inSelEnd) -> None")},
- {"WESetDestRect", (PyCFunction)wasteObj_WESetDestRect, 1,
- PyDoc_STR("(LongRect inDestRect) -> None")},
- {"WESetViewRect", (PyCFunction)wasteObj_WESetViewRect, 1,
- PyDoc_STR("(LongRect inViewRect) -> None")},
- {"WEContinuousStyle", (PyCFunction)wasteObj_WEContinuousStyle, 1,
- PyDoc_STR("(WEStyleMode ioMode) -> (Boolean _rv, WEStyleMode ioMode, TextStyle outTextStyle)")},
- {"WECountRuns", (PyCFunction)wasteObj_WECountRuns, 1,
- PyDoc_STR("() -> (SInt32 _rv)")},
- {"WEOffsetToRun", (PyCFunction)wasteObj_WEOffsetToRun, 1,
- PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
- {"WEGetRunRange", (PyCFunction)wasteObj_WEGetRunRange, 1,
- PyDoc_STR("(SInt32 inStyleRunIndex) -> (SInt32 outStyleRunStart, SInt32 outStyleRunEnd)")},
- {"WEGetRunInfo", (PyCFunction)wasteObj_WEGetRunInfo, 1,
- PyDoc_STR("(SInt32 inOffset) -> (WERunInfo outStyleRunInfo)")},
- {"WEGetIndRunInfo", (PyCFunction)wasteObj_WEGetIndRunInfo, 1,
- PyDoc_STR("(SInt32 inStyleRunIndex) -> (WERunInfo outStyleRunInfo)")},
- {"WEGetRunDirection", (PyCFunction)wasteObj_WEGetRunDirection, 1,
- PyDoc_STR("(SInt32 inOffset) -> (Boolean _rv)")},
- {"WECountParaRuns", (PyCFunction)wasteObj_WECountParaRuns, 1,
- PyDoc_STR("() -> (SInt32 _rv)")},
- {"WEOffsetToParaRun", (PyCFunction)wasteObj_WEOffsetToParaRun, 1,
- PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
- {"WEGetParaRunRange", (PyCFunction)wasteObj_WEGetParaRunRange, 1,
- PyDoc_STR("(SInt32 inParagraphRunIndex) -> (SInt32 outParagraphRunStart, SInt32 outParagraphRunEnd)")},
- {"WECountLines", (PyCFunction)wasteObj_WECountLines, 1,
- PyDoc_STR("() -> (SInt32 _rv)")},
- {"WEOffsetToLine", (PyCFunction)wasteObj_WEOffsetToLine, 1,
- PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv)")},
- {"WEGetLineRange", (PyCFunction)wasteObj_WEGetLineRange, 1,
- PyDoc_STR("(SInt32 inLineIndex) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
- {"WEGetHeight", (PyCFunction)wasteObj_WEGetHeight, 1,
- PyDoc_STR("(SInt32 inStartLineIndex, SInt32 inEndLineIndex) -> (SInt32 _rv)")},
- {"WEGetOffset", (PyCFunction)wasteObj_WEGetOffset, 1,
- PyDoc_STR("(LongPt inPoint) -> (SInt32 _rv, WEEdge outEdge)")},
- {"WEGetPoint", (PyCFunction)wasteObj_WEGetPoint, 1,
- PyDoc_STR("(SInt32 inOffset, SInt16 inDirection) -> (LongPt outPoint, SInt16 outLineHeight)")},
- {"WEFindWord", (PyCFunction)wasteObj_WEFindWord, 1,
- PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outWordStart, SInt32 outWordEnd)")},
- {"WEFindLine", (PyCFunction)wasteObj_WEFindLine, 1,
- PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outLineStart, SInt32 outLineEnd)")},
- {"WEFindParagraph", (PyCFunction)wasteObj_WEFindParagraph, 1,
- PyDoc_STR("(SInt32 inOffset, WEEdge inEdge) -> (SInt32 outParagraphStart, SInt32 outParagraphEnd)")},
- {"WEFind", (PyCFunction)wasteObj_WEFind, 1,
- PyDoc_STR("(char* inKey, SInt32 inKeyLength, TextEncoding inKeyEncoding, OptionBits inMatchOptions, SInt32 inRangeStart, SInt32 inRangeEnd) -> (SInt32 outMatchStart, SInt32 outMatchEnd)")},
- {"WEStreamRange", (PyCFunction)wasteObj_WEStreamRange, 1,
- PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, FlavorType inRequestedType, OptionBits inStreamOptions, Handle outData) -> None")},
- {"WECopyRange", (PyCFunction)wasteObj_WECopyRange, 1,
- PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outText, StScrpHandle outStyles, WESoupHandle outSoup) -> None")},
- {"WEGetTextRangeAsUnicode", (PyCFunction)wasteObj_WEGetTextRangeAsUnicode, 1,
- PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, Handle outUnicodeText, Handle ioCharFormat, Handle ioParaFormat, TextEncodingVariant inUnicodeVariant, TextEncodingFormat inTransformationFormat, OptionBits inGetOptions) -> None")},
- {"WEGetAlignment", (PyCFunction)wasteObj_WEGetAlignment, 1,
- PyDoc_STR("() -> (WEAlignment _rv)")},
- {"WESetAlignment", (PyCFunction)wasteObj_WESetAlignment, 1,
- PyDoc_STR("(WEAlignment inAlignment) -> None")},
- {"WEGetDirection", (PyCFunction)wasteObj_WEGetDirection, 1,
- PyDoc_STR("() -> (WEDirection _rv)")},
- {"WESetDirection", (PyCFunction)wasteObj_WESetDirection, 1,
- PyDoc_STR("(WEDirection inDirection) -> None")},
- {"WECalText", (PyCFunction)wasteObj_WECalText, 1,
- PyDoc_STR("() -> None")},
- {"WEUpdate", (PyCFunction)wasteObj_WEUpdate, 1,
- PyDoc_STR("(RgnHandle inUpdateRgn) -> None")},
- {"WEScroll", (PyCFunction)wasteObj_WEScroll, 1,
- PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
- {"WEPinScroll", (PyCFunction)wasteObj_WEPinScroll, 1,
- PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> None")},
- {"WESelView", (PyCFunction)wasteObj_WESelView, 1,
- PyDoc_STR("() -> None")},
- {"WEActivate", (PyCFunction)wasteObj_WEActivate, 1,
- PyDoc_STR("() -> None")},
- {"WEDeactivate", (PyCFunction)wasteObj_WEDeactivate, 1,
- PyDoc_STR("() -> None")},
- {"WEKey", (PyCFunction)wasteObj_WEKey, 1,
- PyDoc_STR("(CharParameter inKey, EventModifiers inModifiers) -> None")},
- {"WEClick", (PyCFunction)wasteObj_WEClick, 1,
- PyDoc_STR("(Point inHitPoint, EventModifiers inModifiers, UInt32 inClickTime) -> None")},
- {"WEAdjustCursor", (PyCFunction)wasteObj_WEAdjustCursor, 1,
- PyDoc_STR("(Point inMouseLoc, RgnHandle ioMouseRgn) -> (Boolean _rv)")},
- {"WEIdle", (PyCFunction)wasteObj_WEIdle, 1,
- PyDoc_STR("() -> (UInt32 outMaxSleep)")},
- {"WEInsert", (PyCFunction)wasteObj_WEInsert, 1,
- PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup) -> None")},
- {"WEInsertFormattedText", (PyCFunction)wasteObj_WEInsertFormattedText, 1,
- PyDoc_STR("(Buffer inTextPtr, StScrpHandle inStyles, WESoupHandle inSoup, Handle inParaFormat, Handle inRulerScrap) -> None")},
- {"WEDelete", (PyCFunction)wasteObj_WEDelete, 1,
- PyDoc_STR("() -> None")},
- {"WEUseText", (PyCFunction)wasteObj_WEUseText, 1,
- PyDoc_STR("(Handle inText) -> None")},
- {"WEChangeCase", (PyCFunction)wasteObj_WEChangeCase, 1,
- PyDoc_STR("(SInt16 inCase) -> None")},
- {"WESetOneAttribute", (PyCFunction)wasteObj_WESetOneAttribute, 1,
- PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd, WESelector inAttributeSelector, Buffer inAttributeValue) -> None")},
- {"WESetStyle", (PyCFunction)wasteObj_WESetStyle, 1,
- PyDoc_STR("(WEStyleMode inMode, TextStyle inTextStyle) -> None")},
- {"WEUseStyleScrap", (PyCFunction)wasteObj_WEUseStyleScrap, 1,
- PyDoc_STR("(StScrpHandle inStyles) -> None")},
- {"WEUndo", (PyCFunction)wasteObj_WEUndo, 1,
- PyDoc_STR("() -> None")},
- {"WERedo", (PyCFunction)wasteObj_WERedo, 1,
- PyDoc_STR("() -> None")},
- {"WEClearUndo", (PyCFunction)wasteObj_WEClearUndo, 1,
- PyDoc_STR("() -> None")},
- {"WEGetUndoInfo", (PyCFunction)wasteObj_WEGetUndoInfo, 1,
- PyDoc_STR("() -> (WEActionKind _rv, Boolean outRedoFlag)")},
- {"WEGetIndUndoInfo", (PyCFunction)wasteObj_WEGetIndUndoInfo, 1,
- PyDoc_STR("(SInt32 inUndoLevel) -> (WEActionKind _rv)")},
- {"WEIsTyping", (PyCFunction)wasteObj_WEIsTyping, 1,
- PyDoc_STR("() -> (Boolean _rv)")},
- {"WEBeginAction", (PyCFunction)wasteObj_WEBeginAction, 1,
- PyDoc_STR("() -> None")},
- {"WEEndAction", (PyCFunction)wasteObj_WEEndAction, 1,
- PyDoc_STR("(WEActionKind inActionKind) -> None")},
- {"WEGetModCount", (PyCFunction)wasteObj_WEGetModCount, 1,
- PyDoc_STR("() -> (UInt32 _rv)")},
- {"WEResetModCount", (PyCFunction)wasteObj_WEResetModCount, 1,
- PyDoc_STR("() -> None")},
- {"WEInsertObject", (PyCFunction)wasteObj_WEInsertObject, 1,
- PyDoc_STR("(FlavorType inObjectType, Handle inObjectDataHandle, Point inObjectSize) -> None")},
- {"WEGetSelectedObject", (PyCFunction)wasteObj_WEGetSelectedObject, 1,
- PyDoc_STR("() -> (WEObjectReference outObject)")},
- {"WEGetObjectAtOffset", (PyCFunction)wasteObj_WEGetObjectAtOffset, 1,
- PyDoc_STR("(SInt32 inOffset) -> (WEObjectReference outObject)")},
- {"WEFindNextObject", (PyCFunction)wasteObj_WEFindNextObject, 1,
- PyDoc_STR("(SInt32 inOffset) -> (SInt32 _rv, WEObjectReference outObject)")},
- {"WEUseSoup", (PyCFunction)wasteObj_WEUseSoup, 1,
- PyDoc_STR("(WESoupHandle inSoup) -> None")},
- {"WECut", (PyCFunction)wasteObj_WECut, 1,
- PyDoc_STR("() -> None")},
- {"WECopy", (PyCFunction)wasteObj_WECopy, 1,
- PyDoc_STR("() -> None")},
- {"WEPaste", (PyCFunction)wasteObj_WEPaste, 1,
- PyDoc_STR("() -> None")},
- {"WECanPaste", (PyCFunction)wasteObj_WECanPaste, 1,
- PyDoc_STR("() -> (Boolean _rv)")},
- {"WEGetHiliteRgn", (PyCFunction)wasteObj_WEGetHiliteRgn, 1,
- PyDoc_STR("(SInt32 inRangeStart, SInt32 inRangeEnd) -> (RgnHandle _rv)")},
- {"WECharByte", (PyCFunction)wasteObj_WECharByte, 1,
- PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
- {"WECharType", (PyCFunction)wasteObj_WECharType, 1,
- PyDoc_STR("(SInt32 inOffset) -> (SInt16 _rv)")},
- {"WEStopInlineSession", (PyCFunction)wasteObj_WEStopInlineSession, 1,
- PyDoc_STR("() -> None")},
- {"WEFeatureFlag", (PyCFunction)wasteObj_WEFeatureFlag, 1,
- PyDoc_STR("(SInt16 inFeature, SInt16 inAction) -> (SInt16 _rv)")},
- {"WEGetUserInfo", (PyCFunction)wasteObj_WEGetUserInfo, 1,
- PyDoc_STR("(WESelector inUserTag) -> (SInt32 outUserInfo)")},
- {"WESetUserInfo", (PyCFunction)wasteObj_WESetUserInfo, 1,
- PyDoc_STR("(WESelector inUserTag, SInt32 inUserInfo) -> None")},
- {"WERemoveUserInfo", (PyCFunction)wasteObj_WERemoveUserInfo, 1,
- PyDoc_STR("(WESelector inUserTag) -> None")},
- {"WEInstallTabHooks", (PyCFunction)wasteObj_WEInstallTabHooks, 1,
- PyDoc_STR("() -> None")},
- {"WERemoveTabHooks", (PyCFunction)wasteObj_WERemoveTabHooks, 1,
- PyDoc_STR("() -> None")},
- {"WEIsTabHooks", (PyCFunction)wasteObj_WEIsTabHooks, 1,
- PyDoc_STR("() -> (Boolean _rv)")},
- {"WEGetTabSize", (PyCFunction)wasteObj_WEGetTabSize, 1,
- PyDoc_STR("() -> (SInt16 _rv)")},
- {"WESetTabSize", (PyCFunction)wasteObj_WESetTabSize, 1,
- PyDoc_STR("(SInt16 tabWidth) -> None")},
- {NULL, NULL, 0}
-};
-
-#define wasteObj_getsetlist NULL
-
-
-#define wasteObj_compare NULL
-
-#define wasteObj_repr NULL
-
-#define wasteObj_hash NULL
-#define wasteObj_tp_init 0
-
-#define wasteObj_tp_alloc PyType_GenericAlloc
-
-static PyObject *wasteObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
-{
- PyObject *_self;
- WEReference itself;
- char *kw[] = {"itself", 0};
-
- if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, wasteObj_Convert, &itself)) return NULL;
- if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
- ((wasteObject *)_self)->ob_itself = itself;
- return _self;
-}
-
-#define wasteObj_tp_free PyObject_Del
-
-
-PyTypeObject waste_Type = {
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "waste.waste", /*tp_name*/
- sizeof(wasteObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor) wasteObj_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- (getattrfunc)0, /*tp_getattr*/
- (setattrfunc)0, /*tp_setattr*/
- (cmpfunc) wasteObj_compare, /*tp_compare*/
- (reprfunc) wasteObj_repr, /*tp_repr*/
- (PyNumberMethods *)0, /* tp_as_number */
- (PySequenceMethods *)0, /* tp_as_sequence */
- (PyMappingMethods *)0, /* tp_as_mapping */
- (hashfunc) wasteObj_hash, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- PyObject_GenericGetAttr, /*tp_getattro*/
- PyObject_GenericSetAttr, /*tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
- 0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- wasteObj_methods, /* tp_methods */
- 0, /*tp_members*/
- wasteObj_getsetlist, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- wasteObj_tp_init, /* tp_init */
- wasteObj_tp_alloc, /* tp_alloc */
- wasteObj_tp_new, /* tp_new */
- wasteObj_tp_free, /* tp_free */
-};
-
-/* --------------------- End object type waste ---------------------- */
-
-
-static PyObject *waste_WENew(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- LongRect inDestRect;
- LongRect inViewRect;
- OptionBits inOptions;
- WEReference outWE;
- if (!PyArg_ParseTuple(_args, "O&O&l",
- LongRect_Convert, &inDestRect,
- LongRect_Convert, &inViewRect,
- &inOptions))
- return NULL;
- _err = WENew(&inDestRect,
- &inViewRect,
- inOptions,
- &outWE);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- wasteObj_New, outWE);
- return _res;
-}
-
-static PyObject *waste_WEUpdateStyleScrap(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- StScrpHandle ioStyles;
- WEFontTableHandle inFontTable;
- if (!PyArg_ParseTuple(_args, "O&O&",
- ResObj_Convert, &ioStyles,
- ResObj_Convert, &inFontTable))
- return NULL;
- _err = WEUpdateStyleScrap(ioStyles,
- inFontTable);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *waste_WEInstallTSMHandlers(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WEInstallTSMHandlers();
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *waste_WERemoveTSMHandlers(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = WERemoveTSMHandlers();
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-}
-
-static PyObject *waste_WEHandleTSMEvent(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- OSErr _err;
- AppleEvent inAppleEvent;
- AppleEvent ioReply;
- if (!PyArg_ParseTuple(_args, "O&",
- AEDesc_Convert, &inAppleEvent))
- return NULL;
- _err = WEHandleTSMEvent(&inAppleEvent,
- &ioReply);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- AEDesc_New, &ioReply);
- return _res;
-}
-
-static PyObject *waste_WELongPointToPoint(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongPt inLongPoint;
- Point outPoint;
- if (!PyArg_ParseTuple(_args, "O&",
- LongPt_Convert, &inLongPoint))
- return NULL;
- WELongPointToPoint(&inLongPoint,
- &outPoint);
- _res = Py_BuildValue("O&",
- PyMac_BuildPoint, outPoint);
- return _res;
-}
-
-static PyObject *waste_WEPointToLongPoint(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Point inPoint;
- LongPt outLongPoint;
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &inPoint))
- return NULL;
- WEPointToLongPoint(inPoint,
- &outLongPoint);
- _res = Py_BuildValue("O&",
- LongPt_New, &outLongPoint);
- return _res;
-}
-
-static PyObject *waste_WESetLongRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongRect outLongRect;
- SInt32 inLeft;
- SInt32 inTop;
- SInt32 inRight;
- SInt32 inBottom;
- if (!PyArg_ParseTuple(_args, "llll",
- &inLeft,
- &inTop,
- &inRight,
- &inBottom))
- return NULL;
- WESetLongRect(&outLongRect,
- inLeft,
- inTop,
- inRight,
- inBottom);
- _res = Py_BuildValue("O&",
- LongRect_New, &outLongRect);
- return _res;
-}
-
-static PyObject *waste_WELongRectToRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongRect inLongRect;
- Rect outRect;
- if (!PyArg_ParseTuple(_args, "O&",
- LongRect_Convert, &inLongRect))
- return NULL;
- WELongRectToRect(&inLongRect,
- &outRect);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &outRect);
- return _res;
-}
-
-static PyObject *waste_WERectToLongRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Rect inRect;
- LongRect outLongRect;
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &inRect))
- return NULL;
- WERectToLongRect(&inRect,
- &outLongRect);
- _res = Py_BuildValue("O&",
- LongRect_New, &outLongRect);
- return _res;
-}
-
-static PyObject *waste_WEOffsetLongRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- LongRect ioLongRect;
- SInt32 inHorizontalOffset;
- SInt32 inVerticalOffset;
- if (!PyArg_ParseTuple(_args, "ll",
- &inHorizontalOffset,
- &inVerticalOffset))
- return NULL;
- WEOffsetLongRect(&ioLongRect,
- inHorizontalOffset,
- inVerticalOffset);
- _res = Py_BuildValue("O&",
- LongRect_New, &ioLongRect);
- return _res;
-}
-
-static PyObject *waste_WELongPointInLongRect(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
- Boolean _rv;
- LongPt inLongPoint;
- LongRect inLongRect;
- if (!PyArg_ParseTuple(_args, "O&O&",
- LongPt_Convert, &inLongPoint,
- LongRect_Convert, &inLongRect))
- return NULL;
- _rv = WELongPointInLongRect(&inLongPoint,
- &inLongRect);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
-}
-
-static PyObject *waste_STDObjectHandlers(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
-
- OSErr err;
- // install the sample object handlers for pictures and sounds
-#define kTypePicture 'PICT'
-#define kTypeSound 'snd '
-
- if ( !PyArg_ParseTuple(_args, "") ) return NULL;
-
- if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
- (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
- (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
- (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
- (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
- (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
- (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
- goto cleanup;
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-
- cleanup:
- return PyMac_Error(err);
-
-}
-
-static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args)
-{
- PyObject *_res = NULL;
-
- OSErr err;
- FlavorType objectType;
- WESelector selector;
- PyObject *py_handler;
- UniversalProcPtr handler;
- WEReference we = NULL;
- PyObject *key;
-
-
- if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
- PyMac_GetOSType, &objectType,
- PyMac_GetOSType, &selector,
- &py_handler,
- WEOObj_Convert, &we) ) return NULL;
-
- if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
- else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
- else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
- else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
- else return PyMac_Error(weUndefinedSelectorErr);
-
- if ((key = Py_BuildValue("O&O&",
- PyMac_BuildOSType, objectType,
- PyMac_BuildOSType, selector)) == NULL )
- return NULL;
-
- PyDict_SetItem(callbackdict, key, py_handler);
-
- err = WEInstallObjectHandler(objectType, selector, handler, we);
- if ( err ) return PyMac_Error(err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-
-}
-
-static PyMethodDef waste_methods[] = {
- {"WENew", (PyCFunction)waste_WENew, 1,
- PyDoc_STR("(LongRect inDestRect, LongRect inViewRect, OptionBits inOptions) -> (WEReference outWE)")},
- {"WEUpdateStyleScrap", (PyCFunction)waste_WEUpdateStyleScrap, 1,
- PyDoc_STR("(StScrpHandle ioStyles, WEFontTableHandle inFontTable) -> None")},
- {"WEInstallTSMHandlers", (PyCFunction)waste_WEInstallTSMHandlers, 1,
- PyDoc_STR("() -> None")},
- {"WERemoveTSMHandlers", (PyCFunction)waste_WERemoveTSMHandlers, 1,
- PyDoc_STR("() -> None")},
- {"WEHandleTSMEvent", (PyCFunction)waste_WEHandleTSMEvent, 1,
- PyDoc_STR("(AppleEvent inAppleEvent) -> (AppleEvent ioReply)")},
- {"WELongPointToPoint", (PyCFunction)waste_WELongPointToPoint, 1,
- PyDoc_STR("(LongPt inLongPoint) -> (Point outPoint)")},
- {"WEPointToLongPoint", (PyCFunction)waste_WEPointToLongPoint, 1,
- PyDoc_STR("(Point inPoint) -> (LongPt outLongPoint)")},
- {"WESetLongRect", (PyCFunction)waste_WESetLongRect, 1,
- PyDoc_STR("(SInt32 inLeft, SInt32 inTop, SInt32 inRight, SInt32 inBottom) -> (LongRect outLongRect)")},
- {"WELongRectToRect", (PyCFunction)waste_WELongRectToRect, 1,
- PyDoc_STR("(LongRect inLongRect) -> (Rect outRect)")},
- {"WERectToLongRect", (PyCFunction)waste_WERectToLongRect, 1,
- PyDoc_STR("(Rect inRect) -> (LongRect outLongRect)")},
- {"WEOffsetLongRect", (PyCFunction)waste_WEOffsetLongRect, 1,
- PyDoc_STR("(SInt32 inHorizontalOffset, SInt32 inVerticalOffset) -> (LongRect ioLongRect)")},
- {"WELongPointInLongRect", (PyCFunction)waste_WELongPointInLongRect, 1,
- PyDoc_STR("(LongPt inLongPoint, LongRect inLongRect) -> (Boolean _rv)")},
- {"STDObjectHandlers", (PyCFunction)waste_STDObjectHandlers, 1,
- PyDoc_STR(NULL)},
- {"WEInstallObjectHandler", (PyCFunction)waste_WEInstallObjectHandler, 1,
- PyDoc_STR(NULL)},
- {NULL, NULL, 0}
-};
-
-
-
-/* Return the object corresponding to the window, or NULL */
-
-PyObject *
-ExistingwasteObj_New(w)
- WEReference w;
-{
- PyObject *it = NULL;
-
- if (w == NULL)
- it = NULL;
- else
- WEGetInfo(weRefCon, (void *)&it, w);
- if (it == NULL || ((wasteObject *)it)->ob_itself != w)
- it = Py_None;
- Py_INCREF(it);
- return it;
-}
-
-
-void initwaste(void)
-{
- PyObject *m;
- PyObject *d;
-
-
-
-
- m = Py_InitModule("waste", waste_methods);
- d = PyModule_GetDict(m);
- waste_Error = PyMac_GetOSErrException();
- if (waste_Error == NULL ||
- PyDict_SetItemString(d, "Error", waste_Error) != 0)
- return;
- WEO_Type.ob_type = &PyType_Type;
- if (PyType_Ready(&WEO_Type) < 0) return;
- Py_INCREF(&WEO_Type);
- PyModule_AddObject(m, "WEO", (PyObject *)&WEO_Type);
- /* Backward-compatible name */
- Py_INCREF(&WEO_Type);
- PyModule_AddObject(m, "WEOType", (PyObject *)&WEO_Type);
- waste_Type.ob_type = &PyType_Type;
- if (PyType_Ready(&waste_Type) < 0) return;
- Py_INCREF(&waste_Type);
- PyModule_AddObject(m, "waste", (PyObject *)&waste_Type);
- /* Backward-compatible name */
- Py_INCREF(&waste_Type);
- PyModule_AddObject(m, "wasteType", (PyObject *)&waste_Type);
-
- callbackdict = PyDict_New();
- if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
- return;
- upp_new_handler = NewWENewObjectProc(my_new_handler);
- upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
- upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
- upp_click_handler = NewWEClickObjectProc(my_click_handler);
-
-
-}
-
-/* ======================== End module waste ======================== */
-
diff --git a/Mac/Modules/waste/wastescan.py b/Mac/Modules/waste/wastescan.py
deleted file mode 100644
index b5a2b4310a..0000000000
--- a/Mac/Modules/waste/wastescan.py
+++ /dev/null
@@ -1,152 +0,0 @@
-# Scan an Apple header file, generating a Python file of generator calls.
-
-import sys
-import os
-from bgenlocations import TOOLBOXDIR, BGENDIR
-sys.path.append(BGENDIR)
-from scantools import Scanner
-
-WASTEDIR='/Users/jack/src/waste/C_C++ Headers/'
-
-if not os.path.exists(WASTEDIR):
- raise 'Error: not found: %s', WASTEDIR
-
-OBJECT = "TEHandle"
-SHORT = "waste"
-OBJECT = "WEReference"
-OBJECT2 = "WEObjectReference"
-
-def main():
- input = WASTEDIR + "WASTE.h"
- output = SHORT + "gen.py"
- defsoutput = os.path.join(os.path.split(TOOLBOXDIR)[0], "WASTEconst.py")
- scanner = MyScanner(input, output, defsoutput)
- scanner.scan()
-## scanner.gentypetest(SHORT+"typetest.py")
- scanner.close()
- print "=== Testing definitions output code ==="
- execfile(defsoutput, {}, {})
- print "=== Done scanning and generating, now importing the generated code... ==="
- exec "import " + SHORT + "support"
- print "=== Done. It's up to you to compile it now! ==="
-
-#class MyScanner(Scanner_PreUH3):
-class MyScanner(Scanner):
-
- def destination(self, type, name, arglist):
- classname = "Function"
- listname = "functions"
- if arglist:
- t, n, m = arglist[-1]
- # This is non-functional today
- if t == OBJECT and m == "InMode":
- classname = "Method"
- listname = "methods"
- else:
- t, n, m = arglist[0]
- if t == OBJECT2 and m == "InMode":
- classname = "Method2"
- listname = "methods2"
- return classname, listname
-
- def writeinitialdefs(self):
- self.defsfile.write("kPascalStackBased = None # workaround for header parsing\n")
- self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
-
- def makeblacklistnames(self):
- return [
- "WEDispose",
- "WESetInfo", # Argument type unknown...
- "WEGetInfo",
- "WEVersion", # Unfortunately...
- "WEPut", # XXXX TBD: needs array of flavortypes.
- "WEGetOneAttribute", # XXXX TBD: output buffer
- # Incompatible constant definitions
- "weDoAutoScroll",
- "weDoOutlineHilite",
- "weDoReadOnly",
- "weDoUndo",
- "weDoIntCutAndPaste",
- "weDoDragAndDrop",
- "weDoInhibitRecal",
- "weDoUseTempMem",
- "weDoDrawOffscreen",
- "weDoInhibitRedraw",
- "weDoMonoStyled",
- "weDoMultipleUndo",
- "weDoNoKeyboardSync",
- "weDoInhibitICSupport",
- "weDoInhibitColor",
- ]
-
- def makeblacklisttypes(self):
- return [
- "DragReference", # For now...
- "UniversalProcPtr",
- "WEFontIDToNameUPP",
- "WEFontNameToIDUPP",
- "WEClickLoopUPP",
- "WEScrollUPP",
- "WETSMPreUpdateUPP",
- "WETSMPostUpdateUPP",
- "WEPreTrackDragUPP",
- "WETranslateDragUPP",
- "WEHiliteDropAreaUPP",
- "WEDrawTextUPP",
- "WEDrawTSMHiliteUPP",
- "WEPixelToCharUPP",
- "WECharToPixelUPP",
- "WELineBreakUPP",
- "WEWordBreakUPP",
- "WECharByteUPP",
- "WECharTypeUPP",
- "WEEraseUPP",
- "WEFluxUPP",
- "WENewObjectUPP",
- "WEDisposeObjectUPP",
- "WEDrawObjectUPP",
- "WEClickObjectUPP",
- "WEStreamObjectUPP",
- "WEHoverObjectUPP",
- "WERuler", # XXXX To be done
- "WERuler_ptr", # ditto
- "WEParaInfo", # XXXX To be done
- "WEPrintSession", # XXXX To be done
- "WEPrintOptions_ptr", # XXXX To be done
- ]
-
- def makerepairinstructions(self):
- return [
- ([("void_ptr", "*", "InMode"), ("SInt32", "*", "InMode")],
- [("InBuffer", "*", "*")]),
-
- # WEContinuousStyle
- ([("WEStyleMode", "ioMode", "OutMode"), ("TextStyle", "outTextStyle", "OutMode")],
- [("WEStyleMode", "*", "InOutMode"), ("TextStyle", "*", "*")]),
-
- # WECopyRange
- ([('Handle', 'outText', 'InMode'), ('StScrpHandle', 'outStyles', 'InMode'),
- ('WESoupHandle', 'outSoup', 'InMode')],
- [('OptHandle', '*', '*'), ('OptStScrpHandle', '*', '*'),
- ('OptSoupHandle', '*', '*')]),
-
- # WEInsert
- ([('StScrpHandle', 'inStyles', 'InMode'), ('WESoupHandle', 'inSoup', 'InMode')],
- [('OptStScrpHandle', '*', '*'), ('OptSoupHandle', '*', '*')]),
-
- # WEGetObjectOwner
- ("WEGetObjectOwner",
- [('WEReference', '*', 'ReturnMode')],
- [('ExistingWEReference', '*', 'ReturnMode')]),
-
- # WEFindParagraph
- ([("char_ptr", "inKey", "InMode")],
- [("stringptr", "*", "*")]),
-
- # WESetOneAttribute
- ([("void_ptr", "*", "InMode"), ("ByteCount", "*", "InMode")],
- [("InBuffer", "*", "*")]),
- ]
-
-if __name__ == "__main__":
- main()
diff --git a/Mac/Modules/waste/wastesupport.py b/Mac/Modules/waste/wastesupport.py
deleted file mode 100644
index 13ddc409cc..0000000000
--- a/Mac/Modules/waste/wastesupport.py
+++ /dev/null
@@ -1,444 +0,0 @@
-# This script generates a Python interface for an Apple Macintosh Manager.
-# It uses the "bgen" package to generate C code.
-# The function specifications are generated by scanning the mamager's header file,
-# using the "scantools" package (customized for this particular manager).
-
-import string
-
-# Declarations that change for each manager
-MACHEADERFILE = 'WASTE.h' # The Apple header file
-MODNAME = 'waste' # The name of the module
-OBJECTNAME = 'waste' # The basic name of the objects used here
-KIND = 'Ptr' # Usually 'Ptr' or 'Handle'
-
-# The following is *usually* unchanged but may still require tuning
-MODPREFIX = MODNAME # The prefix for module-wide routines
-OBJECTTYPE = "WEReference" # The C type used to represent them
-OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
-INPUTFILE = 'wastegen.py' # The file generated by the scanner
-TYPETESTFILE = 'wastetypetest.py' # Another file generated by the scanner
-OUTPUTFILE = "wastemodule.c" # The file generated by this program
-
-from macsupport import *
-
-# Create the type objects
-WEReference = OpaqueByValueType("WEReference", "wasteObj")
-ExistingWEReference = OpaqueByValueType("WEReference", "ExistingwasteObj")
-WEObjectReference = OpaqueByValueType("WEObjectReference", "WEOObj")
-StScrpHandle = OpaqueByValueType("StScrpHandle", "ResObj")
-RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
-EventModifiers = Type("EventModifiers", "H")
-FlavorType = OSTypeType("FlavorType")
-WESelector = OSTypeType("WESelector")
-
-OptHandle = OpaqueByValueType("Handle", "OptResObj")
-OptSoupHandle = OpaqueByValueType("WESoupHandle", "OptResObj")
-OptStScrpHandle = OpaqueByValueType("StScrpHandle", "OptResObj")
-
-WEStyleMode = Type("WEStyleMode", "H")
-WERulerMode = Type("WERulerMode", "l")
-WEActionKind = Type("WEActionKind", "h")
-WEAlignment = Type("WEAlignment", "B")
-WEEdge = Type("WEEdge", "B")
-WEDirection = Type("WEDirection", "h")
-WESoupHandle = OpaqueByValueType("WESoupHandle", "ResObj")
-WEFontTableHandle = OpaqueByValueType("WEFontTableHandle", "ResObj")
-WEFontTableHandle
-WERunInfo = OpaqueType("WERunInfo", "RunInfo")
-
-AppleEvent = OpaqueType('AppleEvent', 'AEDesc')
-AppleEvent_ptr = OpaqueType('AppleEvent', 'AEDesc')
-
-TextStyle = OpaqueType("TextStyle", "TextStyle")
-TextStyle_ptr = TextStyle
-LongPt = OpaqueType("LongPt", "LongPt")
-LongPt_ptr = LongPt
-LongRect = OpaqueType("LongRect", "LongRect")
-LongRect_ptr = LongRect
-
-TextEncodingVariant = Type("TextEncodingVariant", "l")
-TextEncodingFormat = Type("TextEncodingFormat", "l")
-
-includestuff = includestuff + """
-#include <%s>""" % MACHEADERFILE + """
-#include <WEObjectHandlers.h>
-#include <WETabs.h>
-
-/* Exported by Qdmodule.c: */
-extern PyObject *QdRGB_New(RGBColor *);
-extern int QdRGB_Convert(PyObject *, RGBColor *);
-
-/* Exported by AEModule.c: */
-extern PyObject *AEDesc_New(AppleEvent *);
-extern int AEDesc_Convert(PyObject *, AppleEvent *);
-
-/* Forward declaration */
-static PyObject *WEOObj_New(WEObjectReference);
-static PyObject *ExistingwasteObj_New(WEReference);
-
-/*
-** Parse/generate TextStyle records
-*/
-static PyObject *
-TextStyle_New(TextStylePtr itself)
-{
-
- return Py_BuildValue("lllO&", (long)itself->tsFont, (long)itself->tsFace, (long)itself->tsSize, QdRGB_New,
- &itself->tsColor);
-}
-
-static int
-TextStyle_Convert(PyObject *v, TextStylePtr p_itself)
-{
- long font, face, size;
-
- if( !PyArg_ParseTuple(v, "lllO&", &font, &face, &size, QdRGB_Convert, &p_itself->tsColor) )
- return 0;
- p_itself->tsFont = (short)font;
- p_itself->tsFace = (Style)face;
- p_itself->tsSize = (short)size;
- return 1;
-}
-
-/*
-** Parse/generate RunInfo records
-*/
-static PyObject *
-RunInfo_New(WERunInfo *itself)
-{
-
- return Py_BuildValue("llhhO&O&", itself->runStart, itself->runEnd, itself->runHeight,
- itself->runAscent, TextStyle_New, &itself->runStyle, WEOObj_New, itself->runObject);
-}
-
-/* Conversion of long points and rects */
-int
-LongRect_Convert(PyObject *v, LongRect *r)
-{
- return PyArg_Parse(v, "(llll)", &r->left, &r->top, &r->right, &r->bottom);
-}
-
-PyObject *
-LongRect_New(LongRect *r)
-{
- return Py_BuildValue("(llll)", r->left, r->top, r->right, r->bottom);
-}
-
-int
-LongPt_Convert(PyObject *v, LongPt *p)
-{
- return PyArg_Parse(v, "(ll)", &p->h, &p->v);
-}
-
-PyObject *
-LongPt_New(LongPt *p)
-{
- return Py_BuildValue("(ll)", p->h, p->v);
-}
-
-/* Stuff for the callbacks: */
-static PyObject *callbackdict;
-WENewObjectUPP upp_new_handler;
-WEDisposeObjectUPP upp_dispose_handler;
-WEDrawObjectUPP upp_draw_handler;
-WEClickObjectUPP upp_click_handler;
-
-static OSErr
-any_handler(WESelector what, WEObjectReference who, PyObject *args, PyObject **rv)
-{
- FlavorType tp;
- PyObject *key, *func;
-
- if ( args == NULL ) return errAECorruptData;
-
- tp = WEGetObjectType(who);
-
- if( (key=Py_BuildValue("O&O&", PyMac_BuildOSType, tp, PyMac_BuildOSType, what)) == NULL)
- return errAECorruptData;
- if( (func = PyDict_GetItem(callbackdict, key)) == NULL ) {
- Py_DECREF(key);
- return errAEHandlerNotFound;
- }
- Py_INCREF(func);
- *rv = PyEval_CallObject(func, args);
- Py_DECREF(func);
- Py_DECREF(key);
- if ( *rv == NULL ) {
- PySys_WriteStderr("--Exception in callback: ");
- PyErr_Print();
- return errAEReplyNotArrived;
- }
- return 0;
-}
-
-static pascal OSErr
-my_new_handler(Point *objectSize, WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- OSErr err;
-
- args=Py_BuildValue("(O&)", WEOObj_New, objref);
- err = any_handler(weNewHandler, objref, args, &rv);
- if (!err) {
- if (!PyMac_GetPoint(rv, objectSize) )
- err = errAECoercionFail;
- }
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return err;
-}
-
-static pascal OSErr
-my_dispose_handler(WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- OSErr err;
-
- args=Py_BuildValue("(O&)", WEOObj_New, objref);
- err = any_handler(weDisposeHandler, objref, args, &rv);
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return err;
-}
-
-static pascal OSErr
-my_draw_handler(const Rect *destRect, WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- OSErr err;
-
- args=Py_BuildValue("O&O&", PyMac_BuildRect, destRect, WEOObj_New, objref);
- err = any_handler(weDrawHandler, objref, args, &rv);
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return err;
-}
-
-static pascal Boolean
-my_click_handler(Point hitPt, EventModifiers modifiers,
- unsigned long clickTime, WEObjectReference objref)
-{
- PyObject *args=NULL, *rv=NULL;
- int retvalue;
- OSErr err;
-
- args=Py_BuildValue("O&llO&", PyMac_BuildPoint, hitPt,
- (long)modifiers, (long)clickTime, WEOObj_New, objref);
- err = any_handler(weClickHandler, objref, args, &rv);
- if (!err)
- retvalue = PyInt_AsLong(rv);
- else
- retvalue = 0;
- if ( args ) {
- Py_DECREF(args);
- }
- if ( rv ) {
- Py_DECREF(rv);
- }
- return retvalue;
-}
-
-
-"""
-finalstuff = finalstuff + """
-/* Return the object corresponding to the window, or NULL */
-
-PyObject *
-ExistingwasteObj_New(w)
- WEReference w;
-{
- PyObject *it = NULL;
-
- if (w == NULL)
- it = NULL;
- else
- WEGetInfo(weRefCon, (void *)&it, w);
- if (it == NULL || ((wasteObject *)it)->ob_itself != w)
- it = Py_None;
- Py_INCREF(it);
- return it;
-}
-"""
-
-class WEMethodGenerator(OSErrMethodGenerator):
- """Similar to MethodGenerator, but has self as last argument"""
-
- def parseArgumentList(self, args):
- args, a0 = args[:-1], args[-1]
- t0, n0, m0 = a0
- if m0 != InMode:
- raise ValueError, "method's 'self' must be 'InMode'"
- self.itself = Variable(t0, "_self->ob_itself", SelfMode)
- FunctionGenerator.parseArgumentList(self, args)
- self.argumentList.append(self.itself)
-
-
-
-class WEObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
- def outputCheckNewArg(self):
- Output("""if (itself == NULL) {
- PyErr_SetString(waste_Error,"Cannot create null WE");
- return NULL;
- }""")
- def outputInitStructMembers(self):
- GlobalObjectDefinition.outputInitStructMembers(self)
- Output("WESetInfo(weRefCon, (void *)&it, itself);")
- def outputFreeIt(self, itselfname):
- Output("WEDispose(%s);", itselfname)
-
-class WEOObjectDefinition(PEP253Mixin, GlobalObjectDefinition):
- def outputCheckNewArg(self):
- Output("""if (itself == NULL) {
- Py_INCREF(Py_None);
- return Py_None;
- }""")
-
-variablestuff = """
- callbackdict = PyDict_New();
- if (callbackdict == NULL || PyDict_SetItemString(d, "callbacks", callbackdict) != 0)
- return;
- upp_new_handler = NewWENewObjectProc(my_new_handler);
- upp_dispose_handler = NewWEDisposeObjectProc(my_dispose_handler);
- upp_draw_handler = NewWEDrawObjectProc(my_draw_handler);
- upp_click_handler = NewWEClickObjectProc(my_click_handler);
-"""
-
-
-# From here on it's basically all boiler plate...
-
-# Test types used for existence
-## execfile(TYPETESTFILE)
-
-# Create the generator groups and link them
-module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff, variablestuff)
-object = WEObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
-object2 = WEOObjectDefinition("WEO", "WEOObj", "WEObjectReference")
-module.addobject(object2)
-module.addobject(object)
-
-# Create the generator classes used to populate the lists
-Function = OSErrFunctionGenerator
-Method = WEMethodGenerator
-Method2 = OSErrMethodGenerator
-
-# Create and populate the lists
-functions = []
-methods = []
-methods2 = []
-execfile(INPUTFILE)
-
-# A function written by hand:
-stdhandlers_body = """
- OSErr err;
- // install the sample object handlers for pictures and sounds
-#define kTypePicture 'PICT'
-#define kTypeSound 'snd '
-
- if ( !PyArg_ParseTuple(_args, "") ) return NULL;
-
- if ((err = WEInstallObjectHandler(kTypePicture, weNewHandler,
- (UniversalProcPtr) NewWENewObjectProc(HandleNewPicture), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypePicture, weDisposeHandler,
- (UniversalProcPtr) NewWEDisposeObjectProc(HandleDisposePicture), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypePicture, weDrawHandler,
- (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawPicture), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypeSound, weNewHandler,
- (UniversalProcPtr) NewWENewObjectProc(HandleNewSound), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypeSound, weDrawHandler,
- (UniversalProcPtr) NewWEDrawObjectProc(HandleDrawSound), NULL)) != noErr)
- goto cleanup;
-
- if ((err = WEInstallObjectHandler(kTypeSound, weClickHandler,
- (UniversalProcPtr) NewWEClickObjectProc(HandleClickSound), NULL)) != noErr)
- goto cleanup;
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-
-cleanup:
- return PyMac_Error(err);
-"""
-
-inshandler_body = """
- OSErr err;
- FlavorType objectType;
- WESelector selector;
- PyObject *py_handler;
- UniversalProcPtr handler;
- WEReference we = NULL;
- PyObject *key;
-
-
- if ( !PyArg_ParseTuple(_args, "O&O&O|O&",
- PyMac_GetOSType, &objectType,
- PyMac_GetOSType, &selector,
- &py_handler,
- WEOObj_Convert, &we) ) return NULL;
-
- if ( selector == weNewHandler ) handler = (UniversalProcPtr)upp_new_handler;
- else if ( selector == weDisposeHandler ) handler = (UniversalProcPtr)upp_dispose_handler;
- else if ( selector == weDrawHandler ) handler = (UniversalProcPtr)upp_draw_handler;
- else if ( selector == weClickHandler ) handler = (UniversalProcPtr)upp_click_handler;
- else return PyMac_Error(weUndefinedSelectorErr);
-
- if ((key = Py_BuildValue("O&O&",
- PyMac_BuildOSType, objectType,
- PyMac_BuildOSType, selector)) == NULL )
- return NULL;
-
- PyDict_SetItem(callbackdict, key, py_handler);
-
- err = WEInstallObjectHandler(objectType, selector, handler, we);
- if ( err ) return PyMac_Error(err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
-"""
-
-stdhand = ManualGenerator("STDObjectHandlers", stdhandlers_body)
-inshand = ManualGenerator("WEInstallObjectHandler", inshandler_body)
-
-
-# Tab hook handlers. Could be parsed from WETabs.h, but this is just as simple.
-f = Method(OSErr, 'WEInstallTabHooks', (WEReference, 'we', InMode))
-methods.append(f)
-f = Method(OSErr, 'WERemoveTabHooks', (WEReference, 'we', InMode))
-methods.append(f)
-f = Method(Boolean, 'WEIsTabHooks', (WEReference, 'we', InMode))
-methods.append(f)
-f = Method(SInt16, 'WEGetTabSize', (WEReference, 'we', InMode))
-methods.append(f)
-f = Method(OSErr, 'WESetTabSize', (SInt16, 'tabWidth', InMode), (WEReference, 'we', InMode))
-methods.append(f)
-
-# add the populated lists to the generator groups
-# (in a different wordl the scan program would generate this)
-for f in functions: module.add(f)
-module.add(stdhand)
-module.add(inshand)
-for f in methods: object.add(f)
-for f in methods2: object2.add(f)
-
-# generate output (open the output file as late as possible)
-SetOutputFileName(OUTPUTFILE)
-module.generate()
diff --git a/Mac/OSX/PythonLauncher/PreferenceWindow.nib/classes.nib b/Mac/OSX/PythonLauncher/PreferenceWindow.nib/classes.nib
deleted file mode 100644
index 467aa8b261..0000000000
--- a/Mac/OSX/PythonLauncher/PreferenceWindow.nib/classes.nib
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- IBClasses = (
- {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
- {
- ACTIONS = {"do_apply" = id; "do_filetype" = id; "do_reset" = id; };
- CLASS = PreferencesWindowController;
- LANGUAGE = ObjC;
- OUTLETS = {
- commandline = NSTextField;
- debug = NSButton;
- filetype = NSPopUpButton;
- honourhashbang = NSButton;
- inspect = NSButton;
- interpreter = NSTextField;
- nosite = NSButton;
- optimize = NSButton;
- others = NSTextField;
- tabs = NSButton;
- verbose = NSButton;
- "with_terminal" = NSButton;
- };
- SUPERCLASS = NSWindowController;
- }
- );
- IBVersion = 1;
-} \ No newline at end of file
diff --git a/Mac/OSX/PythonLauncher/PreferenceWindow.nib/info.nib b/Mac/OSX/PythonLauncher/PreferenceWindow.nib/info.nib
deleted file mode 100644
index bc558f7e82..0000000000
--- a/Mac/OSX/PythonLauncher/PreferenceWindow.nib/info.nib
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBDocumentLocation</key>
- <string>565 235 519 534 0 0 1280 1002 </string>
- <key>IBFramework Version</key>
- <string>364.0</string>
- <key>IBOpenObjects</key>
- <array>
- <integer>5</integer>
- </array>
- <key>IBSystem Version</key>
- <string>7H63</string>
-</dict>
-</plist>
diff --git a/Mac/OSX/PythonLauncher/PreferenceWindow.nib/objects.nib b/Mac/OSX/PythonLauncher/PreferenceWindow.nib/objects.nib
deleted file mode 100644
index 3dfed33cbd..0000000000
--- a/Mac/OSX/PythonLauncher/PreferenceWindow.nib/objects.nib
+++ /dev/null
Binary files differ
diff --git a/Mac/OSX/PythonLauncher/English.lproj/Credits.rtf b/Mac/PythonLauncher/English.lproj/Credits.rtf
index 930ca221a1..930ca221a1 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/Credits.rtf
+++ b/Mac/PythonLauncher/English.lproj/Credits.rtf
diff --git a/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/classes.nib b/Mac/PythonLauncher/English.lproj/MainMenu.nib/classes.nib
index 47b40aba31..47b40aba31 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/classes.nib
+++ b/Mac/PythonLauncher/English.lproj/MainMenu.nib/classes.nib
diff --git a/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/info.nib b/Mac/PythonLauncher/English.lproj/MainMenu.nib/info.nib
index b96759af1c..b96759af1c 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/info.nib
+++ b/Mac/PythonLauncher/English.lproj/MainMenu.nib/info.nib
diff --git a/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/objects.nib b/Mac/PythonLauncher/English.lproj/MainMenu.nib/objects.nib
index 532a5c8289..532a5c8289 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/MainMenu.nib/objects.nib
+++ b/Mac/PythonLauncher/English.lproj/MainMenu.nib/objects.nib
Binary files differ
diff --git a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib b/Mac/PythonLauncher/English.lproj/MyDocument.nib/classes.nib
index bcdc0cdf08..bcdc0cdf08 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib
+++ b/Mac/PythonLauncher/English.lproj/MyDocument.nib/classes.nib
diff --git a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib b/Mac/PythonLauncher/English.lproj/MyDocument.nib/info.nib
index e258c7220a..e258c7220a 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib
+++ b/Mac/PythonLauncher/English.lproj/MyDocument.nib/info.nib
diff --git a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/objects.nib b/Mac/PythonLauncher/English.lproj/MyDocument.nib/objects.nib
index 0473a31a21..0473a31a21 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/objects.nib
+++ b/Mac/PythonLauncher/English.lproj/MyDocument.nib/objects.nib
Binary files differ
diff --git a/Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib
index 467aa8b261..467aa8b261 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib
+++ b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/classes.nib
diff --git a/Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib
index bc558f7e82..bc558f7e82 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib
+++ b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/info.nib
diff --git a/Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib
index 3dfed33cbd..3dfed33cbd 100644
--- a/Mac/OSX/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib
+++ b/Mac/PythonLauncher/English.lproj/PreferenceWindow.nib/objects.nib
Binary files differ
diff --git a/Mac/OSX/PythonLauncher/FileSettings.h b/Mac/PythonLauncher/FileSettings.h
index d807bae59c..d807bae59c 100755
--- a/Mac/OSX/PythonLauncher/FileSettings.h
+++ b/Mac/PythonLauncher/FileSettings.h
diff --git a/Mac/OSX/PythonLauncher/FileSettings.m b/Mac/PythonLauncher/FileSettings.m
index fc3937b3dc..fc3937b3dc 100755
--- a/Mac/OSX/PythonLauncher/FileSettings.m
+++ b/Mac/PythonLauncher/FileSettings.m
diff --git a/Mac/OSX/PythonLauncher/Info.plist b/Mac/PythonLauncher/Info.plist.in
index 1dd795f776..3c726d7524 100644
--- a/Mac/OSX/PythonLauncher/Info.plist
+++ b/Mac/PythonLauncher/Info.plist.in
@@ -40,7 +40,7 @@
<key>CFBundleExecutable</key>
<string>PythonLauncher</string>
<key>CFBundleGetInfoString</key>
- <string>2.5, © 001-2006 Python Software Foundation</string>
+ <string>%VERSION%, © 001-2006 Python Software Foundation</string>
<key>CFBundleIconFile</key>
<string>PythonLauncher.icns</string>
<key>CFBundleIdentifier</key>
@@ -52,11 +52,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>2.5</string>
+ <string>%VERSION%</string>
<key>CFBundleSignature</key>
<string>PytL</string>
<key>CFBundleVersion</key>
- <string>2.5</string>
+ <string>%VERSION%</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
diff --git a/Mac/OSX/PythonLauncher/Makefile.in b/Mac/PythonLauncher/Makefile.in
index e6dacb3c5e..b4b126c908 100644
--- a/Mac/OSX/PythonLauncher/Makefile.in
+++ b/Mac/PythonLauncher/Makefile.in
@@ -7,18 +7,18 @@ LDFLAGS=@LDFLAGS@
srcdir= @srcdir@
VERSION= @VERSION@
UNIVERSALSDK=@UNIVERSALSDK@
-builddir= ../../..
+builddir= ../..
RUNSHARED= @RUNSHARED@
BUILDEXE= @BUILDEXEEXT@
-BUILDPYTHON= ../../../python$(BUILDEXE)
+BUILDPYTHON= $(builddir)/python$(BUILDEXE)
# Deployment target selected during configure, to be checked
# by distutils
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
-BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
+BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
@@ -35,7 +35,7 @@ clean:
rm -f *.o "Python Launcher"
rm -rf "Python Launcher.app"
-Python\ Launcher.app: \
+Python\ Launcher.app: Info.plist \
Python\ Launcher $(srcdir)/../Icons/PythonLauncher.icns \
$(srcdir)/../Icons/PythonSource.icns \
$(srcdir)/../Icons/PythonCompiled.icns \
@@ -51,7 +51,7 @@ Python\ Launcher.app: \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
--resource=$(srcdir)/English.lproj \
--resource=$(srcdir)/factorySettings.plist \
- --plist=$(srcdir)/Info.plist \
+ --plist Info.plist \
build
find "Python Launcher.app" -name '.svn' -print0 | xargs -0 rm -r
@@ -76,3 +76,6 @@ main.o: $(srcdir)/main.m
Python\ Launcher: $(OBJECTS)
$(CC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon
+
+Info.plist: $(srcdir)/Info.plist.in
+ sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
diff --git a/Mac/OSX/PythonLauncher/MyAppDelegate.h b/Mac/PythonLauncher/MyAppDelegate.h
index 097b54177c..097b54177c 100644
--- a/Mac/OSX/PythonLauncher/MyAppDelegate.h
+++ b/Mac/PythonLauncher/MyAppDelegate.h
diff --git a/Mac/OSX/PythonLauncher/MyAppDelegate.m b/Mac/PythonLauncher/MyAppDelegate.m
index a5ba751078..a5ba751078 100644
--- a/Mac/OSX/PythonLauncher/MyAppDelegate.m
+++ b/Mac/PythonLauncher/MyAppDelegate.m
diff --git a/Mac/OSX/PythonLauncher/MyDocument.h b/Mac/PythonLauncher/MyDocument.h
index 00c1bae54e..00c1bae54e 100755
--- a/Mac/OSX/PythonLauncher/MyDocument.h
+++ b/Mac/PythonLauncher/MyDocument.h
diff --git a/Mac/OSX/PythonLauncher/MyDocument.m b/Mac/PythonLauncher/MyDocument.m
index 5acc2dcc90..5acc2dcc90 100755
--- a/Mac/OSX/PythonLauncher/MyDocument.m
+++ b/Mac/PythonLauncher/MyDocument.m
diff --git a/Mac/OSX/PythonLauncher/PreferencesWindowController.h b/Mac/PythonLauncher/PreferencesWindowController.h
index 63469968c1..63469968c1 100644
--- a/Mac/OSX/PythonLauncher/PreferencesWindowController.h
+++ b/Mac/PythonLauncher/PreferencesWindowController.h
diff --git a/Mac/OSX/PythonLauncher/PreferencesWindowController.m b/Mac/PythonLauncher/PreferencesWindowController.m
index 311c37502b..311c37502b 100644
--- a/Mac/OSX/PythonLauncher/PreferencesWindowController.m
+++ b/Mac/PythonLauncher/PreferencesWindowController.m
diff --git a/Mac/OSX/PythonLauncher/doscript.h b/Mac/PythonLauncher/doscript.h
index eef0b5641f..eef0b5641f 100644
--- a/Mac/OSX/PythonLauncher/doscript.h
+++ b/Mac/PythonLauncher/doscript.h
diff --git a/Mac/OSX/PythonLauncher/doscript.m b/Mac/PythonLauncher/doscript.m
index 3e4e22393c..3e4e22393c 100644
--- a/Mac/OSX/PythonLauncher/doscript.m
+++ b/Mac/PythonLauncher/doscript.m
diff --git a/Mac/OSX/PythonLauncher/factorySettings.plist b/Mac/PythonLauncher/factorySettings.plist
index 120242135c..120242135c 100644
--- a/Mac/OSX/PythonLauncher/factorySettings.plist
+++ b/Mac/PythonLauncher/factorySettings.plist
diff --git a/Mac/OSX/PythonLauncher/main.m b/Mac/PythonLauncher/main.m
index 6841433f42..6841433f42 100755
--- a/Mac/OSX/PythonLauncher/main.m
+++ b/Mac/PythonLauncher/main.m
diff --git a/Mac/OSX/README b/Mac/README
index 1e58b02aa0..1e58b02aa0 100644
--- a/Mac/OSX/README
+++ b/Mac/README
diff --git a/Mac/OSXResources/app/Info.plist b/Mac/Resources/app/Info.plist
index 387bbed2de..387bbed2de 100644
--- a/Mac/OSXResources/app/Info.plist
+++ b/Mac/Resources/app/Info.plist
diff --git a/Mac/OSXResources/app/PkgInfo b/Mac/Resources/app/PkgInfo
index 67c491a8fc..67c491a8fc 100644
--- a/Mac/OSXResources/app/PkgInfo
+++ b/Mac/Resources/app/PkgInfo
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/PackageManager.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/PackageManager.gif
index 2b93dc8d0c..2b93dc8d0c 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/PackageManager.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/PackageManager.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/community.html b/Mac/Resources/app/Resources/English.lproj/Documentation/community.html
index 140a38b2bf..140a38b2bf 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/community.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/community.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/doc/index.html b/Mac/Resources/app/Resources/English.lproj/Documentation/doc/index.html
index 2ce7357a57..2ce7357a57 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/doc/index.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/doc/index.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/finder.html b/Mac/Resources/app/Resources/English.lproj/Documentation/finder.html
index a8877ba885..a8877ba885 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/finder.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/finder.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html b/Mac/Resources/app/Resources/English.lproj/Documentation/gui.html
index 252c78c32f..252c78c32f 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/gui.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/IDE.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/IDE.gif
index da9325d02c..da9325d02c 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/IDE.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/IDE.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif
index baa400ee1b..baa400ee1b 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/entering_in_new_window.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/hello_world.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/hello_world.gif
index c7390af9de..c7390af9de 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/hello_world.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/hello_world.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/index.html b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/index.html
index a169f5e203..a169f5e203 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/index.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/index.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif
index e7cca3de5f..e7cca3de5f 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/loading_ide.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif
index d2022c82a6..d2022c82a6 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/making_new_window.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif
index 7268a84800..7268a84800 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/new_ide_window.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif
index dd6cca3974..dd6cca3974 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/new_window_made.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/output_window.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/output_window.gif
index 568dcb5f4a..568dcb5f4a 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/output_window.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/output_window.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif
index 6e5c9261ea..6e5c9261ea 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/saving_edited_file.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif
index 1dba570083..1dba570083 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/simple_commands.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif
index 2e95b87c83..2e95b87c83 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/ide/syntax_error.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html b/Mac/Resources/app/Resources/English.lproj/Documentation/index.html
index ef12c105a0..ef12c105a0 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/index.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/intro.html b/Mac/Resources/app/Resources/English.lproj/Documentation/intro.html
index f0ab3718bd..f0ab3718bd 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/intro.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/intro.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/packman.html b/Mac/Resources/app/Resources/English.lproj/Documentation/packman.html
index 355e0da8dc..355e0da8dc 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/packman.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/packman.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/python.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/python.gif
index 3d4aa5debc..3d4aa5debc 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/python.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/python.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/pythonsmall.gif b/Mac/Resources/app/Resources/English.lproj/Documentation/pythonsmall.gif
index 440225ee95..440225ee95 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/pythonsmall.gif
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/pythonsmall.gif
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html b/Mac/Resources/app/Resources/English.lproj/Documentation/scripting.html
index 16321cb28e..16321cb28e 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/scripting.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/shell.html b/Mac/Resources/app/Resources/English.lproj/Documentation/shell.html
index 56f564645a..56f564645a 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/Documentation/shell.html
+++ b/Mac/Resources/app/Resources/English.lproj/Documentation/shell.html
diff --git a/Mac/OSXResources/app/Resources/English.lproj/InfoPlist.strings b/Mac/Resources/app/Resources/English.lproj/InfoPlist.strings
index f8a8bc18fe..f8a8bc18fe 100644
--- a/Mac/OSXResources/app/Resources/English.lproj/InfoPlist.strings
+++ b/Mac/Resources/app/Resources/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/PythonApplet.icns b/Mac/Resources/app/Resources/PythonApplet.icns
index c8aad9fc37..c8aad9fc37 100644
--- a/Mac/OSXResources/app/Resources/PythonApplet.icns
+++ b/Mac/Resources/app/Resources/PythonApplet.icns
Binary files differ
diff --git a/Mac/OSXResources/app/Resources/PythonInterpreter.icns b/Mac/Resources/app/Resources/PythonInterpreter.icns
index e09fd381e4..e09fd381e4 100644
--- a/Mac/OSXResources/app/Resources/PythonInterpreter.icns
+++ b/Mac/Resources/app/Resources/PythonInterpreter.icns
Binary files differ
diff --git a/Mac/OSXResources/framework/English.lproj/InfoPlist.strings b/Mac/Resources/framework/English.lproj/InfoPlist.strings
index cc24bfcf3e..cc24bfcf3e 100644
--- a/Mac/OSXResources/framework/English.lproj/InfoPlist.strings
+++ b/Mac/Resources/framework/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/Mac/OSXResources/framework/Info.plist b/Mac/Resources/framework/Info.plist
index 302ff48006..302ff48006 100644
--- a/Mac/OSXResources/framework/Info.plist
+++ b/Mac/Resources/framework/Info.plist
diff --git a/Mac/OSXResources/framework/version.plist b/Mac/Resources/framework/version.plist
index 7527442ab2..7527442ab2 100644
--- a/Mac/OSXResources/framework/version.plist
+++ b/Mac/Resources/framework/version.plist
diff --git a/Mac/OSXResources/iconsrc/IDE.psd b/Mac/Resources/iconsrc/IDE.psd
index b9637b993f..b9637b993f 100644
--- a/Mac/OSXResources/iconsrc/IDE.psd
+++ b/Mac/Resources/iconsrc/IDE.psd
Binary files differ
diff --git a/Mac/OSXResources/iconsrc/PackageManager.psd b/Mac/Resources/iconsrc/PackageManager.psd
index 42f41b125f..42f41b125f 100644
--- a/Mac/OSXResources/iconsrc/PackageManager.psd
+++ b/Mac/Resources/iconsrc/PackageManager.psd
Binary files differ
diff --git a/Mac/OSXResources/iconsrc/PythonApplet.psd b/Mac/Resources/iconsrc/PythonApplet.psd
index 7458b52c57..7458b52c57 100644
--- a/Mac/OSXResources/iconsrc/PythonApplet.psd
+++ b/Mac/Resources/iconsrc/PythonApplet.psd
Binary files differ
diff --git a/Mac/OSXResources/iconsrc/PythonCompiled.psd b/Mac/Resources/iconsrc/PythonCompiled.psd
index 61fc4d18ae..61fc4d18ae 100755
--- a/Mac/OSXResources/iconsrc/PythonCompiled.psd
+++ b/Mac/Resources/iconsrc/PythonCompiled.psd
Binary files differ
diff --git a/Mac/OSXResources/iconsrc/PythonIcon.psd b/Mac/Resources/iconsrc/PythonIcon.psd
index d818dc6a14..d818dc6a14 100755
--- a/Mac/OSXResources/iconsrc/PythonIcon.psd
+++ b/Mac/Resources/iconsrc/PythonIcon.psd
Binary files differ
diff --git a/Mac/OSXResources/iconsrc/PythonSource.psd b/Mac/Resources/iconsrc/PythonSource.psd
index eba8f28d37..eba8f28d37 100755
--- a/Mac/OSXResources/iconsrc/PythonSource.psd
+++ b/Mac/Resources/iconsrc/PythonSource.psd
Binary files differ
diff --git a/Mac/OSXResources/iconsrc/PythonWSource.psd b/Mac/Resources/iconsrc/PythonWSource.psd
index 2b84d94851..2b84d94851 100644
--- a/Mac/OSXResources/iconsrc/PythonWSource.psd
+++ b/Mac/Resources/iconsrc/PythonWSource.psd
Binary files differ
diff --git a/Mac/OSX/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py b/Mac/Tools/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py
index 58d73076df..58d73076df 100644
--- a/Mac/OSX/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py
+++ b/Mac/Tools/Doc/HelpIndexingTool/Help_Indexing_Tool_Suite.py
diff --git a/Mac/OSX/Doc/HelpIndexingTool/Miscellaneous_Standards.py b/Mac/Tools/Doc/HelpIndexingTool/Miscellaneous_Standards.py
index 3cf745f986..3cf745f986 100644
--- a/Mac/OSX/Doc/HelpIndexingTool/Miscellaneous_Standards.py
+++ b/Mac/Tools/Doc/HelpIndexingTool/Miscellaneous_Standards.py
diff --git a/Mac/OSX/Doc/HelpIndexingTool/Required_Suite.py b/Mac/Tools/Doc/HelpIndexingTool/Required_Suite.py
index eb9fee0017..eb9fee0017 100644
--- a/Mac/OSX/Doc/HelpIndexingTool/Required_Suite.py
+++ b/Mac/Tools/Doc/HelpIndexingTool/Required_Suite.py
diff --git a/Mac/OSX/Doc/HelpIndexingTool/Standard_Suite.py b/Mac/Tools/Doc/HelpIndexingTool/Standard_Suite.py
index 4f6604cfeb..4f6604cfeb 100644
--- a/Mac/OSX/Doc/HelpIndexingTool/Standard_Suite.py
+++ b/Mac/Tools/Doc/HelpIndexingTool/Standard_Suite.py
diff --git a/Mac/OSX/Doc/HelpIndexingTool/__init__.py b/Mac/Tools/Doc/HelpIndexingTool/__init__.py
index 5359df53c4..5359df53c4 100644
--- a/Mac/OSX/Doc/HelpIndexingTool/__init__.py
+++ b/Mac/Tools/Doc/HelpIndexingTool/__init__.py
diff --git a/Mac/OSX/Doc/HelpIndexingTool/odds_and_ends.py b/Mac/Tools/Doc/HelpIndexingTool/odds_and_ends.py
index 7ee46f35cc..7ee46f35cc 100644
--- a/Mac/OSX/Doc/HelpIndexingTool/odds_and_ends.py
+++ b/Mac/Tools/Doc/HelpIndexingTool/odds_and_ends.py
diff --git a/Mac/OSX/Doc/README b/Mac/Tools/Doc/README
index 4f4d53d01e..4f4d53d01e 100644
--- a/Mac/OSX/Doc/README
+++ b/Mac/Tools/Doc/README
diff --git a/Mac/OSX/Doc/setup.py b/Mac/Tools/Doc/setup.py
index bd86a20a83..bd86a20a83 100644
--- a/Mac/OSX/Doc/setup.py
+++ b/Mac/Tools/Doc/setup.py
diff --git a/Mac/OSX/fixapplepython23.py b/Mac/Tools/fixapplepython23.py
index 181181ea79..ef352cedb1 100644
--- a/Mac/OSX/fixapplepython23.py
+++ b/Mac/Tools/fixapplepython23.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python
"""fixapplepython23 - Fix Apple-installed Python 2.3 (on Mac OS X 10.3)
Python 2.3 (and 2.3.X for X<5) have the problem that building an extension
diff --git a/Mac/OSX/Tools/pythonw.c b/Mac/Tools/pythonw.c
index e70a76f846..e70a76f846 100644
--- a/Mac/OSX/Tools/pythonw.c
+++ b/Mac/Tools/pythonw.c
diff --git a/Mac/scripts/BuildApplet.py b/Mac/scripts/BuildApplet.py
index 756218f1ff..e71ebc1261 100644
--- a/Mac/scripts/BuildApplet.py
+++ b/Mac/scripts/BuildApplet.py
@@ -16,6 +16,18 @@ import EasyDialogs
import buildtools
import getopt
+if not sys.executable.startswith(sys.exec_prefix):
+ # Oh, the joys of using a python script to bootstrap applicatin bundles
+ # sys.executable points inside the current application bundle. Because this
+ # path contains blanks (two of them actually) this path isn't usable on
+ # #! lines. Reset sys.executable to point to the embedded python interpreter
+ sys.executable = os.path.join(sys.prefix,
+ 'Resources/Python.app/Contents/MacOS/Python')
+
+ # Just in case we're not in a framework:
+ if not os.path.exists(sys.executable):
+ sys.executable = os.path.join(sys.exec_prefix, 'bin/python')
+
def main():
try:
buildapplet()