Changeset 193 for trunk/gui/scripts/analyzer.tcl
- Timestamp:
- Feb 19, 2006, 8:10:19 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r173 r193 54 54 public method load {file} 55 55 public method clear {} 56 public method download { }56 public method download {option} 57 57 58 58 protected method _plot {args} … … 198 198 itk_component add download { 199 199 button $w.top.dl -text "Download..." -anchor w \ 200 -command [itcl::code $this download ]200 -command [itcl::code $this download now] 201 201 } 202 202 pack $itk_component(download) -side right -padx {4 0} … … 204 204 205 205 NOTE: Your web browser must allow pop-ups from this site. If your output does not appear, look for a 'pop-up blocked' message and enable pop-ups." 206 207 bind $itk_component(download) <Enter> \ 208 [itcl::code $this download coming] 206 209 } 207 210 … … 521 524 522 525 # ---------------------------------------------------------------------- 523 # USAGE: download 526 # USAGE: download coming 527 # USAGE: download now 524 528 # 525 529 # Spools the current result so the user can download it. 526 530 # ---------------------------------------------------------------------- 527 itcl::body Rappture::Analyzer::download { } {531 itcl::body Rappture::Analyzer::download {option} { 528 532 if {[Rappture::filexfer::enabled]} { 529 533 set title [$itk_component(resultselector) value] 530 534 set page [$itk_component(resultselector) translate $title] 531 if {$page != ""} { 532 set ext "" 533 set f [$itk_component(resultpages) page $page] 534 foreach {ext data} [$f.rviewer download] break 535 if {"" == $ext} { 536 Rappture::Tooltip::cue $itk_component(download) \ 537 "Can't download this result." 538 return 539 } 540 regsub -all {[\ -\/\:-\@\{-\~]} $title {} title 541 set file "$title$ext" 542 } else { 543 # this shouldn't happen 544 set file error.html 545 set data "<h1>Not Found</h1>There is no result selected." 546 } 547 548 if {[catch {Rappture::filexfer::spool $data $file} result]} { 549 if {"no clients" == $result} { 550 Rappture::Tooltip::cue $itk_component(download) \ 551 "Can't download this result. Looks like you might be having trouble with the version of Java installed for your browser." 552 } else { 553 error $result " (while spooling result \"$title\")" 535 536 switch -- $option { 537 coming { 538 # 539 # Warn result that a download is coming, in case 540 # it needs to take a screen snap. 541 # 542 if {$page != ""} { 543 set f [$itk_component(resultpages) page $page] 544 $f.rviewer download coming 545 } 546 } 547 now { 548 # 549 # Perform the actual download. 550 # 551 if {$page != ""} { 552 set ext "" 553 set f [$itk_component(resultpages) page $page] 554 foreach {ext data} [$f.rviewer download now] break 555 if {"" == $ext} { 556 Rappture::Tooltip::cue $itk_component(download) \ 557 "Can't download this result." 558 return 559 } 560 regsub -all {[\ -\/\:-\@\{-\~]} $title {} title 561 set file "$title$ext" 562 } else { 563 # this shouldn't happen 564 set file error.html 565 set data "<h1>Not Found</h1>There is no result selected." 566 } 567 568 if {[catch {Rappture::filexfer::spool $data $file} result]} { 569 if {"no clients" == $result} { 570 Rappture::Tooltip::cue $itk_component(download) \ 571 "Can't download this result. Looks like you might be having trouble with the version of Java installed for your browser." 572 } else { 573 error $result " (while spooling result \"$title\")" 574 } 575 } 576 } 577 default { 578 error "bad option \"$option\": should be coming, now" 554 579 } 555 580 }
Note: See TracChangeset
for help on using the changeset viewer.