Ignore:
Timestamp:
Jul 16, 2005, 2:31:32 PM (19 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/gui/scripts/numberentry.tcl

    r11 r22  
    1414    inherit itk::Widget
    1515
    16     constructor {xmlobj path args} { # defined below }
     16    constructor {owner path args} { # defined below }
    1717
    1818    public method value {args}
     
    2323    protected method _newValue {}
    2424
    25     private variable _xmlobj ""   ;# XML containing description
     25    private variable _owner ""    ;# thing managing this control
    2626    private variable _path ""     ;# path in XML to this number
    2727}
     
    3737# CONSTRUCTOR
    3838# ----------------------------------------------------------------------
    39 itcl::body Rappture::NumberEntry::constructor {xmlobj path args} {
    40     if {![Rappture::library isvalid $xmlobj]} {
    41         error "bad value \"$xmlobj\": should be Rappture::library"
    42     }
    43     set _xmlobj $xmlobj
     39itcl::body Rappture::NumberEntry::constructor {owner path args} {
     40    if {[catch {$owner isa Rappture::ControlOwner} valid] != 0 || !$valid} {
     41        error "bad object \"$owner\": should be Rappture::ControlOwner"
     42    }
     43    set _owner $owner
    4444    set _path $path
    4545
     
    4848    #
    4949    set presets ""
    50     foreach pre [$xmlobj children -type preset $path] {
     50    foreach pre [$_owner xml children -type preset $path] {
    5151        lappend presets \
    52             [$xmlobj get $path.$pre.value] \
    53             [$xmlobj get $path.$pre.label]
     52            [$_owner xml get $path.$pre.value] \
     53            [$_owner xml get $path.$pre.label]
    5454    }
    5555
    5656    set class Rappture::Gauge
    57     set units [$xmlobj get $path.units]
     57    set units [$_owner xml get $path.units]
    5858    if {$units != ""} {
    5959        set desc [Rappture::Units::description $units]
     
    7373    bind $itk_component(gauge) <<Value>> [itcl::code $this _newValue]
    7474
    75     set min [$xmlobj get $path.min]
     75    set min [$_owner xml get $path.min]
    7676    if {"" != $min} { $itk_component(gauge) configure -minvalue $min }
    7777
    78     set max [$xmlobj get $path.max]
     78    set max [$_owner xml get $path.max]
    7979    if {"" != $max} { $itk_component(gauge) configure -maxvalue $max }
    8080
    8181    if {$class == "Rappture::Gauge" && "" != $min && "" != $max} {
    82         set color [$xmlobj get $path.color]
     82        set color [$_owner xml get $path.color]
    8383        if {$color == ""} {
    8484            set color blue
     
    9494
    9595    # if the control has an icon, plug it in
    96     set str [$xmlobj get $path.about.icon]
     96    set str [$_owner xml get $path.about.icon]
    9797    if {$str != ""} {
    9898        $itk_component(gauge) configure -image [image create photo -data $str]
     
    104104    # Assign the default value to this widget, if there is one.
    105105    #
    106     set str [$xmlobj get $path.default]
     106    set str [$_owner xml get $path.default]
    107107    if {"" != $str != ""} { $itk_component(gauge) value $str }
    108108}
     
    151151# ----------------------------------------------------------------------
    152152itcl::body Rappture::NumberEntry::label {} {
    153     set label [$_xmlobj get $_path.about.label]
     153    set label [$_owner xml get $_path.about.label]
    154154    if {"" == $label} {
    155155        set label "Number"
     
    167167# ----------------------------------------------------------------------
    168168itcl::body Rappture::NumberEntry::tooltip {} {
    169     set str [$_xmlobj get $_path.about.description]
    170 
    171     set units [$_xmlobj get $_path.units]
    172     set min [$_xmlobj get $_path.min]
    173     set max [$_xmlobj get $_path.max]
     169    set str [$_owner xml get $_path.about.description]
     170
     171    set units [$_owner xml get $_path.units]
     172    set min [$_owner xml get $_path.min]
     173    set max [$_owner xml get $_path.max]
    174174
    175175    if {$units != "" || $min != "" || $max != ""} {
Note: See TracChangeset for help on using the changeset viewer.