Changeset 9
- Timestamp:
- Apr 19, 2005, 8:06:13 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/apps/driver
r8 r9 27 27 package require Rappture 28 28 29 option add *MainWin.mode webstartupFile29 option add *MainWin.mode desktop startupFile 30 30 option add *MainWin.borderWidth 0 startupFile 31 31 option add *MainWin.anchor center startupFile … … 41 41 option add *MainWin.bgScript "" startupFile 42 42 option add *MainWin.bgColor white startupFile 43 option add *Tooltip.background white 43 44 44 45 image create photo in2out \ … … 124 125 Rappture::MainWin .main -borderwidth 0 125 126 126 #.main configure -title [$config get title]127 .main configure -title [$config get title] 127 128 128 129 # build everything inside this main window … … 203 204 # HOOK UP ANY CONTROLS CALLED OUT IN CONFIG.XML 204 205 # ---------------------------------------------------------------------- 205 foreach access [$config children -type access controls] { 206 set name [$config get controls.$access] 207 switch -glob -- $name { 208 parameters.ambient* - structure* { 209 ## $win.input.device controls add $name 210 } 211 } 212 } 206 proc controls_add {container libObj path} { 207 set presets "" 208 foreach pre [$libObj children -type preset $path] { 209 lappend presets \ 210 [$libObj get $path.$pre.value] \ 211 [$libObj get $path.$pre.label] 212 } 213 214 set type Rappture::Gauge 215 set units [$libObj get $path.units] 216 if {$units != ""} { 217 set desc [Rappture::Units::description $units] 218 if {[string match temperature* $desc]} { 219 set type Rappture::TemperatureGauge 220 } 221 } 222 223 set counter 0 224 set w "$container.gauge[incr counter]" 225 while {[winfo exists $w]} { 226 set w "$container.gauge[incr counter]" 227 } 228 229 # create the widget 230 $type $w -units $units -presets $presets 231 pack $w -side top -anchor w 232 # bind $w <<Value>> [itcl::code $this _controlSet $w $libObj $path] 233 234 set min [$libObj get $path.min] 235 if {"" != $min} { $w configure -minvalue $min } 236 237 set max [$libObj get $path.max] 238 if {"" != $max} { $w configure -maxvalue $max } 239 240 set str [$libObj get $path.default] 241 if {$str != ""} { $w value $str } 242 243 if {$type == "Rappture::Gauge" && "" != $min && "" != $max} { 244 set color [$libObj get $path.color] 245 if {$color == ""} { 246 set color blue 247 } 248 if {$units != ""} { 249 set min [Rappture::Units::convert $min -to $units -units off] 250 set max [Rappture::Units::convert $max -to $units -units off] 251 } 252 $w configure -spectrum [Rappture::Spectrum ::#auto [list \ 253 $min white $max $color] -units $units] 254 } 255 256 set str [$libObj get $path.label] 257 if {$str != ""} { 258 set help [$libObj get $path.help] 259 if {"" != $help} { 260 append str "\n$help" 261 } 262 if {$units != ""} { 263 set desc [Rappture::Units::description $units] 264 append str "\n(units of $desc)" 265 } 266 Rappture::Tooltip::for $w $str 267 } 268 269 set str [$libObj get $path.icon] 270 if {$str != ""} { 271 $w configure -image [image create photo -data $str] 272 } 273 } 274 275 if {[winfo exists $win.input.device]} { 276 foreach access [$config children -type access controls] { 277 set name [$config get controls.$access] 278 switch -glob -- $name { 279 input.(ambient)* - structure* { 280 $win.input.device controls add $name 281 } 282 } 283 } 284 } else { 285 foreach access [$config children -type access controls] { 286 set name [$config get controls.$access] 287 controls_add $win.input $tool $name 288 } 289 $w.analyze simulate 290 } -
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] -
trunk/lib/library.xml
r7 r9 2 2 <library> 3 3 <parameters> 4 <group name="ambient">5 <number name="temperature">4 <group id="ambient"> 5 <number id="temperature"> 6 6 <label>Ambient temperature</label> 7 7 <units>K</units> … … 51 51 </elements> 52 52 <materials> 53 <material name="GaAs">53 <material id="GaAs"> 54 54 <formula>GaAs</formula> 55 55 <bandgap>1.422eV</bandgap> … … 60 60 <NvEffDensityOfStates>0.942e19/cm3</NvEffDensityOfStates> 61 61 </material> 62 <material name="Al(0.3)Ga(0.7)As">62 <material id="Al(0.3)Ga(0.7)As"> 63 63 <formula>Al(0.3)Ga(0.7)As</formula> 64 64 <color>#9999ff</color> … … 69 69 <NvEffDensityOfStates>0.111e20/cm3</NvEffDensityOfStates> 70 70 </material> 71 <material name="Au">71 <material id="Au"> 72 72 <formula>Au</formula> 73 73 <color>#ffff66</color> -
trunk/python/Rappture/__init__.py
r1 r9 1 1 # Rappture package 2 2 from library import library 3 from interface import interface 4 from number import number -
trunk/python/setup.py
r1 r9 4 4 description='Rapid Application Infrastructure library for nanoHUB.org', 5 5 url='http://www.nanohub.org/', 6 py_modules=['Rappture.library' ],6 py_modules=['Rappture.library','Rappture.interface','Rappture.number'], 7 7 ) -
trunk/tcl/scripts/library.tcl
r7 r9 427 427 set node $lastnode 428 428 foreach part $path { 429 if {![regexp {^(([a-zA-Z_]+#?)([0-9]*))?(\(( [^\)]+)\))?$} $part \429 if {![regexp {^(([a-zA-Z_]+#?)([0-9]*))?(\((.*)\))?$} $part \ 430 430 match dummy type index dummy name]} { 431 431 error "bad path component \"$part\""
Note: See TracChangeset
for help on using the changeset viewer.