- Timestamp:
- Mar 18, 2009, 1:07:15 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/molvisviewer.tcl
r1336 r1339 68 68 public method representation {option {model "all"} } 69 69 public method atomscale {option {model "all"} } 70 public method bondthickness {option {model "all"} } 70 71 public method ResetView {} 71 72 public method settings {option args} … … 115 116 common _downloadPopup ;# download options from popup 116 117 private variable _pdbdata ;# pdb data from run file sent to pymol 118 private common hardcopy_ 119 private variable nextToken_ 0 117 120 } 118 121 … … 435 438 -value lines -font "Arial 9" -pady 0 436 439 437 label $inner.sizelabel -text "Atom Scale" -font "Arial 9 bold" 438 scale $inner.atomscale \ 439 -from 0.1 -to 2.0 -resolution 0.05 \ 440 scale $inner.atomscale -width 10 -font "Arial 9 bold" \ 441 -from 0.1 -to 2.0 -resolution 0.05 -label "Atom Scale" \ 440 442 -showvalue true -orient horizontal \ 441 443 -command [itcl::code $this atomscale] \ … … 443 445 $inner.atomscale set $_settings($this-atomscale) 444 446 445 label $inner.bondthicknesslabel -text "Bond Thickness" -font "Arial 9 bold" 446 scale $inner.bondthickness \ 447 -from 0.1 -to 1.0 -resolution 0.25 \ 447 scale $inner.bondthickness -width 10 -font "Arial 9 bold" \ 448 -from 0.1 -to 1.0 -resolution 0.025 -label "Bond Thickness" \ 448 449 -showvalue true -orient horizontal \ 449 450 -command [itcl::code $this bondthickness] \ … … 469 470 2,2 $inner.lines -anchor w -columnspan 2 \ 470 471 3,2 $inner.bstick -anchor w -columnspan 2 \ 471 4,0 $inner.sizelabel -columnspan 4 -anchor w \ 472 5,1 $inner.atomscale -anchor w -columnspan 3 \ 473 6,0 $inner.bondthicknesslabel -columnspan 4 -anchor w \ 474 7,1 $inner.bondthickness -anchor w -columnspan 3 \ 475 8,0 $inner.labels -anchor w -columnspan 4 \ 476 9,0 $inner.rock -anchor w -columnspan 4 \ 477 10,0 $inner.ortho -anchor w -columnspan 4 472 4,0 $inner.labels -anchor w -columnspan 4 \ 473 5,0 $inner.rock -anchor w -columnspan 4 \ 474 6,0 $inner.ortho -anchor w -columnspan 4 \ 475 8,1 $inner.atomscale -anchor w -columnspan 2 \ 476 10,1 $inner.bondthickness -anchor w -columnspan 2 478 477 479 478 blt::table configure $inner c0 -resize expand -width 2 … … 517 516 -variable Rappture::MolvisViewer::_downloadPopup(format) \ 518 517 -value jpg 518 pack $inner.jpg -anchor w 519 radiobutton $inner.jpg -text "PNG Image" \ 520 -variable Rappture::MolvisViewer::_downloadPopup(format) \ 521 -value png 519 522 pack $inner.jpg -anchor w 520 523 radiobutton $inner.pdb -text "PDB File" \ … … 541 544 } 542 545 switch -- $_downloadPopup(format) { 543 jpg { 544 return [ \ 545 list .jpg [ \ 546 Rappture::encoding::decode -as b64 [ \ 547 $_image(plot) data -format jpeg]]] 548 } 549 pdb { 550 return [list .pdb $_pdbdata] 551 } 546 jpg { 547 set data [$_image(plot) data -format jpeg] 548 set encoded [Rappture::encoding::decode -as b64 $data] 549 return [list .jpg $encoded] 550 } 551 png { 552 set token "print[incr nextToken_]" 553 _send "print $token 2400 2400" 554 # Setup popup with cancel button and timeout. 555 blt::busy hold $popup 556 tkwait Rappture::MolvisViewer::hardcopy_($this-$token) 557 # Pass the image as-is. Don't convert it. 558 set data $hardcopy_($this-$token) 559 set encoded [Rappture::encoding::decode -as b64 $data] 560 blt::busy release $popup 561 return [list .png $encoded] 562 } 563 pdb { 564 return [list .pdb $_pdbdata] 565 } 552 566 } 553 567 } … … 646 660 set _cacheid $cacheid 647 661 } 648 # debug "reading $size bytes from proxy\n" 649 set _imagecache($tag) [ReceiveBytes $size] 650 # debug "success: reading $size bytes from proxy\n" 651 652 #debug "CACHED: $tag,$cacheid" 653 $_image(plot) configure -data $_imagecache($tag) 654 set _image(id) $tag 662 #debug "reading $size bytes from proxy\n" 663 set data [ReceiveBytes $size] 664 #debug "success: reading $size bytes from proxy\n" 665 if { $cacheid == "print" } { 666 # $frame is the token that we sent to the proxy. 667 set hardcopy_($this-$frame) $data 668 } else { 669 set _imagecache($tag) $data 670 #debug "CACHED: $tag,$cacheid" 671 $_image(plot) configure -data $data 672 set _image(id) $tag 673 } 655 674 } 656 675 … … 1348 1367 set scale $option 1349 1368 if { ($scale < 0.1) || ($scale > 2.0) } { 1350 error "bad atom size\"$scale\""1369 error "bad bind thickness \"$scale\"" 1351 1370 } 1352 1371 } else {
Note: See TracChangeset
for help on using the changeset viewer.