1
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6
7<html xmlns="http://www.w3.org/1999/xhtml">
8  <head>
9    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10    
11    <title>PyObjCTools.Conversion – Convert data structures &mdash; PyObjC-Core 2.5.0b1 documentation</title>
12    
13    <link rel="stylesheet" href="/_static/default.css" type="text/css" />
14    <link rel="stylesheet" href="/_static/pygments.css" type="text/css" />
15    
16    <script type="text/javascript">
17      var DOCUMENTATION_OPTIONS = {
18        URL_ROOT:    '../',
19        VERSION:     '2.5.0b1',
20        COLLAPSE_INDEX: false,
21        FILE_SUFFIX: '.html',
22        HAS_SOURCE:  true
23      };
24    </script>
25    <script type="text/javascript" src="/_static/jquery.js"></script>
26    <script type="text/javascript" src="/_static/underscore.js"></script>
27    <script type="text/javascript" src="/_static/doctools.js"></script>
28    <link rel="top" title="PyObjC-Core 2.5.0b1 documentation" href="/index.html" />
29    <link rel="up" title="PyObjCTools – Utilities" href="module-PyObjCTools.html" />
30    <link rel="next" title="PyObjCTools.NibClassBuilder – Magic NIBs" href="module-PyObjCTools.NibClassBuilder.html" />
31    <link rel="prev" title="PyObjCTools.AppHelper – Work with AppKit" href="module-PyObjCTools.AppHelper.html" /> 
32  </head>
33  <body>
34    <div class="related">
35      <h3>Navigation</h3>
36      <ul>
37        <li class="right" style="margin-right: 10px">
38          <a href="/genindex.html" title="General Index"
39             accesskey="I">index</a></li>
40        <li class="right" >
41          <a href="/py-modindex.html" title="Python Module Index"
42             >modules</a> |</li>
43        <li class="right" >
44          <a href="module-PyObjCTools.NibClassBuilder.html" title="PyObjCTools.NibClassBuilder – Magic NIBs"
45             accesskey="N">next</a> |</li>
46        <li class="right" >
47          <a href="module-PyObjCTools.AppHelper.html" title="PyObjCTools.AppHelper – Work with AppKit"
48             accesskey="P">previous</a> |</li>
49        <li><a href="/index.html">PyObjC-Core 2.5.0b1 documentation</a> &raquo;</li>
50          <li><a href="index.html" >Python API</a> &raquo;</li>
51          <li><a href="module-PyObjCTools.html" accesskey="U"><tt class="docutils literal docutils literal docutils literal"><span class="pre">PyObjCTools</span></tt> &#8211; Utilities</a> &raquo;</li> 
52      </ul>
53    </div>  
54
55    <div class="document">
56      <div class="documentwrapper">
57        <div class="bodywrapper">
58          <div class="body">
59            
60  <div class="section" id="module-PyObjCTools.Conversion">
61<span id="pyobjctools-conversion-convert-data-structures"></span><h1><a class="reference internal" href="#module-PyObjCTools.Conversion" title="PyObjCTools.Conversion: Convert data structures"><tt class="xref py py-mod docutils literal"><span class="pre">PyObjCTools.Conversion</span></tt></a> &#8211; Convert data structures<a class="headerlink" href="#module-PyObjCTools.Conversion" title="Permalink to this headline">¶</a></h1>
62<p>Functions for converting between Cocoa and pure Python data structures.</p>
63<dl class="function">
64<dt id="PyObjCTools.Conversion.propertyListFromPythonCollection">
65<tt class="descclassname">PyObjCTools.Conversion.</tt><tt class="descname">propertyListFromPythonCollection</tt><big>(</big><em>pyCol</em>, <em>conversionHelper=None</em><big>)</big><a class="headerlink" href="#PyObjCTools.Conversion.propertyListFromPythonCollection" title="Permalink to this definition">¶</a></dt>
66<dd><p>Convert a Python collection (dictionary, array, tuple, string) into an
67Objective-C collection.</p>
68<p>If conversionHelper is defined, it must be a callable.  It will be called
69for any object encountered for which <tt class="docutils literal"><span class="pre">propertyListFromPythonCollection()</span></tt>
70cannot automatically convert the object.   The supplied helper function
71should convert the object and return the converted form.  If the conversion
72helper cannot convert the type, it should raise an exception or return None.</p>
73</dd></dl>
74
75<dl class="function">
76<dt id="PyObjCTools.Conversion.pythonCollectionFromPropertyList">
77<tt class="descclassname">PyObjCTools.Conversion.</tt><tt class="descname">pythonCollectionFromPropertyList</tt><big>(</big><em>ocCol</em>, <em>conversionHelper=None</em><big>)</big><a class="headerlink" href="#PyObjCTools.Conversion.pythonCollectionFromPropertyList" title="Permalink to this definition">¶</a></dt>
78<dd><p>Converts a Foundation based collection&#8211; a property list&#8211; into a Python
79collection.  Like <tt class="docutils literal"><span class="pre">propertyListFromPythonCollection()</span></tt>, <tt class="docutils literal"><span class="pre">conversionHelper</span></tt>
80is an optional callable that will be invoked any time an encountered object
81cannot be converted.</p>
82</dd></dl>
83
84</div>
85
86
87          </div>
88        </div>
89      </div>
90      <div class="sphinxsidebar">
91        <div class="sphinxsidebarwrapper">
92  <h4>Previous topic</h4>
93  <p class="topless"><a href="module-PyObjCTools.AppHelper.html"
94                        title="previous chapter"><tt class="docutils literal docutils literal"><span class="pre">PyObjCTools.AppHelper</span></tt> &#8211; Work with AppKit</a></p>
95  <h4>Next topic</h4>
96  <p class="topless"><a href="module-PyObjCTools.NibClassBuilder.html"
97                        title="next chapter"><tt class="docutils literal"><span class="pre">PyObjCTools.NibClassBuilder</span></tt> &#8211; Magic NIBs</a></p>
98  <h3>This Page</h3>
99  <ul class="this-page-menu">
100    <li><a href="/_sources/lib/module-PyObjCTools.Conversion.txt"
101           rel="nofollow">Show Source</a></li>
102  </ul>
103<div id="searchbox" style="display: none">
104  <h3>Quick search</h3>
105    <form class="search" action="/search.html" method="get">
106      <input type="text" name="q" />
107      <input type="submit" value="Go" />
108      <input type="hidden" name="check_keywords" value="yes" />
109      <input type="hidden" name="area" value="default" />
110    </form>
111    <p class="searchtip" style="font-size: 90%">
112    Enter search terms or a module, class or function name.
113    </p>
114</div>
115<script type="text/javascript">$('#searchbox').show(0);</script>
116        </div>
117      </div>
118      <div class="clearer"></div>
119    </div>
120    <div class="related">
121      <h3>Navigation</h3>
122      <ul>
123        <li class="right" style="margin-right: 10px">
124          <a href="/genindex.html" title="General Index"
125             >index</a></li>
126        <li class="right" >
127          <a href="/py-modindex.html" title="Python Module Index"
128             >modules</a> |</li>
129        <li class="right" >
130          <a href="module-PyObjCTools.NibClassBuilder.html" title="PyObjCTools.NibClassBuilder – Magic NIBs"
131             >next</a> |</li>
132        <li class="right" >
133          <a href="module-PyObjCTools.AppHelper.html" title="PyObjCTools.AppHelper – Work with AppKit"
134             >previous</a> |</li>
135        <li><a href="/index.html">PyObjC-Core 2.5.0b1 documentation</a> &raquo;</li>
136          <li><a href="index.html" >Python API</a> &raquo;</li>
137          <li><a href="module-PyObjCTools.html" ><tt class="docutils literal docutils literal docutils literal"><span class="pre">PyObjCTools</span></tt> &#8211; Utilities</a> &raquo;</li> 
138      </ul>
139    </div>
140    <div class="footer">
141        &copy; Copyright 2009-2012, Ronald Oussoren.
142      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
143    </div>
144  </body>
145</html>