Check-in [86310cbcdc]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Initial cut of documentation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:86310cbcdcfa171cc28f1881145566bcf4f8fb5d7aec5dae5c4399b89d9d7f2c
User & Date: gwlester 2018-02-06 02:47:20
Context
2018-02-07
01:53
Added #! magic check-in: 584df99cfa user: gwlester tags: trunk
2018-02-06
02:47
Initial cut of documentation. check-in: 86310cbcdc user: gwlester tags: trunk
2018-02-05
21:09
Working example and correction to _setAttribute logic (fix for [ff08074318]). check-in: 36b5f24ce8 user: gwlester tags: trunk, Release_0.5.3
Changes

Added doc/pyman.html.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Python Module Manager for Tcl: Usage</title>
  </head>
  <body>
    <title>Python Module Manager for Tcl</title>
    <h1>Usage</h1>
    <h2>package require pyman</h2>
    <br>
    <h2>pyman&nbsp;addPath <i>pathName</i></h2>
    <ol>
      <p>This will add <i><b>pathName</b></i>&nbsp;to
      the list of directories that Python searches for where to find Python module
      files to be imported.&nbsp; This is roughly akin to <b>lappend</b> of a
      directory to Tcl's <b>auto_path</b> variable or doing a ::tcl::tm::path add to
      add a directory to the directories searched for module files.
      </p>
    </ol>
    <br>

    <h2>pyman import <i>?-namespace nsName?</i> <i>pythonModuleFileName</i></h2>
    <p>
    This will import the Python module and analize the module using the Python
    introspection tools. The following will be done:
    <ol>
      <li>A namespace to contail the Tcl functions and class wrapers for the
      functions and class will be created.&nbsp; If the <b>-namesapce</b>&nbsp;option
      was present than its value, <i>nsName</i>, will be used.&nbsp; Otherwise the
      namespace will be named <b>::pyman::</b><i style="font-weight: bold;">pythonModuleName</i>&nbsp;where
      <i>pythonModuleName</i>&nbsp;is the name of the Python module that was
      imported.</li>
      <li>For each function found in the module, a Tcl wrapper function will be
      generated that take the same arguments and will call the Python function and
      return its results.</li>
      <li>For each class&nbsp; found in the module, a TclOO wrapper class will be
      generated.&nbsp; This class will have the same methods with the same arguments
      as the public methods in the Python class.&nbsp;&nbsp;</li>
      <li>Creation of a new TclOO object of this class will result in a Python object
      of the same class being created.&nbsp;&nbsp;</li>
      <ul>
        <li><u><font color="#ff0000">(Not yet implemented) Calls to class methods of
        the class will call static methods of the Python class.</font></u></li>
        <li>Calls to instance methods of the class will call instance methods of the
        corresponding Python object instances.</li>
        <li>Instance attributes can be accessed via the following special methods:</li>
          <ul>
            <li><b>_attributes <i>?pattern?</i></b> -- Get a list of attributes that match
            the glob style&nbsp;<i style=""><b>pattern</b>&nbsp;</i>and their allowed
            values.&nbsp; &nbsp;The default for <i style="font-weight: bold;">pattern</i>&nbsp;is
            "<b>*</b>".</li>
            <li><b>_getAttribute</b> <b><i>attributeName</i></b> -- Return the value of the
            named attribute.</li>
            <li><b>_setAttribute</b> <b><i>attributeName value</i></b> -- Set the named
            attribute to the specified value. (Note: not all attributes can be modified).</li>
          </ul>
        <li>The Tcl programmer is allowed to add additional methods and/
        <span style="font-size: 13.3333px;">or variables&nbsp;</span>to the&nbsp;
        <span style="font-size: 13.3333px;">TclOO</span>&nbsp;class and/or instances of
        the class, these will only be visble from Tcl.<br>
        </li>
      </ul>
    </ol>
    </p>

  </body>
</html>