Server : Apache System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : nobody ( 99) PHP Version : 8.1.23 Disable Function : NONE Directory : /usr/share/doc/python-docs-2.7.5/html/library/ |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>37.1. gensuitemodule — Generate OSA stub packages — Python 2.7.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.7.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 2.7.5 documentation" href="../_static/opensearch.xml"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="top" title="Python 2.7.5 documentation" href="../index.html" /> <link rel="up" title="37. MacPython OSA Modules" href="macosa.html" /> <link rel="next" title="37.2. aetools — OSA client support" href="aetools.html" /> <link rel="prev" title="37. MacPython OSA Modules" href="macosa.html" /> <link rel="shortcut icon" type="image/png" href="../_static/py.png" /> <script type="text/javascript" src="../_static/copybutton.js"></script> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="aetools.html" title="37.2. aetools — OSA client support" accesskey="N">next</a> |</li> <li class="right" > <a href="macosa.html" title="37. MacPython OSA Modules" accesskey="P">previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="macosa.html" accesskey="U">37. MacPython OSA Modules</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-gensuitemodule"> <span id="gensuitemodule-generate-osa-stub-packages"></span><h1>37.1. <a class="reference internal" href="#module-gensuitemodule" title="gensuitemodule: Create a stub package from an OSA dictionary (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">gensuitemodule</span></tt></a> — Generate OSA stub packages<a class="headerlink" href="#module-gensuitemodule" title="Permalink to this headline">¶</a></h1> <p>The <a class="reference internal" href="#module-gensuitemodule" title="gensuitemodule: Create a stub package from an OSA dictionary (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">gensuitemodule</span></tt></a> module creates a Python package implementing stub code for the AppleScript suites that are implemented by a specific application, according to its AppleScript dictionary.</p> <p>It is usually invoked by the user through the <strong class="program">PythonIDE</strong>, but it can also be run as a script from the command line (pass <a class="reference internal" href="../using/cmdline.html#cmdoption--help"><em class="xref std std-option">--help</em></a> for help on the options) or imported from Python code. For an example of its use see <tt class="file docutils literal"><span class="pre">Mac/scripts/genallsuites.py</span></tt> in a source distribution, which generates the stub packages that are included in the standard library.</p> <p>It defines the following public functions:</p> <dl class="function"> <dt id="gensuitemodule.is_scriptable"> <tt class="descclassname">gensuitemodule.</tt><tt class="descname">is_scriptable</tt><big>(</big><em>application</em><big>)</big><a class="headerlink" href="#gensuitemodule.is_scriptable" title="Permalink to this definition">¶</a></dt> <dd><p>Returns true if <tt class="docutils literal"><span class="pre">application</span></tt>, which should be passed as a pathname, appears to be scriptable. Take the return value with a grain of salt: <strong class="program">Internet Explorer</strong> appears not to be scriptable but definitely is.</p> </dd></dl> <dl class="function"> <dt id="gensuitemodule.processfile"> <tt class="descclassname">gensuitemodule.</tt><tt class="descname">processfile</tt><big>(</big><em>application</em><span class="optional">[</span>, <em>output</em>, <em>basepkgname</em>, <em>edit_modnames</em>, <em>creatorsignature</em>, <em>dump</em>, <em>verbose</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#gensuitemodule.processfile" title="Permalink to this definition">¶</a></dt> <dd><p>Create a stub package for <tt class="docutils literal"><span class="pre">application</span></tt>, which should be passed as a full pathname. For a <tt class="file docutils literal"><span class="pre">.app</span></tt> bundle this is the pathname to the bundle, not to the executable inside the bundle; for an unbundled CFM application you pass the filename of the application binary.</p> <p>This function asks the application for its OSA terminology resources, decodes these resources and uses the resultant data to create the Python code for the package implementing the client stubs.</p> <p><tt class="docutils literal"><span class="pre">output</span></tt> is the pathname where the resulting package is stored, if not specified a standard “save file as” dialog is presented to the user. <tt class="docutils literal"><span class="pre">basepkgname</span></tt> is the base package on which this package will build, and defaults to <tt class="xref py py-mod docutils literal"><span class="pre">StdSuites</span></tt>. Only when generating <tt class="xref py py-mod docutils literal"><span class="pre">StdSuites</span></tt> itself do you need to specify this. <tt class="docutils literal"><span class="pre">edit_modnames</span></tt> is a dictionary that can be used to change modulenames that are too ugly after name mangling. <tt class="docutils literal"><span class="pre">creator_signature</span></tt> can be used to override the 4-char creator code, which is normally obtained from the <tt class="file docutils literal"><span class="pre">PkgInfo</span></tt> file in the package or from the CFM file creator signature. When <tt class="docutils literal"><span class="pre">dump</span></tt> is given it should refer to a file object, and <tt class="docutils literal"><span class="pre">processfile</span></tt> will stop after decoding the resources and dump the Python representation of the terminology resources to this file. <tt class="docutils literal"><span class="pre">verbose</span></tt> should also be a file object, and specifying it will cause <tt class="docutils literal"><span class="pre">processfile</span></tt> to tell you what it is doing.</p> </dd></dl> <dl class="function"> <dt id="gensuitemodule.processfile_fromresource"> <tt class="descclassname">gensuitemodule.</tt><tt class="descname">processfile_fromresource</tt><big>(</big><em>application</em><span class="optional">[</span>, <em>output</em>, <em>basepkgname</em>, <em>edit_modnames</em>, <em>creatorsignature</em>, <em>dump</em>, <em>verbose</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#gensuitemodule.processfile_fromresource" title="Permalink to this definition">¶</a></dt> <dd><p>This function does the same as <tt class="docutils literal"><span class="pre">processfile</span></tt>, except that it uses a different method to get the terminology resources. It opens <tt class="docutils literal"><span class="pre">application</span></tt> as a resource file and reads all <tt class="docutils literal"><span class="pre">"aete"</span></tt> and <tt class="docutils literal"><span class="pre">"aeut"</span></tt> resources from this file.</p> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="macosa.html" title="previous chapter">37. MacPython OSA Modules</a></p> <h4>Next topic</h4> <p class="topless"><a href="aetools.html" title="next chapter">37.2. <tt class="docutils literal"><span class="pre">aetools</span></tt> — OSA client support</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li><a href="../_sources/library/gensuitemodule.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="aetools.html" title="37.2. aetools — OSA client support" >next</a> |</li> <li class="right" > <a href="macosa.html" title="37. MacPython OSA Modules" >previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="macosa.html" >37. MacPython OSA Modules</a> »</li> </ul> </div> <div class="footer"> © <a href="../copyright.html">Copyright</a> 1990-2020, Python Software Foundation. <br /> The Python Software Foundation is a non-profit corporation. <a href="http://www.python.org/psf/donations/">Please donate.</a> <br /> Last updated on Oct 13, 2020. <a href="../bugs.html">Found a bug</a>? <br /> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>