Changeset 9 for trunk/gui/scripts


Ignore:
Timestamp:
Apr 19, 2005, 8:06:13 PM (19 years ago)
Author:
mmc
Message:

Massive changes across the entire toolkit. Rearranged the
XML description to agree better with new documentation and
conventions.

Added a small start of Rappture.interface and Rappture.number
in the python directory. This is the new way of doing Rappture--
by declaring variables directly in the program, not using XML
directly at all.

Location:
trunk/gui/scripts
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/analyzer.tcl

    r8 r9  
    151151            puts $fid "<?xml version=\"1.0\"?>"
    152152            set xml [$itk_option(-tool) xml]
    153             set xml2 [$itk_option(-device) xml]
    154             regsub -all {&} $xml2 {\\\&} xml2
    155             regsub {</run>} $xml "$xml2</run>" xml
     153            if {$itk_option(-device) != ""} {
     154                set xml2 [$itk_option(-device) xml]
     155                regsub -all {&} $xml2 {\\\&} xml2
     156                regsub {</run>} $xml "$xml2</run>" xml
     157            }
    156158            puts $fid $xml
    157159            close $fid
     
    265267    $itk_component(info) configure -state normal
    266268    $itk_component(info) delete 1.0 end
    267     $itk_component(info) insert end [$itk_option(-tool) get executable.about]
     269    $itk_component(info) insert end [$itk_option(-tool) get tool.about]
    268270    $itk_component(info) configure -state disabled
    269271}
  • trunk/gui/scripts/deviceLayout1D.tcl

    r6 r9  
    136136#
    137137# Clients use this to add hints about the controls that should be
    138 # added to the layout area.  Common paths are recipe.slab#.material
    139 # and recipe.slab#.thickness.
     138# added to the layout area.  Common paths are components.slab#.material
     139# and components.slab#.thickness.
    140140# ----------------------------------------------------------------------
    141141itcl::body Rappture::DeviceLayout1D::controls {option args} {
     
    182182    # see if any of the slabs has a label
    183183    if {$_device != ""} {
    184         foreach nn [$_device children recipe] {
    185             if {"" != [$_device get recipe.$nn.label]} {
     184        foreach nn [$_device children components] {
     185            if {"" != [$_device get components.$nn.about.label]} {
    186186                set extra [expr {1.2*[font metrics $fnt -linespace]}]
    187187                set h [expr {$h+$extra}]
     
    192192
    193193    # a little extra height for the molecule image
    194     if {"" != [$_device element recipe.molecule]} {
     194    if {"" != [$_device element components.molecule]} {
    195195        set h [expr {$h+15}]
    196196    }
     
    210210    set z 0
    211211    if {$_device != ""} {
    212         foreach nn [$_device children recipe] {
     212        foreach nn [$_device children components] {
    213213            switch -glob -- $nn {
    214214                slab* - molecule* {
    215                     set tval [$_device get recipe.$nn.thickness]
     215                    set tval [$_device get components.$nn.thickness]
    216216                    set tval [Rappture::Units::convert $tval \
    217217                        -context um -to um -units off]
    218                     lappend slabs recipe.$nn
     218                    lappend slabs components.$nn
    219219                    lappend z0 $z
    220220                    lappend zthick $tval
    221                     lappend maters [$_device get recipe.$nn.material]
     221                    lappend maters [$_device get components.$nn.material]
    222222
    223223                    set z [expr {$z+$tval}]
     
    310310    set h [expr {[winfo height $c]-1}]
    311311    # a little extra height for the molecule image
    312     if {"" != [$_device element recipe.molecule]} {
     312    if {"" != [$_device element components.molecule]} {
    313313        set h [expr {$h-15}]
    314314    }
     
    361361    set h [expr {[winfo height $c]-1}]
    362362    # a little extra height for the molecule image
    363     if {"" != [$_device element recipe.molecule]} {
     363    if {"" != [$_device element components.molecule]} {
    364364        set h [expr {$h-15}]
    365365    }
     
    395395    set h [expr {[winfo height $c]-1}]
    396396    # a little extra height for the molecule image
    397     if {"" != [$_device element recipe.molecule]} {
     397    if {"" != [$_device element components.molecule]} {
    398398        set h [expr {$h-15}]
    399399    }
     
    415415    #
    416416    set elem [lindex $_slabs $index]
    417     set path "device.$elem.thickness"
     417    set path "structure.$elem.thickness"
    418418    if {[info exists _controls($path)] && $_controls($path)} {
    419419        set zthick [lindex $_zthick $index]
     
    432432    #
    433433    set elem [lindex $_slabs $index]
    434     set path "device.$elem.material"
     434    set path "structure.$elem.material"
    435435    if {[info exists _controls($path)] && $_controls($path)} {
    436436        set mater [lindex $_maters $index]
     
    448448    #
    449449    if {"" != $_device} {
    450         set label [$_device get $elem.label]
     450        set label [$_device get $elem.about.label]
    451451        if {"" != $label} {
    452452            set y [expr {$y-0.5*$lh}]
     
    465465itcl::body Rappture::DeviceLayout1D::_mater2color {mater} {
    466466    if {$_library != ""} {
    467         set color [$_library get materials.$mater.color]
     467        set color [$_library get materials.($mater).color]
    468468        if {$color != ""} {
    469469            return $color
  • trunk/gui/scripts/deviceViewer1D.tcl

    r6 r9  
    6969        rename -highlightbackground -background background Background
    7070        keep -highlightcolor -highlightthickness
    71         keep -selectbackground -selectforeground
    7271        keep -tabbackground -tabforeground
     72        rename -selectbackground -background background Background
     73        rename -selectforeground -foreground foreground Foreground
    7374    }
    7475    pack $itk_component(tabs) -expand yes -fill both
     
    137138# widget.  If the <parameter> is ambient*, then the control is added
    138139# to the top, so it goes along with the layout of the device.  If
    139 # it is device.field*, then it goes in one of the field panels.
     140# it is structure.fields.field*, then it goes in one of the field
     141# panels.
    140142# ----------------------------------------------------------------------
    141143itcl::body Rappture::DeviceViewer1D::controls {option args} {
     
    146148            }
    147149            set path [lindex $args 0]
    148             if {[string match device.field* $path]} {
    149             } elseif {[string match device.recipe* $path]} {
     150            if {[string match structure.fields.field* $path]} {
     151            } elseif {[string match structure.components* $path]} {
    150152                $itk_component(layout) controls add $path
    151153            } else {
     
    186188    #
    187189    if {$_device != ""} {
    188         foreach nn [$_device children] {
     190        foreach nn [$_device children fields] {
    189191            if {[string match field* $nn]} {
    190192                set name [$_device get $nn.label]
     
    227229
    228230        foreach name $tabs {
    229             $itk_component(tabs) insert end $name
     231            $itk_component(tabs) insert end $name \
     232                -activebackground $itk_option(-background)
    230233        }
    231234        $itk_component(tabs) select 0
     
    319322            foreach {path x y val} [$fobj controls get $comp] {
    320323                $graph marker create text -coords [list $x $y] \
    321                     -text $val -anchor s -name $comp.$x
     324                    -text $val -anchor s -name $comp.$x -background ""
    322325                $graph marker bind $comp.$x <Enter> \
    323326                    [itcl::code $this _marker enter $comp.$x]
  • trunk/gui/scripts/energyLevels.tcl

    r8 r9  
    6363    pack $itk_component(title) -side top
    6464
    65     #
    66     # Add labels showing level stats at bottom.
    67     #
    68     itk_component add stats {
    69         frame $itk_interior.stats
    70     }
    71     pack $itk_component(stats) -side bottom -fill x
    72 
    73     itk_component add numvall {
    74         label $itk_component(stats).numvall -text "Number of valence electrons:"
    75     }
    76     grid $itk_component(numvall) -row 0 -column 0 -sticky e
    77 
    78     itk_component add numvalv {
    79         label $itk_component(stats).numvalv
    80     }
    81     grid $itk_component(numvalv) -row 0 -column 1 -sticky w
    82 
    83     itk_component add numbasl {
    84         label $itk_component(stats).numbasl -text "Number of basis functions:"
    85     }
    86     grid $itk_component(numbasl) -row 1 -column 0 -sticky e
    87 
    88     itk_component add numbasv {
    89         label $itk_component(stats).numbasv
    90     }
    91     grid $itk_component(numbasv) -row 1 -column 1 -sticky w
    92 
    9365
    9466    itk_component add cntls {
     
    205177    }
    206178    if {"" != $title} {
    207         pack $itk_component(title) -side top -before $itk_component(stats)
     179        pack $itk_component(title) -side top -before $graph
    208180        $itk_component(title) configure -text $title
    209181    } else {
     
    235207    #
    236208    set n 0
    237     set nlumo 0
     209    set nlumo -1
    238210    set emax ""
    239211    set emin ""
     
    248220            set elumo $eval
    249221            set lval "LUMO = $eval $units"
     222        } else {
     223            set lval ""
    250224        }
    251225
     
    253227        $graph element create $elem \
    254228            -xdata {0 1} -ydata [list $eval $eval] \
    255             -color $itk_option(-levelcolor) -symbol "" -linewidth 2
    256 
    257         $graph marker create text -coords [list 0.5 $eval] \
    258             -text $lval -anchor c \
    259             -foreground $itk_option(-leveltextforeground) \
    260             -background $itk_option(-leveltextbackground)
     229            -color $itk_option(-levelcolor) -symbol "" -linewidth 1
     230
     231        if {$lval != ""} {
     232            $graph marker create text -coords [list 0.5 $eval] \
     233                -text $lval -anchor c \
     234                -foreground $itk_option(-leveltextforeground) \
     235                -background $itk_option(-leveltextbackground)
     236        }
    261237
    262238        if {$emax == ""} {
     
    281257    set emax [expr {$emax+($emax-$emin)*$h/150.0}]
    282258    $graph yaxis configure -min $emin -max $emax
    283 
    284     # fill in the stats at the bottom
    285     $itk_component(numvalv) configure -text $nlumo
    286     $itk_component(numbasv) configure -text $n
    287259
    288260    #
  • trunk/gui/scripts/field.tcl

    r6 r9  
    5656    # determine the overall size of the device
    5757    set z0 [set z1 0]
    58     foreach elem [$_device children recipe] {
     58    foreach elem [$_device children components] {
    5959        switch -glob -- $elem {
    6060            slab* - molecule* {
     
    6262                    set elem "${elem}0"
    6363                }
    64                 set tval [$_device get recipe.$elem.thickness]
     64                set tval [$_device get components.$elem.thickness]
    6565                set tval [Rappture::Units::convert $tval \
    6666                    -context um -to um -units off]
     
    115115# ----------------------------------------------------------------------
    116116itcl::body Rappture::Field::vectors {{what -overall}} {
     117    if {$what == "component0"} {
     118        set what "component"
     119    }
    117120    if {[info exists _comp2vecs($what)]} {
    118121        return $_comp2vecs($what)
  • trunk/gui/scripts/spectrum.tcl

    r1 r9  
    150150    while {[llength $args] > 0} {
    151151        set first [lindex $args 0]
    152         if {[string index $first 0] == "-"} {
     152        if {[regexp {^-[a-zA-Z]} $first]} {
    153153            set what $first
    154154            set args [lrange $args 1 end]
  • trunk/gui/scripts/xyplot.tcl

    r8 r9  
    118118            field* {
    119119              set name [$layout get $item]
    120               if {"" != [$run element output.$name]} {
    121                   set fobj [Rappture::Field ::#auto $_device $run output.$name]
     120              if {"" != [$run element output.($name)]} {
     121                  set fobj [Rappture::Field ::#auto $_device $run output.($name)]
    122122                  set _path2obj($name) $fobj
    123123                  foreach {xv yv} [$fobj vectors component0] { break }
     
    144144            curve* {
    145145              set name [$layout get $item]
    146               if {"" != [$run get element output.$name]} {
    147                   set cobj [Rappture::Curve ::#auto $run output.$name]
     146              if {"" != [$run element output.($name)]} {
     147                  set cobj [Rappture::Curve ::#auto $run output.($name)]
    148148                  set _path2obj($name) $cobj
    149                   foreach {xv yv} [$cobj vectors component0] { break }
     149                  foreach {xv yv} [$cobj vectors component] { break }
    150150
    151151                  set elem "elem[incr count]"
     
    225225# displayed in the plot.
    226226# ----------------------------------------------------------------------
    227 itcl::configbody Rappture::Xyplot::run {
     227itcl::configbody Rappture::Xyplot::output {
    228228    if {$_device != ""} {
    229229        itcl::delete object $_device
     
    234234            error "bad value \"$itk_option(-output)\": should be Rappture::Library"
    235235        }
    236         set _device [$itk_option(-output) element -flavor object device]
     236        set _device [$itk_option(-output) element -flavor object structure]
    237237    }
    238238    after cancel [itcl::code $this _rebuild]
Note: See TracChangeset for help on using the changeset viewer.