- Timestamp:
- Nov 19, 2014, 10:26:03 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/1.3.5/gui/scripts/visviewer.tcl
r4260 r4755 36 36 private variable _afterId -1 37 37 private variable _icon 0 38 38 39 # Number of milliseconds to wait before idle timeout. If greater than 0, 39 40 # automatically disconnect from the visualization server when idle timeout … … 42 43 #private variable _idleTimeout 5000; # 5 seconds 43 44 #private variable _idleTimeout 0; # No timeout 45 44 46 protected variable _maxConnects 100 45 47 protected variable _outbuf ; # buffer for outgoing commands … … 84 86 protected method Connect { servers } 85 87 protected method Disconnect {} 86 protected method EnableWaitDialog { bool}88 protected method EnableWaitDialog { timeout } 87 89 protected method Euler2XYZ { theta phi psi } 88 90 protected method Flush {} 91 protected method GetColormapList { args } 89 92 protected method HandleError { args } 90 93 protected method HandleOk { args } … … 285 288 continue 286 289 } 287 puts stderr " render server is $data"290 puts stderr "Render server is $data" 288 291 # We're connected. Cancel any pending serverDown events and 289 292 # release the busy window over the hull. … … 388 391 # 389 392 # Helper routine called from a file event to send data when the 390 # connection is writable (i.e. not blocked). Sets a magic 391 # variable_done($this) when we're done.393 # connection is writable (i.e. not blocked). Sets a magic variable 394 # _done($this) when we're done. 392 395 # 393 396 itcl::body Rappture::VisViewer::SendHelper {} { … … 404 407 # 405 408 # Helper routine called from a file event to send data when the 406 # connection is writable (i.e. not blocked). Sends data in chunks 407 # of 8k (or less). Sets magic variable _done($this) to indicate408 # that we're either finished (success) or could not send bytes to409 # the server(failure).409 # connection is writable (i.e. not blocked). Sends data in chunks of 8k 410 # (or less). Sets magic variable _done($this) to indicate that we're 411 # either finished (success) or could not send bytes to the server 412 # (failure). 410 413 # 411 414 itcl::body Rappture::VisViewer::SendHelper.old {} { … … 451 454 set _done($this) 1 452 455 set _buffer(out) $bytes 456 457 # There's problem when the user is interacting with the GUI at the 458 # same time we're trying to write to the server. Don't want to 459 # block because, the GUI will look like it's dead. We can start 460 # by putting a busy window over plot so that inadvertent things like 461 # mouse movements aren't received. 462 463 blt::busy hold $itk_component(main) 453 464 fileevent $_sid writable [itcl::code $this SendHelper] 454 465 tkwait variable ::Rappture::VisViewer::_done($this) 466 blt::busy release $itk_component(main) 467 455 468 set _buffer(out) "" 456 469 if { [IsConnected] } { … … 504 517 # ReceiveHelper -- 505 518 # 506 # Helper routine called from a file event when the connection is 507 # readable (i.e. a command response has been sent by the rendering508 # server. Reads the incoming command and executes it in a safe509 # interpreter to handle theaction.519 # Helper routine called from a file event when the connection is readable 520 # (i.e. a command response has been sent by the rendering server. Reads 521 # the incoming command and executes it in a safe interpreter to handle the 522 # action. 510 523 # 511 524 # Note: This routine currently only handles command responses from … … 561 574 # Color2RGB -- 562 575 # 563 # Converts a color name to a list of r,g,b values needed for the 564 # engine.Each r/g/b component is scaled in the # range 0-1.576 # Converts a color name to a list of r,g,b values needed for the engine. 577 # Each r/g/b component is scaled in the # range 0-1. 565 578 # 566 579 itcl::body Rappture::VisViewer::Color2RGB {color} { … … 596 609 itcl::body Rappture::VisViewer::SendEcho {channel {data ""}} { 597 610 if { $_logging } { 598 set f [open "/tmp/recording.log" "a"] 599 puts $f $data 600 close $f 611 set f [open "/tmp/recording.log" "a"] 612 fconfigure $f -translation binary -encoding binary 613 puts -nonewline $f $data 614 close $f 601 615 } 602 616 #puts stderr ">>($data)" … … 610 624 # 611 625 # Echoes received data to clients interested in this widget. If the 612 # -receivecommand option is set, then it is invoked in the global 613 # scope with the <channel> and <data> values as arguments. Otherwise,614 # thisdoes nothing.626 # -receivecommand option is set, then it is invoked in the global scope 627 # with the <channel> and <data> values as arguments. Otherwise, this 628 # does nothing. 615 629 # 616 630 itcl::body Rappture::VisViewer::ReceiveEcho {channel {data ""}} { … … 630 644 set inner [frame $itk_component(plotarea).view.splash] 631 645 $inner configure -relief raised -bd 2 632 label $inner.text1 -text " Rendering...\nPlease wait." \646 label $inner.text1 -text "Working...\nPlease wait." \ 633 647 -font "Arial 10" 634 648 label $inner.icon … … 873 887 } 874 888 889 itcl::body Rappture::VisViewer::GetColormapList { args } { 890 array set opts { 891 -includeDefault 0 892 -includeElementDefault 0 893 -includeNone 0 894 } 895 if {[llength $args] > 0} { 896 foreach opt $args { 897 set opts($opt) 1 898 } 899 } 900 set colormaps [list] 901 if {$opts(-includeDefault)} { 902 lappend colormaps "default" "default" 903 } 904 if {$opts(-includeElementDefault)} { 905 lappend colormaps "elementDefault" "elementDefault" 906 } 907 lappend colormaps \ 908 "BCGYR" "BCGYR" \ 909 "BGYOR" "BGYOR" \ 910 "blue-to-brown" "blue-to-brown" \ 911 "blue-to-orange" "blue-to-orange" \ 912 "blue-to-grey" "blue-to-grey" \ 913 "green-to-magenta" "green-to-magenta" \ 914 "greyscale" "greyscale" \ 915 "nanohub" "nanohub" \ 916 "rainbow" "rainbow" \ 917 "spectral" "spectral" \ 918 "ROYGB" "ROYGB" \ 919 "RYGCB" "RYGCB" \ 920 "white-to-blue" "white-to-blue" \ 921 "brown-to-blue" "brown-to-blue" \ 922 "grey-to-blue" "grey-to-blue" \ 923 "orange-to-blue" "orange-to-blue" 924 if {$opts(-includeNone)} { 925 lappend colormaps "none" "none" 926 } 927 return $colormaps 928 } 875 929 876 930 itcl::body Rappture::VisViewer::ColorsToColormap { colors } { … … 900 954 } 901 955 } 902 " blue" {956 "white-to-blue" { 903 957 return { 904 958 0.0 0.900 1.000 1.000 … … 1100 1154 # StopBufferingCommands -- 1101 1155 # 1156 # This gets called when we want to stop buffering the commands for 1157 # the server and actually send then to the server. Note that there's 1158 # a reference count on buffering. This is so that you can can 1159 # Start/Stop multiple times without worrying about the current state. 1160 # 1102 1161 itcl::body Rappture::VisViewer::StopBufferingCommands { } { 1103 1162 incr _buffering -1
Note: See TracChangeset
for help on using the changeset viewer.