Changeset 22 for trunk/tcl/scripts


Ignore:
Timestamp:
Jul 16, 2005 2:31:32 PM (17 years ago)
Author:
mmc
Message:

Lots of changes to support Huckel-IV:

  • Support for embedded <tool> declarations
  • New <integer> entry
  • Support for numbers and structures as output elements
  • Atom numbers/symbols in MoleculeViewer?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tcl/scripts/library.tcl

    r13 r22  
    127127                }
    128128                structure {
     129                    # add this to the return list with the right flavor
     130                    if {$params(-as) == "component"} {
     131                        lappend rlist $cpath
     132                    } else {
     133                        lappend rlist [$xmlobj element -as $params(-as) $cpath]
     134                    }
     135
    129136                    if {[$xmlobj element $cpath.current.parameters] != ""} {
    130137                        lappend queue $cpath.current.parameters
     
    163170    public method get {{path ""}}
    164171    public method put {args}
     172    public method copy {path from args}
    165173    public method remove {{path ""}}
    166174    public method xml {}
     
    169177    public proc value {libobj path}
    170178
     179    public proc path2list {path}
    171180    protected method find {path}
    172     protected method path2list {path}
    173181    protected method node2name {node}
    174182    protected method node2comp {node}
     
    515523    }
    516524    return ""
     525}
     526
     527# ----------------------------------------------------------------------
     528# USAGE: copy <path> from ?<xmlobj>? <path>
     529#
     530# Clients use this to copy the value from one xmlobj/path to another.
     531# If the <xmlobj> is not specified, it is assumed to be the same as
     532# the current object.
     533# ----------------------------------------------------------------------
     534itcl::body Rappture::LibraryObj::copy {path from args} {
     535    if {[llength $args] == 1} {
     536        set xmlobj $this
     537        set fpath [lindex $args 0]
     538    } elseif {[llength $args] == 2} {
     539        set xmlobj [lindex $args 0]
     540        set fpath [lindex $args 1]
     541    } else {
     542        error "wrong # args: should be \"copy path from ?xmlobj? path\""
     543    }
     544    if {$from != "from"} {
     545        error "bad syntax: should be \"copy path from ?xmlobj? path\""
     546    }
     547
     548    if {[llength [$xmlobj children $fpath]] == 0} {
     549        set val [$xmlobj get $fpath]
     550        put $path $val
     551    } else {
     552        set obj [$xmlobj element -as object $fpath]
     553        put $path $obj
     554        itcl::delete object $obj
     555    }
    517556}
    518557
Note: See TracChangeset for help on using the changeset viewer.