| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="mac.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="mac.html" title='Macintosh Library Modules' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="prev" href="module-ic.html" /> |
| 13 | <link rel="parent" href="module-ic.html" /> |
| 14 | <link rel="next" href="module-MacOS.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>2.3.1 IC Objects</title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="2.3 ic " |
| 24 | href="module-ic.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="2.3 ic " |
| 27 | href="module-ic.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="2.4 MacOS " |
| 30 | href="module-MacOS.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Macintosh Library Modules</td> |
| 33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 34 | href="contents.html"><img src='../icons/contents.png' |
| 35 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 37 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 38 | <td class='online-navigation'><a rel="index" title="Index" |
| 39 | href="genindex.html"><img src='../icons/index.png' |
| 40 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 41 | </tr></table> |
| 42 | <div class='online-navigation'> |
| 43 | <b class="navlabel">Previous:</b> |
| 44 | <a class="sectref" rel="prev" href="module-ic.html">2.3 ic </A> |
| 45 | <b class="navlabel">Up:</b> |
| 46 | <a class="sectref" rel="parent" href="module-ic.html">2.3 ic </A> |
| 47 | <b class="navlabel">Next:</b> |
| 48 | <a class="sectref" rel="next" href="module-MacOS.html">2.4 MacOS </A> |
| 49 | </div> |
| 50 | <hr /></div> |
| 51 | </DIV> |
| 52 | <!--End of Navigation Panel--> |
| 53 | |
| 54 | <H2><A NAME="SECTION004310000000000000000"> |
| 55 | 2.3.1 IC Objects</A> |
| 56 | </H2> |
| 57 | |
| 58 | <P> |
| 59 | <tt class="class">IC</tt> objects have a mapping interface, hence to obtain the mail |
| 60 | address you simply get <code><var>ic</var>['MailAddress']</code>. Assignment also |
| 61 | works, and changes the option in the configuration file. |
| 62 | |
| 63 | <P> |
| 64 | The module knows about various datatypes, and converts the internal IC |
| 65 | representation to a ``logical'' Python data structure. Running the |
| 66 | <tt class="module">ic</tt> module standalone will run a test program that lists all |
| 67 | keys and values in your IC database, this will have to serve as |
| 68 | documentation. |
| 69 | |
| 70 | <P> |
| 71 | If the module does not know how to represent the data it returns an |
| 72 | instance of the <code>ICOpaqueData</code> type, with the raw data in its |
| 73 | <tt class="member">data</tt> attribute. Objects of this type are also acceptable values |
| 74 | for assignment. |
| 75 | |
| 76 | <P> |
| 77 | Besides the dictionary interface, <tt class="class">IC</tt> objects have the |
| 78 | following methods: |
| 79 | |
| 80 | <P> |
| 81 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 82 | <td><nobr><b><tt id='l2h-47' xml:id='l2h-47' class="method">launchurl</tt></b>(</nobr></td> |
| 83 | <td><var>url</var><big>[</big><var>, hint</var><big>]</big><var></var>)</td></tr></table></dt> |
| 84 | <dd> |
| 85 | Parse the given URL, launch the correct application and pass it the |
| 86 | URL. The optional <var>hint</var> can be a scheme name such as |
| 87 | <code>'mailto:'</code>, in which case incomplete URLs are completed with this |
| 88 | scheme. If <var>hint</var> is not provided, incomplete URLs are invalid. |
| 89 | </dl> |
| 90 | |
| 91 | <P> |
| 92 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 93 | <td><nobr><b><tt id='l2h-48' xml:id='l2h-48' class="method">parseurl</tt></b>(</nobr></td> |
| 94 | <td><var>data</var><big>[</big><var>, start</var><big>[</big><var>, end</var><big>[</big><var>, hint</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> |
| 95 | <dd> |
| 96 | Find an URL somewhere in <var>data</var> and return start position, end |
| 97 | position and the URL. The optional <var>start</var> and <var>end</var> can be |
| 98 | used to limit the search, so for instance if a user clicks in a long |
| 99 | text field you can pass the whole text field and the click-position in |
| 100 | <var>start</var> and this routine will return the whole URL in which the |
| 101 | user clicked. As above, <var>hint</var> is an optional scheme used to |
| 102 | complete incomplete URLs. |
| 103 | </dl> |
| 104 | |
| 105 | <P> |
| 106 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 107 | <td><nobr><b><tt id='l2h-49' xml:id='l2h-49' class="method">mapfile</tt></b>(</nobr></td> |
| 108 | <td><var>file</var>)</td></tr></table></dt> |
| 109 | <dd> |
| 110 | Return the mapping entry for the given <var>file</var>, which can be passed |
| 111 | as either a filename or an <tt class="function">FSSpec()</tt> result, and which |
| 112 | need not exist. |
| 113 | |
| 114 | <P> |
| 115 | The mapping entry is returned as a tuple <code>(<var>version</var>, |
| 116 | <var>type</var>, <var>creator</var>, <var>postcreator</var>, <var>flags</var>, |
| 117 | <var>extension</var>, <var>appname</var>, <var>postappname</var>, <var>mimetype</var>, |
| 118 | <var>entryname</var>)</code>, where <var>version</var> is the entry version |
| 119 | number, <var>type</var> is the 4-character filetype, <var>creator</var> is the |
| 120 | 4-character creator type, <var>postcreator</var> is the 4-character creator |
| 121 | code of an |
| 122 | optional application to post-process the file after downloading, |
| 123 | <var>flags</var> are various bits specifying whether to transfer in binary |
| 124 | or ascii and such, <var>extension</var> is the filename extension for this |
| 125 | file type, <var>appname</var> is the printable name of the application to |
| 126 | which this file belongs, <var>postappname</var> is the name of the |
| 127 | postprocessing application, <var>mimetype</var> is the MIME type of this |
| 128 | file and <var>entryname</var> is the name of this entry. |
| 129 | </dl> |
| 130 | |
| 131 | <P> |
| 132 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 133 | <td><nobr><b><tt id='l2h-50' xml:id='l2h-50' class="method">maptypecreator</tt></b>(</nobr></td> |
| 134 | <td><var>type, creator</var><big>[</big><var>, filename</var><big>]</big><var></var>)</td></tr></table></dt> |
| 135 | <dd> |
| 136 | Return the mapping entry for files with given 4-character <var>type</var> and |
| 137 | <var>creator</var> codes. The optional <var>filename</var> may be specified to |
| 138 | further help finding the correct entry (if the creator code is |
| 139 | <code>'????'</code>, for instance). |
| 140 | |
| 141 | <P> |
| 142 | The mapping entry is returned in the same format as for <var>mapfile</var>. |
| 143 | </dl> |
| 144 | |
| 145 | <P> |
| 146 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 147 | <td><nobr><b><tt id='l2h-51' xml:id='l2h-51' class="method">settypecreator</tt></b>(</nobr></td> |
| 148 | <td><var>file</var>)</td></tr></table></dt> |
| 149 | <dd> |
| 150 | Given an existing <var>file</var>, specified either as a filename or as an |
| 151 | <tt class="function">FSSpec()</tt> result, set its creator and type correctly based |
| 152 | on its extension. The finder is told about the change, so the finder |
| 153 | icon will be updated quickly. |
| 154 | </dl> |
| 155 | |
| 156 | <DIV CLASS="navigation"> |
| 157 | <div class='online-navigation'> |
| 158 | <p></p><hr /> |
| 159 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 160 | <tr> |
| 161 | <td class='online-navigation'><a rel="prev" title="2.3 ic " |
| 162 | href="module-ic.html"><img src='../icons/previous.png' |
| 163 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 164 | <td class='online-navigation'><a rel="parent" title="2.3 ic " |
| 165 | href="module-ic.html"><img src='../icons/up.png' |
| 166 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 167 | <td class='online-navigation'><a rel="next" title="2.4 MacOS " |
| 168 | href="module-MacOS.html"><img src='../icons/next.png' |
| 169 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 170 | <td align="center" width="100%">Macintosh Library Modules</td> |
| 171 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 172 | href="contents.html"><img src='../icons/contents.png' |
| 173 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 174 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 175 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 176 | <td class='online-navigation'><a rel="index" title="Index" |
| 177 | href="genindex.html"><img src='../icons/index.png' |
| 178 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 179 | </tr></table> |
| 180 | <div class='online-navigation'> |
| 181 | <b class="navlabel">Previous:</b> |
| 182 | <a class="sectref" rel="prev" href="module-ic.html">2.3 ic </A> |
| 183 | <b class="navlabel">Up:</b> |
| 184 | <a class="sectref" rel="parent" href="module-ic.html">2.3 ic </A> |
| 185 | <b class="navlabel">Next:</b> |
| 186 | <a class="sectref" rel="next" href="module-MacOS.html">2.4 MacOS </A> |
| 187 | </div> |
| 188 | </div> |
| 189 | <hr /> |
| 190 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 191 | </DIV> |
| 192 | <!--End of Navigation Panel--> |
| 193 | <ADDRESS> |
| 194 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 195 | </ADDRESS> |
| 196 | </BODY> |
| 197 | </HTML> |