- Timestamp:
- Aug 28, 2005, 9:09:01 PM (19 years ago)
- Location:
- trunk/gui
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/apps/driver
r44 r50 75 75 76 76 set tool [Rappture::Tool ::#auto $xmlobj $installdir] 77 78 # ---------------------------------------------------------------------- 79 # INITIALIZE THE DESKTOP CONNECTION 80 # 81 # If there's a SESSION ID, then this must be running within the 82 # nanoHUB. Try to initialize the server handling the desktop 83 # connection. 84 # ---------------------------------------------------------------------- 85 Rappture::filexfer::init 77 86 78 87 # ---------------------------------------------------------------------- -
trunk/gui/scripts/analyzer.tcl
r43 r50 49 49 public method load {file} 50 50 public method clear {} 51 public method download {} 51 52 52 53 protected method _plot {args} … … 191 192 bind $itk_component(resultselector) <<Value>> [itcl::code $this _fixResult] 192 193 194 if {[Rappture::filexfer::enabled]} { 195 itk_component add download { 196 button $w.top.dl -text "Download..." \ 197 -command [itcl::code $this download] 198 } 199 pack $itk_component(download) -side right -padx {4 0} 200 Rappture::Tooltip::for $itk_component(download) "Downloads the current result to a new web browser window on your desktop. From there, you can easily print or save results." 201 } 202 193 203 itk_component add results { 194 204 Rappture::Panes $w.pane … … 450 460 } 451 461 452 # if there is only one result page, take down the selector453 set w [$itk_component(notebook) page analyze]454 if {[$itk_component(resultselector) choices size] <= 1} {455 pack forget $w.top456 } else {457 pack $w.top -before $itk_component(results) -side top -fill x458 }459 460 462 # show the first page by default 461 463 set first [$itk_component(resultselector) choices get -label 0] … … 502 504 _fixSimControl 503 505 reset 506 } 507 508 # ---------------------------------------------------------------------- 509 # USAGE: download 510 # 511 # Spools the current result so the user can download it. 512 # ---------------------------------------------------------------------- 513 itcl::body Rappture::Analyzer::download {} { 514 if {[Rappture::filexfer::enabled]} { 515 set title [$itk_component(resultselector) value] 516 set page [$itk_component(resultselector) translate $title] 517 if {$page != ""} { 518 set ext "" 519 set f [$itk_component(resultpages) page $page] 520 foreach {ext data} [$f.rviewer download] break 521 if {"" == $ext} { 522 Rappture::Tooltip::cue $itk_component(download) \ 523 "Can't download this result." 524 return 525 } 526 regsub -all {[\ -\/\:-\@\{-\~]} $title {} title 527 set file "$title$ext" 528 } else { 529 # this shouldn't happen 530 set file error.html 531 set data "<h1>Not Found</h1>There is no result selected." 532 } 533 534 if {[catch {Rappture::filexfer::spool $data $file} result]} { 535 if {"no clients" == $result} { 536 Rappture::Tooltip::cue $itk_component(download) \ 537 "Can't download this result. Looks like you might be having trouble with the version of Java installed for your browser." 538 } else { 539 error $result " (while spooling result \"$title\")" 540 } 541 } 542 } 504 543 } 505 544 -
trunk/gui/scripts/contourresult.tcl
r17 r50 84 84 public method delete {args} 85 85 public method scale {args} 86 public method download {} 86 87 87 88 protected method _rebuild {} … … 403 404 404 405 # ---------------------------------------------------------------------- 406 # USAGE: download 407 # 408 # Clients use this method to create a downloadable representation 409 # of the plot. Returns a list of the form {ext string}, where 410 # "ext" is the file extension (indicating the type of data) and 411 # "string" is the data itself. 412 # ---------------------------------------------------------------------- 413 itcl::body Rappture::ContourResult::download {} { 414 return "" 415 } 416 417 # ---------------------------------------------------------------------- 405 418 # USAGE: _rebuild 406 419 # -
trunk/gui/scripts/deviceresult.tcl
r22 r50 26 26 public method delete {args} 27 27 public method scale {args} 28 public method download {} 28 29 29 30 set _dataobj "" ;# data object currently being displayed … … 111 112 # nothing to do for structures 112 113 } 114 115 # ---------------------------------------------------------------------- 116 # USAGE: download 117 # 118 # Clients use this method to create a downloadable representation 119 # of the plot. Returns a list of the form {ext string}, where 120 # "ext" is the file extension (indicating the type of data) and 121 # "string" is the data itself. 122 # ---------------------------------------------------------------------- 123 itcl::body Rappture::DeviceResult::download {} { 124 return "" 125 } -
trunk/gui/scripts/getopts.tcl
r11 r50 97 97 } 98 98 if {![info exists params($first)]} { 99 error "bad option \"$first\": should be [join [lsort $opts] ]{, }]"99 error "bad option \"$first\": should be [join [lsort $opts] {, }]" 100 100 } 101 101 switch -- [lindex $flags($first) 0] { -
trunk/gui/scripts/loader.tcl
r25 r50 86 86 foreach ftail $flist { 87 87 set fpath [file join $fdir examples $ftail] 88 foreach fname [lsort [glob -nocomplain $fpath]] { 88 89 catch {unset entries} 90 foreach fname [glob -nocomplain $fpath] { 89 91 if {[file exists $fname]} { 90 92 if {[catch {set obj [Rappture::library $fname]} result]} { … … 98 100 99 101 # if this is new, add it 100 set i [$itk_component(combo) choices index -label $label]101 if {$i < 0} {102 $itk_component(combo) choices insert end $obj $label103 104 if {[string equal $defval [file tail $fname]]} {105 $_owner xml put $path.default $label106 }102 if {![info exists entries($label)]} { 103 set entries($label) $obj 104 } 105 106 # translate default file name => default label 107 if {[string equal $defval [file tail $fname]]} { 108 $_owner xml put $path.default $label 107 109 } 108 110 } … … 110 112 puts stderr "WARNING: missing example file \"$fname\"" 111 113 } 114 } 115 116 foreach label [lsort -dictionary [array names entries]] { 117 $itk_component(combo) choices insert end $entries($label) $label 112 118 } 113 119 } -
trunk/gui/scripts/meshresult.tcl
r15 r50 42 42 public method delete {args} 43 43 public method scale {args} 44 public method download {} 44 45 45 46 protected method _rebuild {} … … 260 261 261 262 # ---------------------------------------------------------------------- 263 # USAGE: download 264 # 265 # Clients use this method to create a downloadable representation 266 # of the plot. Returns a list of the form {ext string}, where 267 # "ext" is the file extension (indicating the type of data) and 268 # "string" is the data itself. 269 # ---------------------------------------------------------------------- 270 itcl::body Rappture::MeshResult::download {} { 271 set psdata [$itk_component(plot) postscript output -maxpect 1] 272 273 set cmds { 274 set fout "mesh[pid].pdf" 275 exec ps2pdf - $fout << $psdata 276 277 set fid [open $fout r] 278 fconfigure $fid -translation binary -encoding binary 279 set pdfdata [read $fid] 280 close $fid 281 282 file delete -force $fout 283 } 284 if {[catch $cmds result] == 0} { 285 return [list .pdf $pdfdata] 286 } 287 return [list .ps $psdata] 288 } 289 290 # ---------------------------------------------------------------------- 262 291 # USAGE: _rebuild 263 292 # -
trunk/gui/scripts/resultviewer.tcl
r22 r50 30 30 31 31 public method plot {option args} 32 public method download {} 32 33 33 34 protected method _plotAdd {xmlobj {settings ""}} … … 319 320 320 321 # ---------------------------------------------------------------------- 322 # USAGE: download 323 # 324 # Clients use this method to create a downloadable representation 325 # of the plot. Returns a list of the form {ext string}, where 326 # "ext" is the file extension (indicating the type of data) and 327 # "string" is the data itself. 328 # ---------------------------------------------------------------------- 329 itcl::body Rappture::ResultViewer::download {} { 330 if {"" == $_mode} { 331 return "" 332 } 333 return [$_mode2widget($_mode) download] 334 } 335 336 # ---------------------------------------------------------------------- 321 337 # USAGE: _xml2data <xmlobj> <path> 322 338 # -
trunk/gui/scripts/textresult.tcl
r46 r50 29 29 public method delete {args} 30 30 public method scale {args} 31 public method download {} 31 32 32 33 public method select {option args} … … 241 242 242 243 # ---------------------------------------------------------------------- 244 # USAGE: download 245 # 246 # Clients use this method to create a downloadable representation 247 # of the plot. Returns a list of the form {ext string}, where 248 # "ext" is the file extension (indicating the type of data) and 249 # "string" is the data itself. 250 # ---------------------------------------------------------------------- 251 itcl::body Rappture::TextResult::download {} { 252 return [list .txt [$itk_component(text) get 1.0 end]] 253 } 254 255 # ---------------------------------------------------------------------- 243 256 # USAGE: select all 244 257 # -
trunk/gui/scripts/valueresult.tcl
r22 r50 26 26 public method delete {args} 27 27 public method scale {args} 28 public method download {} 28 29 29 30 set _dataobj "" ;# data object currently being displayed … … 137 138 # nothing to do for values 138 139 } 140 141 # ---------------------------------------------------------------------- 142 # USAGE: download 143 # 144 # Clients use this method to create a downloadable representation 145 # of the plot. Returns a list of the form {ext string}, where 146 # "ext" is the file extension (indicating the type of data) and 147 # "string" is the data itself. 148 # ---------------------------------------------------------------------- 149 itcl::body Rappture::ValueResult::download {} { 150 return "" 151 } -
trunk/gui/scripts/xyresult.tcl
r46 r50 53 53 public method delete {args} 54 54 public method scale {args} 55 public method download {} 55 56 56 57 protected method _rebuild {} … … 352 353 353 354 # ---------------------------------------------------------------------- 355 # USAGE: download 356 # 357 # Clients use this method to create a downloadable representation 358 # of the plot. Returns a list of the form {ext string}, where 359 # "ext" is the file extension (indicating the type of data) and 360 # "string" is the data itself. 361 # ---------------------------------------------------------------------- 362 itcl::body Rappture::XyResult::download {} { 363 set psdata [$itk_component(plot) postscript output -maxpect 1] 364 365 set cmds { 366 set fout "xy[pid].pdf" 367 exec ps2pdf - $fout << $psdata 368 369 set fid [open $fout r] 370 fconfigure $fid -translation binary -encoding binary 371 set pdfdata [read $fid] 372 close $fid 373 374 file delete -force $fout 375 } 376 if {[catch $cmds result] == 0} { 377 return [list .pdf $pdfdata] 378 } 379 return [list .ps $psdata] 380 } 381 382 # ---------------------------------------------------------------------- 354 383 # USAGE: _rebuild 355 384 # … … 453 482 } 454 483 if {[info exists hints(yscale)] && $hints(yscale) == "log"} { 455 _axis scale xlog484 _axis scale y log 456 485 } 457 486
Note: See TracChangeset
for help on using the changeset viewer.