- Timestamp:
- Feb 11, 2015, 2:51:13 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/visviewer.tcl
r4692 r5005 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 1 # -*- mode: tcl; indent-tabs-mode: nil -*- 2 2 3 3 # ---------------------------------------------------------------------- 4 # VisViewer - 5 # 6 # This class is the base class for the various visualization viewers 4 # VisViewer - 5 # 6 # This class is the base class for the various visualization viewers 7 7 # that use the nanoserver render farm. 8 8 # … … 32 32 private common _done ; # Used to indicate status of send. 33 33 private variable _buffer ; # buffer for incoming/outgoing commands 34 private variable _initialized 34 private variable _initialized 35 35 private variable _isOpen 0 36 36 private variable _afterId -1 … … 74 74 private method SendHelper {} 75 75 private method SendHelper.old {} 76 private method WaitDialog { state } 77 78 protected method ToggleConsole {} 79 private method DebugConsole {} 80 private method BuildConsole {} 81 private method HideConsole {} 82 private method TraceComm { channel {data {}} } 83 private method SendDebugCommand {} 76 private method WaitDialog { state } 77 78 protected method ToggleConsole {} 79 private method DebugConsole {} 80 private method BuildConsole {} 81 private method HideConsole {} 82 private method TraceComm { channel {data {}} } 83 private method SendDebugCommand {} 84 84 85 85 protected method CheckConnection {} … … 88 88 protected method Connect { servers } 89 89 protected method Disconnect {} 90 protected method EnableWaitDialog { timeout } 90 protected method EnableWaitDialog { timeout } 91 91 protected method Euler2XYZ { theta phi psi } 92 92 protected method Flush {} … … 102 102 protected method SendEcho { channel {data ""} } 103 103 protected method StartBufferingCommands {} 104 protected method StartWaiting {} 104 protected method StartWaiting {} 105 105 protected method StopBufferingCommands {} 106 protected method StopWaiting {} 107 108 private method Waiting { option widget } 106 protected method StopWaiting {} 107 108 private method Waiting { option widget } 109 109 110 110 private proc CheckNameList { namelist } { … … 200 200 global env 201 201 if { [info exists env(VISRECORDER)] } { 202 203 204 205 202 set _logging 1 203 if { [file exists /tmp/recording.log] } { 204 file delete /tmp/recording.log 205 } 206 206 } 207 207 eval itk_initialize $args … … 259 259 # Connect to the visualization server (e.g. nanovis, pymolproxy). 260 260 # Creates an event callback that is triggered when we are idle 261 # (no I/O with the server) for some specified time. 261 # (no I/O with the server) for some specified time. 262 262 # 263 263 itcl::body Rappture::VisViewer::Connect { servers } { … … 282 282 set _hostname $server 283 283 fconfigure $_sid -translation binary -encoding binary 284 284 285 285 # Read back the server identification string. 286 286 if { [gets $_sid data] <= 0 } { … … 318 318 after cancel $_afterId 319 319 $_dispatcher cancel !timeout 320 catch {close $_sid} 320 catch {close $_sid} 321 321 set _sid "" 322 322 set _buffer(in) "" … … 344 344 # CheckConection -- 345 345 # 346 # This routine is called whenever we're about to send/receive data on 347 # the socket connection to the visualization server. If we're connected, 348 # then reset the timeout event. Otherwise try to reconnect to the 346 # This routine is called whenever we're about to send/receive data on 347 # the socket connection to the visualization server. If we're connected, 348 # then reset the timeout event. Otherwise try to reconnect to the 349 349 # visualization server. 350 350 # … … 402 402 } 403 403 puts -nonewline $_sid $_buffer(out) 404 flush $_sid 404 flush $_sid 405 405 set _buffer(out) "" 406 406 set _done($this) 1; # Success … … 467 467 SendHelper 468 468 } else { 469 # This can cause us to re-enter SendBytes during the tkwait, which 469 # This can cause us to re-enter SendBytes during the tkwait, which 470 470 # is not safe because the _buffer will be clobbered 471 471 blt::busy hold $itk_component(main) … … 487 487 # StartWaiting -- 488 488 # 489 # Read some number of bytes from the visualization server. 489 # Read some number of bytes from the visualization server. 490 490 # 491 491 492 492 itcl::body Rappture::VisViewer::StartWaiting {} { 493 493 if { $_waitTimeout > 0 } { 494 after cancel $_afterId 494 after cancel $_afterId 495 495 set _afterId [after $_waitTimeout [itcl::code $this WaitDialog on]] 496 496 } 497 497 } 498 498 499 itcl::body Rappture::VisViewer::StopWaiting {} { 499 itcl::body Rappture::VisViewer::StopWaiting {} { 500 500 if { $_waitTimeout > 0 } { 501 501 WaitDialog off … … 503 503 } 504 504 505 itcl::body Rappture::VisViewer::EnableWaitDialog { value } { 505 itcl::body Rappture::VisViewer::EnableWaitDialog { value } { 506 506 set _waitTimeout $value 507 507 } … … 510 510 # ReceiveBytes -- 511 511 # 512 # Read some number of bytes from the visualization server. 512 # Read some number of bytes from the visualization server. 513 513 # 514 514 itcl::body Rappture::VisViewer::ReceiveBytes { size } { … … 631 631 } 632 632 633 # 633 # 634 634 # ReceiveEcho -- 635 635 # … … 654 654 } 655 655 set inner [frame $itk_component(plotarea).view.splash] 656 $inner configure -relief raised -bd 2 656 $inner configure -relief raised -bd 2 657 657 label $inner.text1 -text "Working...\nPlease wait." \ 658 -font "Arial 10" 659 label $inner.icon 658 -font "Arial 10" 659 label $inner.icon 660 660 pack $inner -expand yes -anchor c 661 661 blt::table $inner \ 662 662 0,0 $inner.text1 -anchor w \ 663 0,1 $inner.icon 663 0,1 $inner.icon 664 664 Waiting start $inner.icon 665 665 } else { … … 721 721 pack $f.send.l -side left 722 722 itk_component add command { 723 723 entry $f.send.e -background white 724 724 } { 725 725 ignore -background 726 726 } 727 727 pack $f.send.e -side left -expand yes -fill x … … 731 731 pack $f.sb -side right -fill y 732 732 itk_component add trace { 733 733 text $f.comm -wrap char -yscrollcommand "$f.sb set" -background white 734 734 } { 735 735 ignore -background 736 736 } 737 737 pack $f.comm -expand yes -fill both … … 741 741 742 742 $itk_component(trace) tag configure error -foreground red \ 743 743 -font -*-courier-medium-o-normal-*-*-120-* 744 744 $itk_component(trace) tag configure incoming -foreground blue 745 745 } … … 753 753 itcl::body Rappture::VisViewer::ToggleConsole {} { 754 754 if { $_debugConsole } { 755 755 set _debugConsole 0 756 756 } else { 757 757 set _debugConsole 1 758 758 } 759 759 DebugConsole … … 763 763 # DebugConsole -- 764 764 # 765 # Based on the value of the variable _debugConsole, turns on/off 766 # debugging. This is done by setting/unsetting a procedure that 767 # is called whenever new characters are received or sent on the 765 # Based on the value of the variable _debugConsole, turns on/off 766 # debugging. This is done by setting/unsetting a procedure that 767 # is called whenever new characters are received or sent on the 768 768 # socket to the render server. Additionally, the debug console 769 769 # is created if necessary and hidden/shown. … … 771 771 itcl::body Rappture::VisViewer::DebugConsole {} { 772 772 if { ![winfo exists .renderconsole] } { 773 773 BuildConsole 774 774 } 775 775 if { $_debugConsole } { 776 777 778 776 $this configure -sendcommand [itcl::code $this TraceComm] 777 $this configure -receivecommand [itcl::code $this TraceComm] 778 wm deiconify .renderconsole 779 779 } else { 780 781 782 780 $this configure -sendcommand "" 781 $this configure -receivecommand "" 782 wm withdraw .renderconsole 783 783 } 784 784 } … … 866 866 -title "Render Server Error" 867 867 set inner [$popup component inner] 868 label $inner.summary -text "" -anchor w 868 label $inner.summary -text "" -anchor w 869 869 870 870 Rappture::Scroller $inner.scrl \ 871 -xscrollmode auto -yscrollmode auto 871 -xscrollmode auto -yscrollmode auto 872 872 text $inner.scrl.text \ 873 873 -font "Arial 9 " -background white -relief sunken -bd 1 \ … … 878 878 blt::table $inner \ 879 879 0,0 $inner.scrl -fill both \ 880 1,0 $inner.ok 881 $inner.scrl.text tag configure normal -font "Arial 9" 882 $inner.scrl.text tag configure italic -font "Arial 9 italic" 880 1,0 $inner.ok 881 $inner.scrl.text tag configure normal -font "Arial 9" 882 $inner.scrl.text tag configure italic -font "Arial 9 italic" 883 883 $inner.scrl.text tag configure bold -font "Arial 10 bold" 884 884 $inner.scrl.text tag configure code -font "Courier 10 bold" … … 889 889 set inner [$popup component inner] 890 890 $inner.scrl.text delete 0.0 end 891 891 892 892 $inner.scrl.text configure -state normal 893 893 $inner.scrl.text insert end "The following error was reported by the render server:\n\n" bold … … 959 959 "blue-to-grey" { 960 960 return { 961 0.0 0.000 0.600 0.800 962 0.14285714285714285 0.400 0.900 1.000 963 0.2857142857142857 0.600 1.000 1.000 964 0.42857142857142855 0.800 1.000 1.000 965 0.5714285714285714 0.900 0.900 0.900 966 0.7142857142857143 0.600 0.600 0.600 967 0.8571428571428571 0.400 0.400 0.400 961 0.0 0.000 0.600 0.800 962 0.14285714285714285 0.400 0.900 1.000 963 0.2857142857142857 0.600 1.000 1.000 964 0.42857142857142855 0.800 1.000 1.000 965 0.5714285714285714 0.900 0.900 0.900 966 0.7142857142857143 0.600 0.600 0.600 967 0.8571428571428571 0.400 0.400 0.400 968 968 1.0 0.200 0.200 0.200 969 969 } 970 970 } 971 971 "white-to-blue" { 972 return { 973 0.0 0.900 1.000 1.000 974 0.1111111111111111 0.800 0.983 1.000 975 0.2222222222222222 0.700 0.950 1.000 976 0.3333333333333333 0.600 0.900 1.000 977 0.4444444444444444 0.500 0.833 1.000 978 0.5555555555555556 0.400 0.750 1.000 979 0.6666666666666666 0.300 0.650 1.000 980 0.7777777777777778 0.200 0.533 1.000 981 0.8888888888888888 0.100 0.400 1.000 972 return { 973 0.0 0.900 1.000 1.000 974 0.1111111111111111 0.800 0.983 1.000 975 0.2222222222222222 0.700 0.950 1.000 976 0.3333333333333333 0.600 0.900 1.000 977 0.4444444444444444 0.500 0.833 1.000 978 0.5555555555555556 0.400 0.750 1.000 979 0.6666666666666666 0.300 0.650 1.000 980 0.7777777777777778 0.200 0.533 1.000 981 0.8888888888888888 0.100 0.400 1.000 982 982 1.0 0.000 0.250 1.000 983 983 } … … 985 985 "brown-to-blue" { 986 986 return { 987 0.0 0.200 0.100 0.000 988 0.09090909090909091 0.400 0.187 0.000 989 0.18181818181818182 0.600 0.379 0.210 990 0.2727272727272727 0.800 0.608 0.480 991 0.36363636363636365 0.850 0.688 0.595 992 0.45454545454545453 0.950 0.855 0.808 993 0.5454545454545454 0.800 0.993 1.000 994 0.6363636363636364 0.600 0.973 1.000 995 0.7272727272727273 0.400 0.940 1.000 996 0.8181818181818182 0.200 0.893 1.000 997 0.9090909090909091 0.000 0.667 0.800 998 1.0 0.000 0.480 0.600 987 0.0 0.200 0.100 0.000 988 0.09090909090909091 0.400 0.187 0.000 989 0.18181818181818182 0.600 0.379 0.210 990 0.2727272727272727 0.800 0.608 0.480 991 0.36363636363636365 0.850 0.688 0.595 992 0.45454545454545453 0.950 0.855 0.808 993 0.5454545454545454 0.800 0.993 1.000 994 0.6363636363636364 0.600 0.973 1.000 995 0.7272727272727273 0.400 0.940 1.000 996 0.8181818181818182 0.200 0.893 1.000 997 0.9090909090909091 0.000 0.667 0.800 998 1.0 0.000 0.480 0.600 999 999 } 1000 1000 } 1001 1001 "blue-to-brown" { 1002 1002 return { 1003 0.0 0.000 0.480 0.600 1004 0.09090909090909091 0.000 0.667 0.800 1005 0.18181818181818182 0.200 0.893 1.000 1006 0.2727272727272727 0.400 0.940 1.000 1007 0.36363636363636365 0.600 0.973 1.000 1008 0.45454545454545453 0.800 0.993 1.000 1009 0.5454545454545454 0.950 0.855 0.808 1010 0.6363636363636364 0.850 0.688 0.595 1011 0.7272727272727273 0.800 0.608 0.480 1012 0.8181818181818182 0.600 0.379 0.210 1013 0.9090909090909091 0.400 0.187 0.000 1014 1.0 0.200 0.100 0.000 1003 0.0 0.000 0.480 0.600 1004 0.09090909090909091 0.000 0.667 0.800 1005 0.18181818181818182 0.200 0.893 1.000 1006 0.2727272727272727 0.400 0.940 1.000 1007 0.36363636363636365 0.600 0.973 1.000 1008 0.45454545454545453 0.800 0.993 1.000 1009 0.5454545454545454 0.950 0.855 0.808 1010 0.6363636363636364 0.850 0.688 0.595 1011 0.7272727272727273 0.800 0.608 0.480 1012 0.8181818181818182 0.600 0.379 0.210 1013 0.9090909090909091 0.400 0.187 0.000 1014 1.0 0.200 0.100 0.000 1015 1015 } 1016 1016 } … … 1050 1050 set clist { 1051 1051 "#EE82EE" 1052 "#4B0082" 1053 "blue" 1054 "#008000" 1055 "yellow" 1056 "#FFA500" 1057 "red" 1052 "#4B0082" 1053 "blue" 1054 "#008000" 1055 "yellow" 1056 "#FFA500" 1057 "red" 1058 1058 } 1059 1059 } 1060 1060 "BGYOR" { 1061 1061 set clist { 1062 "blue" 1063 "#008000" 1064 "yellow" 1065 "#FFA500" 1066 "red" 1062 "blue" 1063 "#008000" 1064 "yellow" 1065 "#FFA500" 1066 "red" 1067 1067 } 1068 1068 } 1069 1069 "ROYGB" { 1070 1070 set clist { 1071 "red" 1072 "#FFA500" 1073 "yellow" 1074 "#008000" 1075 "blue" 1071 "red" 1072 "#FFA500" 1073 "yellow" 1074 "#008000" 1075 "blue" 1076 1076 } 1077 1077 } 1078 1078 "RYGCB" { 1079 1079 set clist { 1080 "red" 1081 "yellow" 1080 "red" 1081 "yellow" 1082 1082 "green" 1083 1083 "cyan" … … 1087 1087 "BCGYR" { 1088 1088 set clist { 1089 "blue" 1089 "blue" 1090 1090 "cyan" 1091 1091 "green" 1092 "yellow" 1093 "red" 1092 "yellow" 1093 "red" 1094 1094 } 1095 1095 } 1096 1096 "spectral" { 1097 1097 return { 1098 0.0 0.150 0.300 1.000 1099 0.1 0.250 0.630 1.000 1100 0.2 0.450 0.850 1.000 1101 0.3 0.670 0.970 1.000 1102 0.4 0.880 1.000 1.000 1103 0.5 1.000 1.000 0.750 1104 0.6 1.000 0.880 0.600 1105 0.7 1.000 0.680 0.450 1106 0.8 0.970 0.430 0.370 1107 0.9 0.850 0.150 0.196 1098 0.0 0.150 0.300 1.000 1099 0.1 0.250 0.630 1.000 1100 0.2 0.450 0.850 1.000 1101 0.3 0.670 0.970 1.000 1102 0.4 0.880 1.000 1.000 1103 0.5 1.000 1.000 0.750 1104 0.6 1.000 0.880 0.600 1105 0.7 1.000 0.680 0.450 1106 0.8 0.970 0.430 0.370 1107 0.9 0.850 0.150 0.196 1108 1108 1.0 0.650 0.000 0.130 1109 1109 } … … 1111 1111 "green-to-magenta" { 1112 1112 return { 1113 0.0 0.000 0.316 0.000 1114 0.06666666666666667 0.000 0.526 0.000 1115 0.13333333333333333 0.000 0.737 0.000 1116 0.2 0.000 0.947 0.000 1117 0.26666666666666666 0.316 1.000 0.316 1118 0.3333333333333333 0.526 1.000 0.526 1119 0.4 0.737 1.000 0.737 1120 0.4666666666666667 1.000 1.000 1.000 1121 0.5333333333333333 1.000 0.947 1.000 1122 0.6 1.000 0.737 1.000 1123 0.6666666666666666 1.000 0.526 1.000 1124 0.7333333333333333 1.000 0.316 1.000 1125 0.8 0.947 0.000 0.947 1126 0.8666666666666667 0.737 0.000 0.737 1127 0.9333333333333333 0.526 0.000 0.526 1113 0.0 0.000 0.316 0.000 1114 0.06666666666666667 0.000 0.526 0.000 1115 0.13333333333333333 0.000 0.737 0.000 1116 0.2 0.000 0.947 0.000 1117 0.26666666666666666 0.316 1.000 0.316 1118 0.3333333333333333 0.526 1.000 0.526 1119 0.4 0.737 1.000 0.737 1120 0.4666666666666667 1.000 1.000 1.000 1121 0.5333333333333333 1.000 0.947 1.000 1122 0.6 1.000 0.737 1.000 1123 0.6666666666666666 1.000 0.526 1.000 1124 0.7333333333333333 1.000 0.316 1.000 1125 0.8 0.947 0.000 0.947 1126 0.8666666666666667 0.737 0.000 0.737 1127 0.9333333333333333 0.526 0.000 0.526 1128 1128 1.0 0.316 0.000 0.316 1129 1129 } 1130 1130 } 1131 1131 "greyscale" { 1132 return { 1132 return { 1133 1133 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1134 1134 } … … 1161 1161 # 1162 1162 itcl::body Rappture::VisViewer::StartBufferingCommands { } { 1163 incr _buffering 1163 incr _buffering 1164 1164 if { $_buffering == 1 } { 1165 1165 set _outbuf "" … … 1187 1187 # 1188 1188 # Send commands off to the rendering server. If we're currently 1189 # sending data objects to the server, buffer the commands to be 1189 # sending data objects to the server, buffer the commands to be 1190 1190 # sent later. 1191 1191 # … … 1206 1206 # 1207 1207 # Send commands off to the rendering server. If we're currently 1208 # sending data objects to the server, buffer the commands to be 1208 # sending data objects to the server, buffer the commands to be 1209 1209 # sent later. 1210 1210 #
Note: See TracChangeset
for help on using the changeset viewer.