Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66774a9

Browse files
committed
changes by Jack to Mac docs
1 parent 17f2b2d commit 66774a9

8 files changed

Lines changed: 288 additions & 18 deletions

File tree

Doc/libmac.tex

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@ \chapter{Macintosh Specific Services}
22

33
The modules in this chapter are available on the Apple Macintosh only.
44

5+
Aside from the modules described here there are also interfaces to
6+
various MacOS toolboxes, which are currently not extensively
7+
described. The toolboxes for which modules exist are:
8+
\code{AE} (Apple Events),
9+
\code{Cm} (Component Manager),
10+
\code{Ctl} (Control Manager),
11+
\code{Dlg} (Dialog Manager),
12+
\code{Evt} (Event Manager),
13+
\code{Fm} (Font Manager),
14+
\code{List} (List Manager),
15+
\code{Menu} (Moenu Manager),
16+
\code{Qd} (QuickDraw),
17+
\code{Qt} (QuickTime),
18+
\code{Res} (Resource Manager and Handles),
19+
\code{Scrap} (Scrap Manager),
20+
\code{Snd} (Sound Manager),
21+
\code{TE} (TextEdit),
22+
\code{Waste} (non-Apple TextEdit replacement) and
23+
\code{Win} (Window Manager).
24+
25+
If applicable the module will define a number of Python objects for
26+
the various structures declared by the toolbox, and operations will be
27+
implemented as methods of the object. Other operations will be
28+
implemented as functions in the module. Not all operations possible in
29+
C will also be possible in Python (callbacks are often a problem), and
30+
parameters will occasionally be different in Python (input and output
31+
buffers, especially). All methods and functions have a \code{__doc__}
32+
string describing their arguments and return values, and for
33+
additional description you are referred to Inside Mac or similar
34+
works.
35+
536
\section{Built-in Module \sectcode{mac}}
637

738
\bimodindex{mac}
@@ -12,14 +43,21 @@ \section{Built-in Module \sectcode{mac}}
1243

1344
The following functions are available in this module:
1445
\code{chdir},
46+
\code{close},
47+
\code{dup},
48+
\code{fdopen},
1549
\code{getcwd},
50+
\code{lseek},
1651
\code{listdir},
1752
\code{mkdir},
53+
\code{open},
54+
\code{read},
1855
\code{rename},
1956
\code{rmdir},
2057
\code{stat},
2158
\code{sync},
2259
\code{unlink},
60+
\code{write},
2361
as well as the exception \code{error}.
2462

2563
\section{Standard Module \sectcode{macpath}}
@@ -32,9 +70,13 @@ \section{Standard Module \sectcode{macpath}}
3270

3371
The following functions are available in this module:
3472
\code{normcase},
73+
\code{normpath},
3574
\code{isabs},
3675
\code{join},
3776
\code{split},
3877
\code{isdir},
3978
\code{isfile},
79+
\code{walk},
4080
\code{exists}.
81+
For other functions available in \code{posixpath} dummy counterparts
82+
are available.

Doc/libmacos.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,19 @@ \section{Built-in Module \sectcode{MacOS}}
7272
\begin{funcdesc}{GetErrorString}{errno}
7373
Return the textual description of MacOS error code \var{errno}.
7474
\end{funcdesc}
75+
76+
\begin{funcdesc}{splash}{resid}
77+
This function will put a splash window
78+
on-screen, with the contents of the DLOG resource specified by
79+
\code{resid}. Calling with a zero argument will remove the splash
80+
screen. This function is useful if you want to post a splash screen
81+
early in initialization without first having to load numerous
82+
extension modules.
83+
\end{funcdesc}
84+
85+
\begin{funcdesc}{openrf}{name \optional{\, mode}}
86+
Open the resource fork of a file. Arguments are the same as for the
87+
builtin function \code{open}. The object returned has file-like
88+
semantics, but it is not a python file object, so there may be subtle
89+
differences.
90+
\end{funcdesc}

Doc/libmactcp.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ \section{Built-in Module \sectcode{mactcp}}
66
This module provides an interface to the Macintosh TCP/IP driver
77
MacTCP\@. There is an accompanying module \code{macdnr} which provides an
88
interface to the name-server (allowing you to translate hostnames to
9-
ip-addresses), a module \code{MACTCP} which has symbolic names for
10-
constants constants used by MacTCP and a wrapper module \code{socket}
11-
which mimics the \UNIX{} socket interface (as far as possible). It may
12-
not be available in all Mac Python versions.
9+
ip-addresses), a module \code{MACTCPconst} which has symbolic names for
10+
constants constants used by MacTCP. Since the builtin module
11+
\code{socket} is also available on the mac it is usually easier to use
12+
sockets in stead of the mac-specific MacTCP API.
1313

1414
A complete description of the MacTCP interface can be found in the
1515
Apple MacTCP API documentation.

Doc/libmacui.tex

Lines changed: 82 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ \section{Standard module \sectcode{FrameWork}}
6666

6767
The \code{FrameWork} is still very much work-in-progress, and the
6868
documentation describes only the most important functionality, and not
69-
in the most logical manner at that. Examine the source for more
70-
esoteric needs.
69+
in the most logical manner at that. Examine the source or the examples
70+
for more details.
7171

72-
The \code{EasyDialogs} module defines the following functions:
72+
The \code{FrameWork} module defines the following functions:
7373

7474
\renewcommand{\indexsubitem}{(in module FrameWork)}
7575

@@ -117,6 +117,14 @@ \section{Standard module \sectcode{FrameWork}}
117117
Creates a modeless dialog window.
118118
\end{funcdesc}
119119

120+
\begin{funcdesc}{windowbounds}{width\, height}
121+
Return a \code{(left, top, right, bottom)} tuple suitable for creation
122+
of a window of given width and height. The window will be staggered
123+
with respect to previous windows, and an attempt is made to keep the
124+
whole window on-screen. The window will however always be exact the
125+
size given, so parts may be offscreen.
126+
\end{funcdesc}
127+
120128

121129
\subsection{Application objects}
122130
Application objects have the following methods, among others:
@@ -161,8 +169,9 @@ \subsection{Application objects}
161169
need special handling of dialog events (keyboard shortcuts, etc).
162170
\end{funcdesc}
163171

164-
\begin{funcdesc}{idle}{}
165-
Called by the main event loop when no events are available.
172+
\begin{funcdesc}{idle}{event}
173+
Called by the main event loop when no events are available. The
174+
null-event is passed (so you can look at mouse position, etc).
166175
\end{funcdesc}
167176

168177
\subsection{Window Objects}
@@ -202,6 +211,74 @@ \subsection{Window Objects}
202211
(\code{activate==0}). Handle things like focus highlighting, etc.
203212
\end{funcdesc}
204213

214+
\subsection{ControlsWindow Object}
215+
216+
ControlsWindow objects have the following methods besides those of
217+
\code{Window} objects:
218+
219+
\renewcommand{\indexsubitem}{(ControlsWindow method)}
220+
221+
\begin{funcdesc}{do_controlhit}{window\, control\, pcode\, event}
222+
Part \code{pcode} of control \code{control} was hit by the
223+
user. Tracking and such has already been taken care of.
224+
\end{funcdesc}
225+
226+
\subsection{ScrolledWindow Object}
227+
228+
ScrolledWindow objects are ControlsWindow objects with the following
229+
extra mathods:
230+
231+
\renewcommand{\indexsubitem}{(ScrolledWindow method)}
232+
233+
\begin{funcdesc}{scrollbars}{\optional{wantx\, wanty}}
234+
Create (or destroy) horizontal and vertical scrollbars. The arguments
235+
specify which you want (default: both). The scrollbars always have
236+
minimum \code{0} and maximum \code{32767}.
237+
\end{funcdesc}
238+
239+
\begin{funcdesc}{getscrollbarvalues}{}
240+
You must supply this method. It should return a tuple \code{x, y}
241+
giving the current position of the scrollbars (between \code{0} and
242+
\code{32767}). You can return \code{None} for either to indicate the
243+
whole document is visible in that direction.
244+
\end{funcdesc}
245+
246+
\begin{funcdesc}{updatescrollbars}{}
247+
Call this method when the document has changed. It will call
248+
\code{getscrollbarvalues} and update the scrollbars.
249+
\end{funcdesc}
250+
251+
\begin{funcdesc}{scrollbar_callback}{which\, what\, value}
252+
Supplied by you and called after user interaction. \code{Which} will
253+
be \code{'x'} or \code{'y'}, \code{what} will be \code{'-'},
254+
\code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For
255+
\code{'set'}, \code{value} will contain the new scrollbar position.
256+
\end{funcdesc}
257+
258+
\begin{funcdesc}{scalebarvalues}{absmin\, absmax\, curmin\, curmax}
259+
Auxiliary method to help you calculate values to return from
260+
\code{getscrollbarvalues}. You pass document minimum and maximum value
261+
and topmost (leftmost) and bottommost (rightmost) visible values and
262+
it returns the correct number or \code{None}.
263+
\end{funcdesc}
264+
265+
\begin{funcdesc}{do_activate}{onoff\, event}
266+
Takes care of dimming/highlighting scrollbars when a window becomes
267+
frontmost vv. If you override this method call this one at the end of
268+
your method.
269+
\end{funcdesc}
270+
271+
\begin{funcdesc}{do_postresize}{width\, height\, window}
272+
Moves scrollbars to the correct position. Call this method initially
273+
if you override it.
274+
\end{funcdesc}
275+
276+
\begin{funcdesc}{do_controlhit}{window\, control\, pcode\, event}
277+
Handles scrollbar interaction. If you override it call this method
278+
first, a nonzero return value indicates the hit was in the scrollbars
279+
and has been handled.
280+
\end{funcdesc}
281+
205282
\subsection{DialogWindow Objects}
206283

207284
DialogWindow objects have the following methods besides those of

Doc/mac/libmac.tex

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@ \chapter{Macintosh Specific Services}
22

33
The modules in this chapter are available on the Apple Macintosh only.
44

5+
Aside from the modules described here there are also interfaces to
6+
various MacOS toolboxes, which are currently not extensively
7+
described. The toolboxes for which modules exist are:
8+
\code{AE} (Apple Events),
9+
\code{Cm} (Component Manager),
10+
\code{Ctl} (Control Manager),
11+
\code{Dlg} (Dialog Manager),
12+
\code{Evt} (Event Manager),
13+
\code{Fm} (Font Manager),
14+
\code{List} (List Manager),
15+
\code{Menu} (Moenu Manager),
16+
\code{Qd} (QuickDraw),
17+
\code{Qt} (QuickTime),
18+
\code{Res} (Resource Manager and Handles),
19+
\code{Scrap} (Scrap Manager),
20+
\code{Snd} (Sound Manager),
21+
\code{TE} (TextEdit),
22+
\code{Waste} (non-Apple TextEdit replacement) and
23+
\code{Win} (Window Manager).
24+
25+
If applicable the module will define a number of Python objects for
26+
the various structures declared by the toolbox, and operations will be
27+
implemented as methods of the object. Other operations will be
28+
implemented as functions in the module. Not all operations possible in
29+
C will also be possible in Python (callbacks are often a problem), and
30+
parameters will occasionally be different in Python (input and output
31+
buffers, especially). All methods and functions have a \code{__doc__}
32+
string describing their arguments and return values, and for
33+
additional description you are referred to Inside Mac or similar
34+
works.
35+
536
\section{Built-in Module \sectcode{mac}}
637

738
\bimodindex{mac}
@@ -12,14 +43,21 @@ \section{Built-in Module \sectcode{mac}}
1243

1344
The following functions are available in this module:
1445
\code{chdir},
46+
\code{close},
47+
\code{dup},
48+
\code{fdopen},
1549
\code{getcwd},
50+
\code{lseek},
1651
\code{listdir},
1752
\code{mkdir},
53+
\code{open},
54+
\code{read},
1855
\code{rename},
1956
\code{rmdir},
2057
\code{stat},
2158
\code{sync},
2259
\code{unlink},
60+
\code{write},
2361
as well as the exception \code{error}.
2462

2563
\section{Standard Module \sectcode{macpath}}
@@ -32,9 +70,13 @@ \section{Standard Module \sectcode{macpath}}
3270

3371
The following functions are available in this module:
3472
\code{normcase},
73+
\code{normpath},
3574
\code{isabs},
3675
\code{join},
3776
\code{split},
3877
\code{isdir},
3978
\code{isfile},
79+
\code{walk},
4080
\code{exists}.
81+
For other functions available in \code{posixpath} dummy counterparts
82+
are available.

Doc/mac/libmacos.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,19 @@ \section{Built-in Module \sectcode{MacOS}}
7272
\begin{funcdesc}{GetErrorString}{errno}
7373
Return the textual description of MacOS error code \var{errno}.
7474
\end{funcdesc}
75+
76+
\begin{funcdesc}{splash}{resid}
77+
This function will put a splash window
78+
on-screen, with the contents of the DLOG resource specified by
79+
\code{resid}. Calling with a zero argument will remove the splash
80+
screen. This function is useful if you want to post a splash screen
81+
early in initialization without first having to load numerous
82+
extension modules.
83+
\end{funcdesc}
84+
85+
\begin{funcdesc}{openrf}{name \optional{\, mode}}
86+
Open the resource fork of a file. Arguments are the same as for the
87+
builtin function \code{open}. The object returned has file-like
88+
semantics, but it is not a python file object, so there may be subtle
89+
differences.
90+
\end{funcdesc}

Doc/mac/libmactcp.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ \section{Built-in Module \sectcode{mactcp}}
66
This module provides an interface to the Macintosh TCP/IP driver
77
MacTCP\@. There is an accompanying module \code{macdnr} which provides an
88
interface to the name-server (allowing you to translate hostnames to
9-
ip-addresses), a module \code{MACTCP} which has symbolic names for
10-
constants constants used by MacTCP and a wrapper module \code{socket}
11-
which mimics the \UNIX{} socket interface (as far as possible). It may
12-
not be available in all Mac Python versions.
9+
ip-addresses), a module \code{MACTCPconst} which has symbolic names for
10+
constants constants used by MacTCP. Since the builtin module
11+
\code{socket} is also available on the mac it is usually easier to use
12+
sockets in stead of the mac-specific MacTCP API.
1313

1414
A complete description of the MacTCP interface can be found in the
1515
Apple MacTCP API documentation.

0 commit comments

Comments
 (0)