This is Info file /home/pdm/tmp/Python-1.5.2p1/Doc/mac/python-mac.info, produced by Makeinfo version 1.68 from the input file mac.texi. July 6, 1999 1.5.2  File: python-mac.info, Node: Application Objects, Next: Window Objects, Prev: FrameWork, Up: FrameWork Application Objects ------------------- Application objects have the following methods, among others: `makeusermenus()' Override this method if you need menus in your application. Append the menus to the attribute `menubar'. `getabouttext()' Override this method to return a text string describing your application. Alternatively, override the `do_about()' method for more elaborate "about" messages. `mainloop([mask[, wait]])' This routine is the main event loop, call it to set your application rolling. MASK is the mask of events you want to handle, WAIT is the number of ticks you want to leave to other concurrent application (default 0, which is probably not a good idea). While raising SELF to exit the mainloop is still supported it is not recommended: call `self._quit()' instead. The event loop is split into many small parts, each of which can be overridden. The default methods take care of dispatching events to windows and dialogs, handling drags and resizes, Apple Events, events for non-FrameWork windows, etc. In general, all event handlers should return `1' if the event is fully handled and `0' otherwise (because the front window was not a FrameWork window, for instance). This is needed so that update events and such can be passed on to other windows like the Sioux console window. Calling `MacOS.HandleEvent()' is not allowed within OUR_DISPATCH or its callees, since this may result in an infinite loop if the code is called through the Python inner-loop event handler. `asyncevents(onoff)' Call this method with a nonzero parameter to enable asynchronous event handling. This will tell the inner interpreter loop to call the application event handler ASYNC_DISPATCH whenever events are available. This will cause FrameWork window updates and the user interface to remain working during long computations, but will slow the interpreter down and may cause surprising results in non-reentrant code (such as FrameWork itself). By default ASYNC_DISPATCH will immedeately call OUR_DISPATCH but you may override this to handle only certain events asynchronously. Events you do not handle will be passed to Sioux and such. The old on/off value is returned. `_quit()' Terminate the running `mainloop()' call at the next convenient moment. `do_char(c, event)' The user typed character C. The complete details of the event can be found in the EVENT structure. This method can also be provided in a `Window' object, which overrides the application-wide handler if the window is frontmost. `do_dialogevent(event)' Called early in the event loop to handle modeless dialog events. The default method simply dispatches the event to the relevant dialog (not through the the `DialogWindow' object involved). Override if you need special handling of dialog events (keyboard shortcuts, etc). `idle(event)' Called by the main event loop when no events are available. The null-event is passed (so you can look at mouse position, etc).  File: python-mac.info, Node: Window Objects, Next: ControlsWindow Object, Prev: Application Objects, Up: FrameWork Window Objects -------------- Window objects have the following methods, among others: `open()' Override this method to open a window. Store the MacOS window-id in `self.wid' and call the `do_postopen()' method to register the window with the parent application. `close()' Override this method to do any special processing on window close. Call the `do_postclose()' method to cleanup the parent state. `do_postresize(width, height, macoswindowid)' Called after the window is resized. Override if more needs to be done than calling `InvalRect'. `do_contentclick(local, modifiers, event)' The user clicked in the content part of a window. The arguments are the coordinates (window-relative), the key modifiers and the raw event. `do_update(macoswindowid, event)' An update event for the window was received. Redraw the window. `do_activate(activate, event)' The window was activated (`ACTIVATE == 1') or deactivated (`ACTIVATE == 0'). Handle things like focus highlighting, etc.  File: python-mac.info, Node: ControlsWindow Object, Next: ScrolledWindow Object, Prev: Window Objects, Up: FrameWork ControlsWindow Object --------------------- ControlsWindow objects have the following methods besides those of `Window' objects: `do_controlhit(window, control, pcode, event)' Part PCODE of control CONTROL was hit by the user. Tracking and such has already been taken care of.  File: python-mac.info, Node: ScrolledWindow Object, Next: DialogWindow Objects, Prev: ControlsWindow Object, Up: FrameWork ScrolledWindow Object --------------------- ScrolledWindow objects are ControlsWindow objects with the following extra methods: `scrollbars([wantx[, wanty]])' Create (or destroy) horizontal and vertical scrollbars. The arguments specify which you want (default: both). The scrollbars always have minimum `0' and maximum `32767'. `getscrollbarvalues()' You must supply this method. It should return a tuple `(X, Y)' giving the current position of the scrollbars (between `0' and `32767'). You can return `None' for either to indicate the whole document is visible in that direction. `updatescrollbars()' Call this method when the document has changed. It will call `getscrollbarvalues()' and update the scrollbars. `scrollbar_callback(which, what, value)' Supplied by you and called after user interaction. WHICH will be `'x'' or `'y'', WHAT will be `'-'', `'--'', `'set'', `'++'' or `'+''. For `'set'', VALUE will contain the new scrollbar position. `scalebarvalues(absmin, absmax, curmin, curmax)' Auxiliary method to help you calculate values to return from `getscrollbarvalues()'. You pass document minimum and maximum value and topmost (leftmost) and bottommost (rightmost) visible values and it returns the correct number or `None'. `do_activate(onoff, event)' Takes care of dimming/highlighting scrollbars when a window becomes frontmost vv. If you override this method call this one at the end of your method. `do_postresize(width, height, window)' Moves scrollbars to the correct position. Call this method initially if you override it. `do_controlhit(window, control, pcode, event)' Handles scrollbar interaction. If you override it call this method first, a nonzero return value indicates the hit was in the scrollbars and has been handled.  File: python-mac.info, Node: DialogWindow Objects, Prev: ScrolledWindow Object, Up: FrameWork DialogWindow Objects -------------------- DialogWindow objects have the following methods besides those of `Window' objects: `open(resid)' Create the dialog window, from the DLOG resource with id RESID. The dialog object is stored in `self.wid'. `do_itemhit(item, event)' Item number ITEM was hit. You are responsible for redrawing toggle buttons, etc.  File: python-mac.info, Node: MiniAEFrame, Prev: FrameWork, Up: Front Matter Open Scripting Architecture server support ========================================== Support to act as an Open Scripting Architecture (OSA) server ("Apple Events"). The module `MiniAEFrame' provides a framework for an application that can function as an Open Scripting Architecture (OSA) server, i.e. receive and process AppleEvents. It can be used in conjunction with `FrameWork' or standalone. This module is temporary, it will eventually be replaced by a module that handles argument names better and possibly automates making your application scriptable. The `MiniAEFrame' module defines the following classes: `AEServer()' A class that handles AppleEvent dispatch. Your application should subclass this class together with either `MiniApplication' or `FrameWork.Application'. Your `__init__()' method should call the `__init__()' method for both classes. `MiniApplication()' A class that is more or less compatible with `FrameWork.Application' but with less functionality. Its event loop supports the apple menu, command-dot and AppleEvents; other events are passed on to the Python interpreter and/or Sioux. Useful if your application wants to use `AEServer' but does not provide its own windows, etc. * Menu: * AEServer Objects::  File: python-mac.info, Node: AEServer Objects, Prev: MiniAEFrame, Up: MiniAEFrame AEServer Objects ---------------- `installaehandler(classe, type, callback)' Installs an AppleEvent handler. CLASSE and TYPE are the four-character OSA Class and Type designators, `'****'' wildcards are allowed. When a matching AppleEvent is received the parameters are decoded and your callback is invoked. `callback(_object, **kwargs)' Your callback is called with the OSA Direct Object as first positional parameter. The other parameters are passed as keyword arguments, with the 4-character designator as name. Three extra keyword parameters are passed: `_class' and `_type' are the Class and Type designators and `_attributes' is a dictionary with the AppleEvent attributes. The return value of your method is packed with `aetools.packevent()' and sent as reply. Note that there are some serious problems with the current design. AppleEvents which have non-identifier 4-character designators for arguments are not implementable, and it is not possible to return an error to the originator. This will be addressed in a future release.  File: python-mac.info, Node: Module Index, Next: Class-Exception-Object Index, Prev: Front Matter, Up: Top Module Index ************ * Menu: * FrameWork: MiniAEFrame. * icglue: ic. * macdnr: mactcp. * macerrors: MacOS. * MACTCPconst: mactcp. * os: mac. * os.path: macpath. * socket: mactcp. * stdwin: EasyDialogs.  File: python-mac.info, Node: Class-Exception-Object Index, Next: Function-Method-Variable Index, Prev: Module Index, Up: Top Class, Exception, and Object Index ********************************** * Menu: * AEServer: MiniAEFrame. * Error: MacOS. * error: ic. * IC: ic. * MiniApplication: MiniAEFrame.  File: python-mac.info, Node: Function-Method-Variable Index, Next: Miscellaneous Index, Prev: Class-Exception-Object Index, Up: Top Function, Method, and Variable Index ************************************ * Menu: * _quit: Application Objects. * Abort <1>: TCP Stream Objects. * Abort: Connection Objects. * accept: Connection Objects. * ActiveOpen: TCP Stream Objects. * AddrToName: macdnr. * AddrToStr: macdnr. * amtUnackedData: TCP Status Objects. * amtUnreadData: TCP Status Objects. * Application: FrameWork. * as_pathname: FSSpec objects. * as_tuple: FSSpec objects. * AskString: EasyDialogs. * AskYesNoCancel: EasyDialogs. * asr <1>: UDP Stream Objects. * asr: TCP Stream Objects. * asyncevents: Application Objects. * Available: macspeech. * available: ctb. * Break: Connection Objects. * BUFSIZ: macostools. * Busy: macspeech. * C_CBREAK: macconsole. * C_ECHO: macconsole. * C_NOECHO: macconsole. * C_RAW: macconsole. * callback <1>: AEServer Objects. * callback: Connection Objects. * Choose: Connection Objects. * choose*: ctb. * cleol: console window object. * cleos: console window object. * close: Window Objects. * Close <1>: TCP Stream Objects. * Close <2>: macdnr. * Close: Connection Objects. * cmAttn: ctb. * cmCntl: ctb. * cmData: ctb. * cmFlagsEOM: ctb. * CMNew: ctb. * cmStatus*: ctb. * cname: DNR Result Objects. * copen: macconsole. * copy <1>: findertools. * copy: macostools. * copytree: macostools. * CountVoices: macspeech. * cpuType: DNR Result Objects. * Creator: FInfo Objects. * data <1>: Alias Objects. * data: FSSpec objects. * DebugStr: MacOS. * DialogWindow: FrameWork. * do_activate <1>: ScrolledWindow Object. * do_activate: Window Objects. * do_char: Application Objects. * do_contentclick: Window Objects. * do_controlhit <1>: ScrolledWindow Object. * do_controlhit: ControlsWindow Object. * do_dialogevent: Application Objects. * do_itemhit: DialogWindow Objects. * do_postresize <1>: ScrolledWindow Object. * do_postresize: Window Objects. * do_update: Window Objects. * echo2printer: console window object. * error: ctb. * exchange: DNR Result Objects. * file: console window object. * FindApplication: macfs. * FindFolder: macfs. * FInfo: macfs. * Flags: FInfo Objects. * Fldr: FInfo Objects. * fopen: macconsole. * FSSpec: macfs. * getabouttext: Application Objects. * GetConfig: Connection Objects. * GetCreatorType: FSSpec objects. * GetDates: FSSpec objects. * GetDirectory: macfs. * GetErrorString: MacOS. * GetFInfo: FSSpec objects. * GetGender: Voice Objects. * GetIndVoice: macspeech. * GetInfo: Alias Objects. * GetPitch: Speech Channel Objects. * GetRate: Speech Channel Objects. * getscrollbarvalues: ScrolledWindow Object. * GetSockName: TCP Stream Objects. * gotoxy: console window object. * HandleEvent: MacOS. * hide: console window object. * HInfo: macdnr. * idle: Application Objects. * Idle: Connection Objects. * installaehandler: AEServer Objects. * inverse: console window object. * ip0: DNR Result Objects. * ip1: DNR Result Objects. * ip2: DNR Result Objects. * ip3: DNR Result Objects. * IPAddr: mactcp. * isdone <1>: TCP Stream Objects. * isdone: DNR Result Objects. * launch: findertools. * launchurl <1>: IC Objects. * launchurl: ic. * left: macconsole options object. * Listen: Connection Objects. * localHost: TCP Status Objects. * localPort: TCP Status Objects. * Location: FInfo Objects. * mainloop: Application Objects. * makeusermenus: Application Objects. * mapfile: IC Objects. * maptypecreator: IC Objects. * Menu: FrameWork. * MenuBar: FrameWork. * MenuItem: FrameWork. * Message: EasyDialogs. * mkalias: macostools. * move: findertools. * MTU: mactcp. * MXInfo: macdnr. * ncols: macconsole options object. * NetMask: mactcp. * NewAlias: FSSpec objects. * NewAliasMinimal: FSSpec objects. * NewAliasMinimalFromFullPath: macfs. * NewChannel: Voice Objects. * nrows: macconsole options object. * open <1>: DialogWindow Objects. * open: Window Objects. * Open <1>: macdnr. * Open: Connection Objects. * openrf: MacOS. * options: macconsole. * osType: DNR Result Objects. * parseurl: IC Objects. * PassiveOpen: TCP Stream Objects. * pause_atexit: macconsole options object. * port: UDP Stream Objects. * preference: DNR Result Objects. * Print: findertools. * ProgressBar: EasyDialogs. * PromptGetFile: macfs. * RawAlias: macfs. * RawFSSpec: macfs. * Rcv: TCP Stream Objects. * Read <1>: UDP Stream Objects. * Read: Connection Objects. * remoteHost: TCP Status Objects. * remotePort: TCP Status Objects. * Reset: Connection Objects. * Resolve: Alias Objects. * ResolveAliasFile: macfs. * restart: findertools. * rtnCode: DNR Result Objects. * scalebarvalues: ScrolledWindow Object. * SchedParams: MacOS. * scrollbar_callback: ScrolledWindow Object. * scrollbars: ScrolledWindow Object. * Send: TCP Stream Objects. * sendWindow: TCP Status Objects. * Separator: FrameWork. * setarrowcursor: FrameWork. * SetConfig: Connection Objects. * SetCreatorType: FSSpec objects. * SetDates: FSSpec objects. * SetEventHandler: MacOS. * SetFInfo: FSSpec objects. * SetFolder: macfs. * setmode: console window object. * SetPitch: Speech Channel Objects. * SetRate: Speech Channel Objects. * settabs: console window object. * settypecreator: IC Objects. * setwatchcursor: FrameWork. * show: console window object. * shutdown: findertools. * sleep: findertools. * SpeakString: macspeech. * SpeakText: Speech Channel Objects. * splash: MacOS. * StandardGetFile: macfs. * StandardPutFile: macfs. * Status <1>: TCP Stream Objects. * Status: Connection Objects. * Stop: Speech Channel Objects. * StrToAddr: macdnr. * SubMenu: FrameWork. * TCPCreate: mactcp. * title: macconsole options object. * top: macconsole options object. * touched: macostools. * txFont: macconsole options object. * txSize: macconsole options object. * txStyle: macconsole options object. * Type: FInfo Objects. * UDPCreate: mactcp. * Update: Alias Objects. * updatescrollbars: ScrolledWindow Object. * Version: macspeech. * wait <1>: TCP Stream Objects. * wait: DNR Result Objects. * Window: FrameWork. * windowbounds: FrameWork. * Write <1>: UDP Stream Objects. * Write: Connection Objects. * xstat: mac.  File: python-mac.info, Node: Miscellaneous Index, Prev: Function-Method-Variable Index, Up: Top Miscellaneous Index ******************* * Menu: * (console window attribute): console window object. * (console window method): console window object. * (macconsole option): macconsole options object. * (voice object method): Voice Objects. * (Window method): Window Objects. * Alias Manager, Macintosh: macfs. * AppleEvents <1>: MiniAEFrame. * AppleEvents: findertools. * asynchronous service routine <1>: UDP Stream Objects. * asynchronous service routine: TCP Stream Objects. * Communications Toolbox, Macintosh: ctb. * Connection Manager: ctb. * ctb: ctb. * Domain Name Resolver, Macintosh: macdnr. * EasyDialogs: EasyDialogs. * findertools: findertools. * FrameWork: FrameWork. * ic: ic. * Internet Config: ic. * mac: mac. * macconsole: macconsole. * macdnr: macdnr. * macfs: macfs. * Macintosh Alias Manager: macfs. * Macintosh Communications Toolbox: ctb. * Macintosh Domain Name Resolver: macdnr. * Macintosh Speech Manager: macspeech. * MacOS: MacOS. * macostools: macostools. * macpath: macpath. * macspeech: macspeech. * MacTCP: mactcp. * mactcp: mactcp. * Maximum Transmit Unit: mactcp. * MiniAEFrame: MiniAEFrame. * Open Scripting Architecture: MiniAEFrame. * service routine, asynchronous <1>: UDP Stream Objects. * service routine, asynchronous: TCP Stream Objects. * SMTP: macdnr. * Speech Manager, Macintosh: macspeech. * Standard File: macfs.