Changeset 9 for trunk/gui/scripts
- Timestamp:
- Apr 19, 2005, 8:06:13 PM (19 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r8 r9 151 151 puts $fid "<?xml version=\"1.0\"?>" 152 152 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 } 156 158 puts $fid $xml 157 159 close $fid … … 265 267 $itk_component(info) configure -state normal 266 268 $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] 268 270 $itk_component(info) configure -state disabled 269 271 } -
trunk/gui/scripts/deviceLayout1D.tcl
r6 r9 136 136 # 137 137 # Clients use this to add hints about the controls that should be 138 # added to the layout area. Common paths are recipe.slab#.material139 # and recipe.slab#.thickness.138 # added to the layout area. Common paths are components.slab#.material 139 # and components.slab#.thickness. 140 140 # ---------------------------------------------------------------------- 141 141 itcl::body Rappture::DeviceLayout1D::controls {option args} { … … 182 182 # see if any of the slabs has a label 183 183 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]} { 186 186 set extra [expr {1.2*[font metrics $fnt -linespace]}] 187 187 set h [expr {$h+$extra}] … … 192 192 193 193 # a little extra height for the molecule image 194 if {"" != [$_device element recipe.molecule]} {194 if {"" != [$_device element components.molecule]} { 195 195 set h [expr {$h+15}] 196 196 } … … 210 210 set z 0 211 211 if {$_device != ""} { 212 foreach nn [$_device children recipe] {212 foreach nn [$_device children components] { 213 213 switch -glob -- $nn { 214 214 slab* - molecule* { 215 set tval [$_device get recipe.$nn.thickness]215 set tval [$_device get components.$nn.thickness] 216 216 set tval [Rappture::Units::convert $tval \ 217 217 -context um -to um -units off] 218 lappend slabs recipe.$nn218 lappend slabs components.$nn 219 219 lappend z0 $z 220 220 lappend zthick $tval 221 lappend maters [$_device get recipe.$nn.material]221 lappend maters [$_device get components.$nn.material] 222 222 223 223 set z [expr {$z+$tval}] … … 310 310 set h [expr {[winfo height $c]-1}] 311 311 # a little extra height for the molecule image 312 if {"" != [$_device element recipe.molecule]} {312 if {"" != [$_device element components.molecule]} { 313 313 set h [expr {$h-15}] 314 314 } … … 361 361 set h [expr {[winfo height $c]-1}] 362 362 # a little extra height for the molecule image 363 if {"" != [$_device element recipe.molecule]} {363 if {"" != [$_device element components.molecule]} { 364 364 set h [expr {$h-15}] 365 365 } … … 395 395 set h [expr {[winfo height $c]-1}] 396 396 # a little extra height for the molecule image 397 if {"" != [$_device element recipe.molecule]} {397 if {"" != [$_device element components.molecule]} { 398 398 set h [expr {$h-15}] 399 399 } … … 415 415 # 416 416 set elem [lindex $_slabs $index] 417 set path " device.$elem.thickness"417 set path "structure.$elem.thickness" 418 418 if {[info exists _controls($path)] && $_controls($path)} { 419 419 set zthick [lindex $_zthick $index] … … 432 432 # 433 433 set elem [lindex $_slabs $index] 434 set path " device.$elem.material"434 set path "structure.$elem.material" 435 435 if {[info exists _controls($path)] && $_controls($path)} { 436 436 set mater [lindex $_maters $index] … … 448 448 # 449 449 if {"" != $_device} { 450 set label [$_device get $elem. label]450 set label [$_device get $elem.about.label] 451 451 if {"" != $label} { 452 452 set y [expr {$y-0.5*$lh}] … … 465 465 itcl::body Rappture::DeviceLayout1D::_mater2color {mater} { 466 466 if {$_library != ""} { 467 set color [$_library get materials. $mater.color]467 set color [$_library get materials.($mater).color] 468 468 if {$color != ""} { 469 469 return $color -
trunk/gui/scripts/deviceViewer1D.tcl
r6 r9 69 69 rename -highlightbackground -background background Background 70 70 keep -highlightcolor -highlightthickness 71 keep -selectbackground -selectforeground72 71 keep -tabbackground -tabforeground 72 rename -selectbackground -background background Background 73 rename -selectforeground -foreground foreground Foreground 73 74 } 74 75 pack $itk_component(tabs) -expand yes -fill both … … 137 138 # widget. If the <parameter> is ambient*, then the control is added 138 139 # 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. 140 142 # ---------------------------------------------------------------------- 141 143 itcl::body Rappture::DeviceViewer1D::controls {option args} { … … 146 148 } 147 149 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]} { 150 152 $itk_component(layout) controls add $path 151 153 } else { … … 186 188 # 187 189 if {$_device != ""} { 188 foreach nn [$_device children ] {190 foreach nn [$_device children fields] { 189 191 if {[string match field* $nn]} { 190 192 set name [$_device get $nn.label] … … 227 229 228 230 foreach name $tabs { 229 $itk_component(tabs) insert end $name 231 $itk_component(tabs) insert end $name \ 232 -activebackground $itk_option(-background) 230 233 } 231 234 $itk_component(tabs) select 0 … … 319 322 foreach {path x y val} [$fobj controls get $comp] { 320 323 $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 "" 322 325 $graph marker bind $comp.$x <Enter> \ 323 326 [itcl::code $this _marker enter $comp.$x] -
trunk/gui/scripts/energyLevels.tcl
r8 r9 63 63 pack $itk_component(title) -side top 64 64 65 #66 # Add labels showing level stats at bottom.67 #68 itk_component add stats {69 frame $itk_interior.stats70 }71 pack $itk_component(stats) -side bottom -fill x72 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 e77 78 itk_component add numvalv {79 label $itk_component(stats).numvalv80 }81 grid $itk_component(numvalv) -row 0 -column 1 -sticky w82 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 e87 88 itk_component add numbasv {89 label $itk_component(stats).numbasv90 }91 grid $itk_component(numbasv) -row 1 -column 1 -sticky w92 93 65 94 66 itk_component add cntls { … … 205 177 } 206 178 if {"" != $title} { 207 pack $itk_component(title) -side top -before $ itk_component(stats)179 pack $itk_component(title) -side top -before $graph 208 180 $itk_component(title) configure -text $title 209 181 } else { … … 235 207 # 236 208 set n 0 237 set nlumo 0209 set nlumo -1 238 210 set emax "" 239 211 set emin "" … … 248 220 set elumo $eval 249 221 set lval "LUMO = $eval $units" 222 } else { 223 set lval "" 250 224 } 251 225 … … 253 227 $graph element create $elem \ 254 228 -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 } 261 237 262 238 if {$emax == ""} { … … 281 257 set emax [expr {$emax+($emax-$emin)*$h/150.0}] 282 258 $graph yaxis configure -min $emin -max $emax 283 284 # fill in the stats at the bottom285 $itk_component(numvalv) configure -text $nlumo286 $itk_component(numbasv) configure -text $n287 259 288 260 # -
trunk/gui/scripts/field.tcl
r6 r9 56 56 # determine the overall size of the device 57 57 set z0 [set z1 0] 58 foreach elem [$_device children recipe] {58 foreach elem [$_device children components] { 59 59 switch -glob -- $elem { 60 60 slab* - molecule* { … … 62 62 set elem "${elem}0" 63 63 } 64 set tval [$_device get recipe.$elem.thickness]64 set tval [$_device get components.$elem.thickness] 65 65 set tval [Rappture::Units::convert $tval \ 66 66 -context um -to um -units off] … … 115 115 # ---------------------------------------------------------------------- 116 116 itcl::body Rappture::Field::vectors {{what -overall}} { 117 if {$what == "component0"} { 118 set what "component" 119 } 117 120 if {[info exists _comp2vecs($what)]} { 118 121 return $_comp2vecs($what) -
trunk/gui/scripts/spectrum.tcl
r1 r9 150 150 while {[llength $args] > 0} { 151 151 set first [lindex $args 0] 152 if {[ string index $first 0] == "-"} {152 if {[regexp {^-[a-zA-Z]} $first]} { 153 153 set what $first 154 154 set args [lrange $args 1 end] -
trunk/gui/scripts/xyplot.tcl
r8 r9 118 118 field* { 119 119 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)] 122 122 set _path2obj($name) $fobj 123 123 foreach {xv yv} [$fobj vectors component0] { break } … … 144 144 curve* { 145 145 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)] 148 148 set _path2obj($name) $cobj 149 foreach {xv yv} [$cobj vectors component 0] { break }149 foreach {xv yv} [$cobj vectors component] { break } 150 150 151 151 set elem "elem[incr count]" … … 225 225 # displayed in the plot. 226 226 # ---------------------------------------------------------------------- 227 itcl::configbody Rappture::Xyplot:: run{227 itcl::configbody Rappture::Xyplot::output { 228 228 if {$_device != ""} { 229 229 itcl::delete object $_device … … 234 234 error "bad value \"$itk_option(-output)\": should be Rappture::Library" 235 235 } 236 set _device [$itk_option(-output) element -flavor object device]236 set _device [$itk_option(-output) element -flavor object structure] 237 237 } 238 238 after cancel [itcl::code $this _rebuild]
Note: See TracChangeset
for help on using the changeset viewer.