Check-in [c45f0d9d7c]

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

Overview
Comment:Got instance creation working!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:c45f0d9d7c8870856ffecead249087d3f77f1ff14a7faeb8c2eaaec39aa1a0c5
User & Date: gwlester 2018-02-03 04:37:38
Context
2018-02-03
05:27
Added makefile to create module. check-in: a9112f2b6a user: gwlester tags: trunk, Release_0.5
04:37
Got instance creation working! check-in: c45f0d9d7c user: gwlester tags: trunk
2018-02-02
23:49
Initial implementation. Creation of a new instance does not work. check-in: 5d85eb1bdd user: gwlester tags: trunk
Changes

Changes to src/pyman.tcl.

16
17
18
19
20
21
22
23
24


25














26
27
28
29
30
31
32

        set tclModuleName [join [lrange [split $className {:}] 0 end-2] {:}]
        set pythonModuleName [set ${tclModuleName}::pythonModuleName]
        set pythonClassName [lindex [split $className {:}] end]
        set pythonObject [string map {{::} {_}} [self]]

        ##
        ## Not sure about the line below!!
        ##


        py eval "$pythonObject = $pythonModuleName.${pythonClassName}([join $args ,])"














    }

    classmethod import {args} {
        switch -exact -- [llength $args] {
            1   {
                ##
                ## Just a moduleName







|

>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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

        set tclModuleName [join [lrange [split $className {:}] 0 end-2] {:}]
        set pythonModuleName [set ${tclModuleName}::pythonModuleName]
        set pythonClassName [lindex [split $className {:}] end]
        set pythonObject [string map {{::} {_}} [self]]

        ##
        ## Define a function to create the object and assign it to a global variable
        ##
        set defineInstance {def pymanDefineInstance( objName}
        set createString {globals()[objName] = }
        append createString "$pythonModuleName.${pythonClassName}("
        set argCnt [llength $args]
        for {set i 1} {$i <= $argCnt} {incr i} {
            append defineInstance ", x$i"
            if {$i > 1} {
                append createString ", "
            }
            append createString x$i
        }
        append defineInstance "):"
        append defineInstance "\n    " $createString ")"
        append defineInstance "\n    " "return"

        py eval $defineInstance
        py call pymanDefineInstance $pythonObject {*}$args
    }

    classmethod import {args} {
        switch -exact -- [llength $args] {
            1   {
                ##
                ## Just a moduleName