- Timestamp:
- Feb 23, 2008, 8:16:38 PM (17 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r822 r903 52 52 public method simulate {args} 53 53 public method reset {{when -eventually}} 54 public method load { file}54 public method load {xmlobj} 55 55 public method clear {} 56 56 public method download {option args} … … 77 77 78 78 private common job ;# array var used for blt::bgexec jobs 79 80 # resources file tells us the results directory 81 public common _resultdir "" 82 public proc setResultDir {path} { set _resultdir $path } 83 } 84 85 # must use this name -- plugs into Rappture::resources::load 86 proc analyzer_init_resources {} { 87 Rappture::resources::register \ 88 results_directory Rappture::Analyzer::setResultDir 89 } 90 79 } 80 91 81 itk::usual Analyzer { 92 82 keep -background -cursor foreground -font … … 354 344 } 355 345 356 # read back the results from run.xml346 # load results from run.xml into analyzer 357 347 if {$status == 0 && $result != "ABORT"} { 358 if {[regexp {=RAPPTURE-RUN=>([^\n]+)} $result match file]} { 359 set status [catch {load $file} msg] 360 if {$status != 0} { 361 global errorInfo 362 set result "$msg\n$errorInfo" 363 } 364 365 # if there's a results_directory defined in the resources 366 # file, then move the run.xml file there for storage 367 if {"" != $_resultdir} { 368 catch { 369 if {![file exists $_resultdir]} { 370 _mkdir $_resultdir 371 } 372 file rename -force -- $file $_resultdir 373 } 374 } 375 } else { 376 set status 1 377 set result "Can't find result file in output.\nDid you call Rappture::result in your simulator?" 378 } 348 set status [catch {load $result} result] 379 349 } 380 350 … … 441 411 442 412 # ---------------------------------------------------------------------- 443 # USAGE: load < file>444 # 445 # Loads the data from the given < file> into the appropriate results413 # USAGE: load <xmlobj> 414 # 415 # Loads the data from the given <xmlobj> into the appropriate results 446 416 # sets. If necessary, new results sets are created to store the data. 447 417 # ---------------------------------------------------------------------- 448 itcl::body Rappture::Analyzer::load { file} {418 itcl::body Rappture::Analyzer::load {xmlobj} { 449 419 # only show the last result? then clear first 450 420 if {[$_tool xml get tool.analyzer] == "last"} { … … 452 422 } 453 423 454 # try to load new results from the given file455 set xmlobj [Rappture::library $file]456 424 lappend _runs $xmlobj 457 425 -
trunk/gui/scripts/tool.tcl
r775 r903 40 40 41 41 public common _resources 42 public proc setAppName {name} { set _resources(-appname) $name } 43 public proc setHubName {name} { set _resources(-hubname) $name } 44 public proc setHubURL {name} { set _resources(-huburl) $name } 45 public proc setSession {name} { set _resources(-session) $name } 46 public proc setJobPrt {name} { set _resources(-jobprotocol) $name } 42 public proc setAppName {name} { set _resources(-appname) $name } 43 public proc setHubName {name} { set _resources(-hubname) $name } 44 public proc setHubURL {name} { set _resources(-huburl) $name } 45 public proc setSession {name} { set _resources(-session) $name } 46 public proc setJobPrt {name} { set _resources(-jobprotocol) $name } 47 public proc setResultDir {name} { set _resources(-resultdir) $name } 47 48 } 48 49 … … 50 51 proc tool_init_resources {} { 51 52 Rappture::resources::register \ 52 application_name Rappture::Tool::setAppName \ 53 application_id Rappture::Tool::setAppId \ 54 hub_name Rappture::Tool::setHubName \ 55 hub_url Rappture::Tool::setHubURL \ 56 session_token Rappture::Tool::setSession \ 57 job_protocol Rappture::Tool::setJobPrt 53 application_name Rappture::Tool::setAppName \ 54 application_id Rappture::Tool::setAppId \ 55 hub_name Rappture::Tool::setHubName \ 56 hub_url Rappture::Tool::setHubURL \ 57 session_token Rappture::Tool::setSession \ 58 job_protocol Rappture::Tool::setJobPrt \ 59 results_directory Rappture::Tool::setResultDir 58 60 } 59 61 … … 263 265 # 264 266 if {$status == 0} { 265 set file [string trim $job(output)] 266 return [list $status $file] 267 set result [string trim $job(output)] 268 if {[regexp {=RAPPTURE-RUN=>([^\n]+)} $result match file]} { 269 set status [catch {Rappture::library $file} result] 270 if {$status != 0} { 271 global errorInfo 272 set result "$result\n$errorInfo" 273 } 274 275 # if there's a results_directory defined in the resources 276 # file, then move the run.xml file there for storage 277 if {[info exists _resources(-resultdir)] 278 && "" != $_resources(-resultdir)} { 279 catch { 280 if {![file exists $_resources(-resultdir)]} { 281 _mkdir $_resources(-resultdir) 282 } 283 file rename -force -- $file $_resources(-resultdir) 284 } 285 } 286 } else { 287 set status 1 288 set result "Can't find result file in output.\nDid you call Rappture 289 ::result in your simulator?" 290 } 291 return [list $status $result] 267 292 } elseif {"" != $job(output) || "" != $job(error)} { 268 293 return [list $status [string trim "$job(output)\n$job(error)"]]
Note: See TracChangeset
for help on using the changeset viewer.