Changeset 8 for trunk/gui


Ignore:
Timestamp:
Apr 2, 2005 9:33:16 AM (16 years ago)
Author:
mmc
Message:

Updated the code to the latest Rappture XML conventions, and fixed
up the moleculeViewer and energyLevels viewer. Everything works
properly now with the new app-huckel project. You can load up
the molecule viewer, rotate molecules, and view their energy levels.

Location:
trunk/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/apps/driver

    r7 r8  
    128128# build everything inside this main window
    129129set win [.main component app]
    130 $win configure -background #a6a6a6
     130#$win configure -background #a6a6a6
    131131
    132132frame $win.input -borderwidth 12 -relief flat
     
    137137
    138138# make an arrow that goes from input to output side
    139 label $win.arrow -borderwidth 0 -image in2out
    140 place $win.arrow -y 2 -anchor n
    141 bind $win.input <Configure> [list align_arrow $win]
    142 proc align_arrow {win} {
    143     place $win.arrow -x [expr {[winfo width $win.input]+5}]
    144 }
     139#label $win.arrow -borderwidth 0 -image in2out
     140#place $win.arrow -y 2 -anchor n
     141#bind $win.input <Configure> [list align_arrow $win]
     142#proc align_arrow {win} {
     143#    place $win.arrow -x [expr {[winfo width $win.input]+5}]
     144#}
    145145
    146146# ----------------------------------------------------------------------
     
    150150set dfirst ""
    151151set dlist [$config children -type structure controls]
    152 puts "device: $dlist"
    153152if {"" != $dlist} {
    154153    foreach dname $dlist {
    155154        set obj [$config element -flavor object controls.$dname]
    156155        set name [$obj get label]
    157 puts " => $name = $obj"
    158156        set devs($name) $obj
    159157    }
     
    177175    set first [lindex $devlist 0]
    178176    set dfirst $devs($first)
    179     set tags [$dfirst children]
     177    set tags [$dfirst children components]
    180178    set i [lsearch $tags label]
    181179    if {$i >= 0} {set tags [lreplace $tags $i $i]}
    182180
    183 puts "first device: tags = $tags"
    184181    if {$tags == "molecule"} {
    185182        Rappture::MoleculeViewer $w.device -device $devs($first) \
  • trunk/gui/scripts/analyzer.tcl

    r6 r8  
    125125#
    126126# If the simulation page is showing, this kicks off the simulator
    127 # by executing the executable.command associated with the -tool.  While
     127# by executing the tool.command associated with the -tool.  While
    128128# the simulation is running, it shows status.  When the simulation is
    129129# finished, it switches automatically to "analyze" mode and shows
     
    137137
    138138        set job(control) ""
     139        set job(error) ""
    139140
    140141        # if the hold window is set, then put up a busy cursor
     
    152153            set xml2 [$itk_option(-device) xml]
    153154            regsub -all {&} $xml2 {\\\&} xml2
    154             regsub {</tool>} $xml "$xml2</tool>" xml
     155            regsub {</run>} $xml "$xml2</run>" xml
    155156            puts $fid $xml
    156157            close $fid
     
    159160        # execute the tool using the path from the tool description
    160161        if {$status == 0} {
    161             set cmd [$itk_option(-tool) get executable.command]
     162            set cmd [$itk_option(-tool) get tool.command]
    162163
    163164            set status [catch {eval blt::bgexec \
     
    211212
    212213    # if control mode is "auto", then simulate right away
    213     if {$_control == "auto"} {
     214    if {[string match auto* $_control]} {
    214215        simulate
    215216    }
     
    231232
    232233    # try to load new results from the given file
    233     set _run [Rappture::Library::open $file]
     234    set _run [Rappture::library $file]
    234235
    235236    # go through the analysis and create widgets to display results
    236237    foreach item [array names _widgets] {
    237         $_widgets($item) configure -run $_run
     238        $_widgets($item) configure -output $_run
    238239    }
    239240}
     
    254255# CONFIGURATION OPTION: -tool
    255256#
    256 # Set to the Rappture::Library object representing the tool being
     257# Set to the Rappture::library object representing the tool being
    257258# run in this analyzer.
    258259# ----------------------------------------------------------------------
    259260itcl::configbody Rappture::Analyzer::tool {
    260261    if {![Rappture::library isvalid $itk_option(-tool)]} {
    261         error "bad value \"$itk_option(-tool)\": should be Rappture::Library"
     262        error "bad value \"$itk_option(-tool)\": should be Rappture::library"
    262263    }
    263264
     
    271272# CONFIGURATION OPTION: -device
    272273#
    273 # Set to the Rappture::Library object representing the device being
     274# Set to the Rappture::library object representing the device being
    274275# run in this analyzer.
    275276# ----------------------------------------------------------------------
     
    277278    if {$itk_option(-device) != ""
    278279          && ![Rappture::library isvalid $itk_option(-device)]} {
    279         error "bad value \"$itk_option(-device)\": should be Rappture::Library"
     280        error "bad value \"$itk_option(-device)\": should be Rappture::library"
    280281    }
    281282    reset
     
    285286# CONFIGURATION OPTION: -analysis
    286287#
    287 # Set to the Rappture::Library object representing the analysis that
     288# Set to the Rappture::library object representing the analysis that
    288289# should be shown in this analyzer.
    289290# ----------------------------------------------------------------------
    290291itcl::configbody Rappture::Analyzer::analysis {
    291292    if {![Rappture::library isvalid $itk_option(-analysis)]} {
    292         error "bad value \"$itk_option(-analysis)\": should be Rappture::Library"
     293        error "bad value \"$itk_option(-analysis)\": should be Rappture::library"
    293294    }
    294295    set _control [$itk_option(-analysis) get control]
     
    314315                pack $_widgets($item) -expand yes -fill both
    315316            }
     317            elevels* {
     318                set name "page[incr counter]"
     319
     320                set page [$itk_component(results) insert end $name]
     321                $itk_component(resultselector) choices insert end \
     322                    $name "Energy Levels"
     323
     324                set _widgets($item) [Rappture::EnergyLevels $page.#auto \
     325                    -layout [$itk_option(-analysis) element -flavor object $item]]
     326                pack $_widgets($item) -expand yes -fill both
     327            }
    316328        }
    317329    }
  • trunk/gui/scripts/energyLevels.tcl

    r7 r8  
    1616option add *EnergyLevels.width 4i widgetDefault
    1717option add *EnergyLevels.height 4i widgetDefault
     18option add *EnergyLevels.levelColor blue widgetDefault
     19option add *EnergyLevels.levelTextForeground blue widgetDefault
     20option add *EnergyLevels.levelTextBackground #d9d9d9 widgetDefault
     21
     22option add *EnergyLevels.font \
     23    -*-helvetica-medium-r-normal-*-*-120-* widgetDefault
     24
     25option add *EnergyLevels.detailFont \
     26    -*-helvetica-medium-r-normal-*-*-100-* widgetDefault
    1827
    1928itcl::class Rappture::EnergyLevels {
    2029    inherit itk::Widget
    2130
     31    itk_option define -layout layout Layout ""
     32    itk_option define -output output Output ""
     33    itk_option define -levelcolor levelColor LevelColor ""
     34    itk_option define -leveltextforeground levelTextForeground Foreground ""
     35    itk_option define -leveltextbackground levelTextBackground Background ""
     36
    2237    constructor {args} { # defined below }
    2338    destructor { # defined below }
    2439
    25     method load {libobj}
    26 }
    27                                                                                
     40    protected method _render {}
     41    protected method _adjust {what val}
     42    protected method _getColumn {name}
     43    protected method _getUnits {name}
     44    protected method _getMidPt {elist pos}
     45}
     46
    2847itk::usual EnergyLevels {
    2948}
     
    3655    pack propagate $itk_component(hull) no
    3756
     57    #
     58    # Add label for the title.
     59    #
     60    itk_component add title {
     61        label $itk_interior.title
     62    }
     63    pack $itk_component(title) -side top
     64
     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
     93
     94    itk_component add cntls {
     95        frame $itk_interior.cntls
     96    }
     97    pack $itk_component(cntls) -side right -fill y
     98    grid rowconfigure $itk_component(cntls) 0 -weight 1
     99    grid rowconfigure $itk_component(cntls) 1 -minsize 10
     100    grid rowconfigure $itk_component(cntls) 2 -weight 1
     101
     102    #
     103    # Add MORE/FEWER levels control for TOP of graph
     104    #
     105    itk_component add upperE {
     106        frame $itk_component(cntls).upperE
     107    }
     108
     109    itk_component add upperEmore {
     110        label $itk_component(upperE).morel -text "More"
     111    } {
     112        usual
     113        rename -font -detailfont detailFont Font
     114    }
     115    pack $itk_component(upperEmore) -side top
     116
     117    itk_component add upperEfewer {
     118        label $itk_component(upperE).fewerl -text "Fewer"
     119    } {
     120        usual
     121        rename -font -detailfont detailFont Font
     122    }
     123    pack $itk_component(upperEfewer) -side bottom
     124
     125    itk_component add upperEcntl {
     126        scale $itk_component(upperE).cntl -orient vertical -showvalue 0 \
     127            -command [itcl::code $this _adjust upper]
     128    }
     129    pack $itk_component(upperEcntl) -side top -fill y
     130
     131    #
     132    # Add MORE/FEWER levels control for BOTTOM of graph
     133    #
     134    itk_component add lowerE {
     135        frame $itk_component(cntls).lowerE
     136    }
     137
     138    itk_component add lowerEmore {
     139        label $itk_component(lowerE).morel -text "More"
     140    } {
     141        usual
     142        rename -font -detailfont detailFont Font
     143    }
     144    pack $itk_component(lowerEmore) -side bottom
     145
     146    itk_component add lowerEfewer {
     147        label $itk_component(lowerE).fewerl -text "Fewer"
     148    } {
     149        usual
     150        rename -font -detailfont detailFont Font
     151    }
     152    pack $itk_component(lowerEfewer) -side top
     153
     154    itk_component add lowerEcntl {
     155        scale $itk_component(lowerE).cntl -orient vertical -showvalue 0 \
     156            -command [itcl::code $this _adjust lower]
     157    }
     158    pack $itk_component(lowerEcntl) -side top -fill y
     159
     160    #
     161    # Add graph showing levels
     162    #
    38163    itk_component add graph {
    39164        blt::graph $itk_interior.graph \
     
    56181
    57182# ----------------------------------------------------------------------
    58 # USAGE: load <libObj>
     183# USAGE: _render
    59184#
    60 # Clients use this to load a list of energy levels from the specified
    61 # XML libObj, which should be a <table>.  One column in the table
    62 # should have "labels" and the other "energies".
    63 # ----------------------------------------------------------------------
    64 itcl::body Rappture::EnergyLevels::load {libobj} {
    65     set clist [$libobj children]
    66     set ilabel [lsearch $clist [$libobj element column(labels)]]
    67     if {$ilabel < 0} {
    68         error "can't find column(labels) in energy table data"
    69     }
    70     set ienergy [lsearch $clist [$libobj element column(energies)]]
    71     if {$ienergy < 0} {
    72         error "can't find column(energies) in energy table data"
    73     }
    74 
    75     set units [$libobj get column(energies).units]
    76     if {$units == ""} {
    77         set units "eV"
    78     }
    79 
    80     #
    81     # Update the graph to show the current set of levels.
     185# Used internally to load a list of energy levels from a <table> within
     186# the -output XML object.  The -layout object indicates how information
     187# should be extracted from the table.  The <layout> should have an
     188# <energies> tag and perhaps a <labels> tag, which indicates the table
     189# and the column within the table containing the energies.
     190# ----------------------------------------------------------------------
     191itcl::body Rappture::EnergyLevels::_render {} {
     192    #
     193    # Clear any information shown in the graph.
    82194    #
    83195    set graph $itk_component(graph)
     
    85197    eval $graph marker delete [$graph marker names]
    86198
     199    #
     200    # Plug in the title from the layout
     201    #
     202    set title ""
     203    if {$itk_option(-layout) != ""} {
     204        set title [$itk_option(-layout) get label]
     205    }
     206    if {"" != $title} {
     207        pack $itk_component(title) -side top -before $itk_component(stats)
     208        $itk_component(title) configure -text $title
     209    } else {
     210        pack forget $itk_component(title)
     211    }
     212
     213    #
     214    # Look through the layout and figure out what to extract
     215    # from the table.
     216    #
     217    set elist [_getColumn energies]
     218    if {[llength $elist] == 0} {
     219        return
     220    }
     221    set units [_getUnits energies]
     222
     223    set llist [_getColumn names]
     224    if {[llength $llist] == 0} {
     225        # no labels? then invent some
     226        set i 0
     227        foreach name $elist {
     228            lappend llist "E$i"
     229            incr i
     230        }
     231    }
     232
     233    #
     234    # Update the graph to show the current set of levels.
     235    #
    87236    set n 0
     237    set nlumo 0
    88238    set emax ""
    89239    set emin ""
    90240    set ehomo ""
    91241    set elumo ""
    92     foreach line [split [$libobj get data] "\n"] {
    93         set lval [lindex $line $ilabel]
    94         set eval [lindex $line $ienergy]
    95         if {$lval == "" || $eval == ""} {
    96             continue
    97         }
    98 
    99         set eval [Rappture::Units::convert $eval \
    100             -context $units -to $units -units off]
    101 
     242    foreach eval $elist lval $llist {
    102243        if {$lval == "HOMO"} {
    103244            set ehomo $eval
    104         } elseif {$lval == "LUMO"} {
     245            set lval "HOMO = $eval $units"
     246            set nlumo [expr {$n+1}]
     247        } elseif {$lval == "LUMO" || $n == $nlumo} {
    105248            set elumo $eval
     249            set lval "LUMO = $eval $units"
    106250        }
    107251
    108252        set elem "elem[incr n]"
    109253        $graph element create $elem \
    110             -xdata {0 0.8} -ydata [list $eval $eval] \
    111             -color blue -symbol "" -linewidth 2
    112 
    113         $graph marker create text -coords [list 0.8 $eval] \
    114             -text $lval -anchor w -background ""
     254            -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)
    115261
    116262        if {$emax == ""} {
     
    123269    }
    124270    $graph xaxis configure -min 0 -max 1 -showticks off -linewidth 0
    125     $graph yaxis configure -title "Energy ($units)"
     271    if {$units != ""} {
     272        $graph yaxis configure -title "Energy ($units)"
     273    } else {
     274        $graph yaxis configure -title "Energy"
     275    }
    126276
    127277    # bump the limits so they are big enough to show labels
    128278    set fnt $itk_option(-font)
    129279    set h [expr {0.5*([font metrics $fnt -linespace] + 5)}]
    130     set emin [expr {$emin-$h/150.0}]
    131     set emax [expr {$emax+$h/150.0}]
     280    set emin [expr {$emin-($emax-$emin)*$h/150.0}]
     281    set emax [expr {$emax+($emax-$emin)*$h/150.0}]
    132282    $graph yaxis configure -min $emin -max $emax
    133283
     284    # fill in the stats at the bottom
     285    $itk_component(numvalv) configure -text $nlumo
     286    $itk_component(numbasv) configure -text $n
     287
    134288    #
    135289    # If we found HOMO/LUMO levels, then add the band gap at
    136     # that point.
     290    # that point.  Also, fix the controls for energy range.
    137291    #
    138292    if {$ehomo != "" && $elumo != ""} {
    139         $graph marker create line \
    140             -coords [list 0.2 $elumo 0.2 $ehomo]
    141 
    142         set egap [expr {$ehomo-$elumo}]
     293        set id [$graph marker create line \
     294            -coords [list 0.2 $elumo 0.2 $ehomo]]
     295        $graph marker after $id
     296
     297        set egap [expr {$elumo-$ehomo}]
    143298        set emid [expr {0.5*($ehomo+$elumo)}]
    144299        $graph marker create text \
    145300            -coords [list 0.21 $emid] -background "" \
    146301            -text "Eg = [format %.2g $egap] $units" -anchor w
    147     }
    148 }
    149 
    150 package require Rappture
    151 Rappture::EnergyLevels .e
    152 pack .e -expand yes -fill both
    153 
    154 set lib [Rappture::library {<?xml version="1.0"?>
    155 <table>
    156 <column id="labels">Name</column>
    157 <column id="energies">Energy</column>
    158 <data>
    159   E0    0.1
    160   E1    0.2
    161   LUMO  0.4
    162   HOMO  0.9
    163   E4    1.5
    164   E5    2.8
    165 </data>
    166 </table>}]
    167 
    168 .e load $lib
     302
     303        # fix the limits for the lower scale
     304        set elim [_getMidPt $elist [expr {$nlumo-1}]]
     305        if {"" != $elim} {
     306            $itk_component(lowerEcntl) configure -from $elim -to $emin \
     307                -resolution [expr {0.02*($elim-$emin)}]
     308            grid $itk_component(lowerE) -row 2 -column 0 -sticky ns
     309
     310            set e0 [_getMidPt $elist [expr {$nlumo-3}]]
     311            if {"" != $e0} {
     312                $itk_component(lowerEcntl) set $e0
     313            } else {
     314                $itk_component(lowerEcntl) set $elim
     315            }
     316        } else {
     317            grid forget $itk_component(lowerE)
     318        }
     319
     320        # fix the limits for the upper scale
     321        set elim [_getMidPt $elist [expr {$nlumo+1}]]
     322        if {"" != $elim} {
     323            $itk_component(upperEcntl) configure -from $emax -to $elim \
     324                -resolution [expr {0.02*($emax-$elim)}]
     325            grid $itk_component(upperE) -row 0 -column 0 -sticky ns
     326
     327            set e0 [_getMidPt $elist [expr {$nlumo+3}]]
     328            if {"" != $e0} {
     329                $itk_component(upperEcntl) set $e0
     330            } else {
     331                $itk_component(upperEcntl) set $elim
     332            }
     333        } else {
     334            grid forget $itk_component(upperE)
     335        }
     336    } else {
     337        grid forget $itk_component(upperE)
     338        grid forget $itk_component(lowerE)
     339    }
     340}
     341
     342# ----------------------------------------------------------------------
     343# USAGE: _adjust <what> <val>
     344#
     345# Used internally to adjust the upper/lower limits of the graph
     346# as the user drags the slider from "More" to "Fewer".  Sets
     347# the specified limit to the given value.
     348# ----------------------------------------------------------------------
     349itcl::body Rappture::EnergyLevels::_adjust {what val} {
     350    switch -- $what {
     351        upper {
     352            $itk_component(graph) yaxis configure -max $val
     353        }
     354        lower {
     355            $itk_component(graph) yaxis configure -min $val
     356        }
     357        default {
     358            error "bad limit \"$what\": should be upper or lower"
     359        }
     360    }
     361}
     362
     363# ----------------------------------------------------------------------
     364# USAGE: _getColumn <name>
     365#
     366# Used internally to load a list of energy levels from a <table> within
     367# the -output XML object.  The -layout object indicates how information
     368# should be extracted from the table.  The <layout> should have an
     369# <energies> tag and perhaps a <labels> tag, which indicates the table
     370# and the column within the table containing the energies.
     371# ----------------------------------------------------------------------
     372itcl::body Rappture::EnergyLevels::_getColumn {name} {
     373    if {$itk_option(-layout) == "" || $itk_option(-output) == ""} {
     374        return
     375    }
     376
     377    #
     378    # Figure out which column in which table contains the data.
     379    # Then, find that table and extract the column.  Figure out
     380    # the position of the column from the list of all column names.
     381    #
     382    set table [$itk_option(-layout) get $name.table]
     383    set col [$itk_option(-layout) get $name.column]
     384
     385    set clist ""
     386    foreach c [$itk_option(-output) children -type column $table] {
     387        lappend clist [$itk_option(-output) get $table.$c.label]
     388    }
     389    set ipos [lsearch $clist $col]
     390    if {$ipos < 0} {
     391        return  ;# can't find data -- bail out!
     392    }
     393
     394    set units [$itk_option(-output) get $table.column$ipos.units]
     395
     396    set rlist ""
     397    foreach line [split [$itk_option(-output) get $table.data] "\n"] {
     398        if {"" != [string trim $line]} {
     399            set val [lindex $line $ipos]
     400
     401            if {$units != ""} {
     402                set val [Rappture::Units::convert $val \
     403                    -context $units -to $units -units off]
     404            }
     405            lappend rlist $val
     406        }
     407    }
     408    return $rlist
     409}
     410
     411# ----------------------------------------------------------------------
     412# USAGE: _getUnits <name>
     413#
     414# Used internally to extract the units from a <table> within the
     415# -output XML object.  The -layout object indicates how information
     416# should be extracted from the table.  The <layout> should have an
     417# <energies> tag and perhaps a <labels> tag, which indicates the table
     418# and the column within the table containing the units.
     419# ----------------------------------------------------------------------
     420itcl::body Rappture::EnergyLevels::_getUnits {name} {
     421    if {$itk_option(-layout) == "" || $itk_option(-output) == ""} {
     422        return
     423    }
     424
     425    #
     426    # Figure out which column in which table contains the data.
     427    # Then, find that table and extract the column.  Figure out
     428    # the position of the column from the list of all column names.
     429    #
     430    set table [$itk_option(-layout) get $name.table]
     431    set col [$itk_option(-layout) get $name.column]
     432
     433    set clist ""
     434    foreach c [$itk_option(-output) children -type column $table] {
     435        lappend clist [$itk_option(-output) get $table.$c.label]
     436    }
     437    set ipos [lsearch $clist $col]
     438    if {$ipos < 0} {
     439        return  ;# can't find data -- bail out!
     440    }
     441
     442    return [$itk_option(-output) get $table.column$ipos.units]
     443}
     444
     445# ----------------------------------------------------------------------
     446# USAGE: _getMidPt <elist> <pos>
     447#
     448# Used internally to compute the midpoint between two energy levels
     449# at <pos> and <pos-1> in the <elist>.  Returns a number representing
     450# the mid-point (average value) or "" if the levels involved do
     451# no exist in <elist>.
     452# ----------------------------------------------------------------------
     453itcl::body Rappture::EnergyLevels::_getMidPt {elist pos} {
     454    if {$pos < [llength $elist] && $pos > 1} {
     455        set e1 [lindex $elist $pos]
     456        set e0 [lindex $elist [expr {$pos-1}]]
     457        return [expr {0.5*($e0+$e1)}]
     458    }
     459    return ""
     460}
     461
     462# ----------------------------------------------------------------------
     463# OPTION: -layout
     464# ----------------------------------------------------------------------
     465itcl::configbody Rappture::EnergyLevels::layout {
     466    if {$itk_option(-layout) != ""
     467          && ![Rappture::library isvalid $itk_option(-layout)]} {
     468        error "bad value \"$itk_option(-layout)\": should be Rappture::library object"
     469    }
     470    after idle [itcl::code $this _render]
     471}
     472
     473# ----------------------------------------------------------------------
     474# OPTION: -output
     475# ----------------------------------------------------------------------
     476itcl::configbody Rappture::EnergyLevels::output {
     477    if {$itk_option(-output) != ""
     478          && ![Rappture::library isvalid $itk_option(-output)]} {
     479        error "bad value \"$itk_option(-output)\": should be Rappture::library object"
     480    }
     481    after cancel [itcl::code $this _render]
     482    after idle [itcl::code $this _render]
     483}
     484
     485# ----------------------------------------------------------------------
     486# OPTION: -levelColor
     487# ----------------------------------------------------------------------
     488itcl::configbody Rappture::EnergyLevels::levelcolor {
     489    after cancel [itcl::code $this _render]
     490    after idle [itcl::code $this _render]
     491}
     492
     493# ----------------------------------------------------------------------
     494# OPTION: -leveltextforeground
     495# ----------------------------------------------------------------------
     496itcl::configbody Rappture::EnergyLevels::leveltextforeground {
     497    after cancel [itcl::code $this _render]
     498    after idle [itcl::code $this _render]
     499}
     500
     501# ----------------------------------------------------------------------
     502# OPTION: -leveltextbackground
     503# ----------------------------------------------------------------------
     504itcl::configbody Rappture::EnergyLevels::leveltextbackground {
     505    after cancel [itcl::code $this _render]
     506    after idle [itcl::code $this _render]
     507}
  • trunk/gui/scripts/moleculeViewer.tcl

    r7 r8  
    164164}
    165165
    166 package require Rappture
    167 Rappture::MoleculeViewer .e -library [Rappture::library -std library.xml]
    168 pack .e -expand yes -fill both
    169 
    170 set dev [Rappture::library {<?xml version="1.0"?>
    171 <structure>
    172 <components>
    173 <molecule id="Aspirin">
    174   <formula>???</formula>
    175   <info>Aspirin molecule</info>
    176   <atom id="1">
    177     <symbol>C</symbol>
    178     <xyz>-1.892  -0.992  -1.578</xyz>
    179   </atom>
    180   <atom id="2">
    181     <symbol>C</symbol>
    182     <xyz>-1.370  -2.149  -0.990</xyz>
    183   </atom>
    184   <atom id="3">
    185     <symbol>C</symbol>
    186     <xyz>-0.079  -2.146  -0.464</xyz>
    187   </atom>
    188   <atom id="4">
    189     <symbol>C</symbol>
    190     <xyz>0.708  -0.986  -0.521</xyz>
    191   </atom>
    192   <atom id="5">
    193     <symbol>C</symbol>
    194     <xyz>0.203   0.156  -1.196</xyz>
    195   </atom>
    196   <atom id="6">
    197     <symbol>C</symbol>
    198     <xyz>-1.108   0.161  -1.654</xyz>
    199   </atom>
    200   <atom id="7">
    201     <symbol>C</symbol>
    202     <xyz>2.085  -1.030   0.104</xyz>
    203   </atom>
    204   <atom id="8">
    205     <symbol>O</symbol>
    206     <xyz>2.533  -2.034   0.636</xyz>
    207   </atom>
    208   <atom id="9">
    209     <symbol>O</symbol>
    210     <xyz>2.879   0.025   0.112</xyz>
    211   </atom>
    212   <atom id="10">
    213     <symbol>O</symbol>
    214     <xyz>0.753   1.334  -1.084</xyz>
    215   </atom>
    216   <atom id="11">
    217     <symbol>C</symbol>
    218     <xyz>0.668   2.025   0.034</xyz>
    219   </atom>
    220   <atom id="12">
    221     <symbol>O</symbol>
    222     <xyz>1.300   3.063   0.152</xyz>
    223   </atom>
    224   <atom id="13">
    225     <symbol>C</symbol>
    226     <xyz>-0.243   1.577   1.144</xyz>
    227   </atom>
    228   <atom id="14">
    229     <symbol>H</symbol>
    230     <xyz>-2.879  -0.962  -1.985</xyz>
    231   </atom>
    232   <atom id="15">
    233     <symbol>H</symbol>
    234     <xyz>-1.988  -3.037  -0.955</xyz>
    235   </atom>
    236   <atom id="16">
    237     <symbol>H</symbol>
    238     <xyz>0.300  -3.063  -0.005</xyz>
    239   </atom>
    240   <atom id="17">
    241     <symbol>H</symbol>
    242     <xyz>-1.489   1.084  -2.059</xyz>
    243   </atom>
    244   <atom id="18">
    245     <symbol>H</symbol>
    246     <xyz>2.566   0.782  -0.326</xyz>
    247   </atom>
    248   <atom id="19">
    249     <symbol>H</symbol>
    250     <xyz>-0.761   0.636   0.933</xyz>
    251   </atom>
    252   <atom id="20">
    253     <symbol>H</symbol>
    254     <xyz>-1.009   2.349   1.290</xyz>
    255   </atom>
    256   <atom id="21">
    257     <symbol>H</symbol>
    258     <xyz>0.346   1.435   2.059</xyz>
    259   </atom>
    260 </molecule>
    261 </components>
    262 </structure>}]
     166#package require Rappture
     167#Rappture::MoleculeViewer .e -library [Rappture::library -std library.xml]
     168#pack .e -expand yes -fill both
     169#
     170#set dev [Rappture::library {<?xml version="1.0"?>
     171#<structure>
     172#<components>
     173#<molecule id="Aspirin">
     174#  <formula>???</formula>
     175#  <info>Aspirin molecule</info>
     176#  <atom id="1">
     177#    <symbol>C</symbol>
     178#    <xyz>-1.892  -0.992  -1.578</xyz>
     179#  </atom>
     180#  <atom id="2">
     181#    <symbol>C</symbol>
     182#    <xyz>-1.370  -2.149  -0.990</xyz>
     183#  </atom>
     184#  <atom id="3">
     185#    <symbol>C</symbol>
     186#    <xyz>-0.079  -2.146  -0.464</xyz>
     187#  </atom>
     188#  <atom id="4">
     189#    <symbol>C</symbol>
     190#    <xyz>0.708  -0.986  -0.521</xyz>
     191#  </atom>
     192#  <atom id="5">
     193#    <symbol>C</symbol>
     194#    <xyz>0.203   0.156  -1.196</xyz>
     195#  </atom>
     196#  <atom id="6">
     197#    <symbol>C</symbol>
     198#    <xyz>-1.108   0.161  -1.654</xyz>
     199#  </atom>
     200#  <atom id="7">
     201#    <symbol>C</symbol>
     202#    <xyz>2.085  -1.030   0.104</xyz>
     203#  </atom>
     204#  <atom id="8">
     205#    <symbol>O</symbol>
     206#    <xyz>2.533  -2.034   0.636</xyz>
     207#  </atom>
     208#  <atom id="9">
     209#    <symbol>O</symbol>
     210#    <xyz>2.879   0.025   0.112</xyz>
     211#  </atom>
     212#  <atom id="10">
     213#    <symbol>O</symbol>
     214#    <xyz>0.753   1.334  -1.084</xyz>
     215#  </atom>
     216#  <atom id="11">
     217#    <symbol>C</symbol>
     218#    <xyz>0.668   2.025   0.034</xyz>
     219#  </atom>
     220#  <atom id="12">
     221#    <symbol>O</symbol>
     222#    <xyz>1.300   3.063   0.152</xyz>
     223#  </atom>
     224#  <atom id="13">
     225#    <symbol>C</symbol>
     226#    <xyz>-0.243   1.577   1.144</xyz>
     227#  </atom>
     228#  <atom id="14">
     229#    <symbol>H</symbol>
     230#    <xyz>-2.879  -0.962  -1.985</xyz>
     231#  </atom>
     232#  <atom id="15">
     233#    <symbol>H</symbol>
     234#    <xyz>-1.988  -3.037  -0.955</xyz>
     235#  </atom>
     236#  <atom id="16">
     237#    <symbol>H</symbol>
     238#    <xyz>0.300  -3.063  -0.005</xyz>
     239#  </atom>
     240#  <atom id="17">
     241#    <symbol>H</symbol>
     242#    <xyz>-1.489   1.084  -2.059</xyz>
     243#  </atom>
     244#  <atom id="18">
     245#    <symbol>H</symbol>
     246#    <xyz>2.566   0.782  -0.326</xyz>
     247#  </atom>
     248#  <atom id="19">
     249#    <symbol>H</symbol>
     250#    <xyz>-0.761   0.636   0.933</xyz>
     251#  </atom>
     252#  <atom id="20">
     253#    <symbol>H</symbol>
     254#    <xyz>-1.009   2.349   1.290</xyz>
     255#  </atom>
     256#  <atom id="21">
     257#    <symbol>H</symbol>
     258#    <xyz>0.346   1.435   2.059</xyz>
     259#  </atom>
     260#</molecule>
     261#</components>
     262#</structure>}]
    263263# add connectivity at some point...
    264264#CONECT    1    2    6   14                   
     
    284284#CONECT   21   13               
    285285
    286 .e configure -device $dev
     286#.e configure -device $dev
  • trunk/gui/scripts/xyplot.tcl

    r6 r8  
    44#  This widget is an X/Y plot, meant to view line graphs produced
    55#  as output from the run of a Rappture tool.  It takes a -layout
    6 #  object describing what should be plotted, and a -run object
     6#  object describing what should be plotted, and an -output object
    77#  containing the data.  This widget puts it all together, and lets
    88#  the user explore the results.
     
    2323
    2424    itk_option define -layout layout Layout ""
    25     itk_option define -run run Run ""
     25    itk_option define -output output Output ""
    2626
    2727    constructor {args} { # defined below }
     
    3030    protected method _rebuild {}
    3131
    32     private variable _device ""  ;# device contained in -run
     32    private variable _device ""  ;# device contained in -output
    3333    private variable _path2obj   ;# maps field/curve name => object
    3434}
     
    8282    set g $itk_component(plot)
    8383    set layout $itk_option(-layout)
    84     set run $itk_option(-run)
     84    set run $itk_option(-output)
    8585
    8686    # first clear out the widget
     
    220220
    221221# ----------------------------------------------------------------------
    222 # CONFIGURATION OPTION: -run
     222# CONFIGURATION OPTION: -output
    223223#
    224224# Set to the Rappture::Library object representing the data being
     
    230230        set _device ""
    231231    }
    232     if {$itk_option(-run) != ""} {
    233         if {![Rappture::library isvalid $itk_option(-run)]} {
    234             error "bad value \"$itk_option(-run)\": should be Rappture::Library"
    235         }
    236         set _device [$itk_option(-run) element -flavor object device]
     232    if {$itk_option(-output) != ""} {
     233        if {![Rappture::library isvalid $itk_option(-output)]} {
     234            error "bad value \"$itk_option(-output)\": should be Rappture::Library"
     235        }
     236        set _device [$itk_option(-output) element -flavor object device]
    237237    }
    238238    after cancel [itcl::code $this _rebuild]
Note: See TracChangeset for help on using the changeset viewer.