Changeset 1294 for trunk/gui/scripts/visviewer.tcl
- Timestamp:
- Mar 6, 2009, 8:41:16 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/visviewer.tcl
r1277 r1294 35 35 private variable idleTimeout_ 43200000; # 12 hours 36 36 #private variable idleTimeout_ 5000; # 5 seconds 37 #private variable idleTimeout_ 0; 37 #private variable idleTimeout_ 0; # No timeout 38 38 39 39 protected variable _dispatcher "" ;# dispatcher for !events … … 133 133 # 134 134 itk_component add drawer { 135 136 137 -handlesize 1 -sashwidth 2135 panedwindow $itk_interior.drawer \ 136 -orient horizontal -opaqueresize 1 -handlepad 0 \ 137 -handlesize 1 -sashwidth 2 138 138 } 139 139 pack $itk_component(drawer) -expand yes -fill both … … 207 207 # Connect -- 208 208 # 209 # Connect to the visualization server (e.g. nanovis, pymolproxy). 210 # Creates an event callback that is triggered when we are idle 211 # (no I/O with the server) for some specified time. Sends the server 212 # some estimate of the size of our job [soon to be deprecated]. 213 # If it's too busy, that server may forward us to another [this 209 # Connect to the visualization server (e.g. nanovis, pymolproxy). 210 # Creates an event callback that is triggered when we are idle 211 # (no I/O with the server) for some specified time. Sends the server 212 # some estimate of the size of our job [soon to be deprecated]. 213 # If it's too busy, that server may forward us to another [this 214 214 # was been turned off in nanoscale]. 215 215 # … … 260 260 # release the busy window over the hull. 261 261 $_dispatcher cancel !serverDown 262 263 264 262 if { $idleTimeout_ > 0 } { 263 $_dispatcher event -after $idleTimeout_ !timeout 264 } 265 265 blt::busy release $itk_component(hull) 266 266 fconfigure $sid_ -buffering line … … 308 308 itcl::body Rappture::VisViewer::_CheckConnection {} { 309 309 if { [IsConnected] } { 310 311 312 313 314 315 316 317 310 if { [eof $sid_] } { 311 error "unexpected eof on socket" 312 } 313 $_dispatcher cancel !timeout 314 if { $idleTimeout_ > 0 } { 315 $_dispatcher event -after $idleTimeout_ !timeout 316 } 317 return 1 318 318 } 319 319 # If we aren't connected, assume it's because the connection to the … … 326 326 set code [catch { Connect } ok] 327 327 if { $code == 0 && $ok} { 328 329 Rappture::Tooltip::cue hide 330 328 $_dispatcher event -idle !rebuild 329 Rappture::Tooltip::cue hide 330 return 1 331 331 } else { 332 333 332 Rappture::Tooltip::cue @$x,$y "Can't connect to visualization server. This may be a network problem. Wait a few moments and try resetting the view." 333 return 0 334 334 } 335 335 } … … 356 356 itcl::body Rappture::VisViewer::_SendHelper {} { 357 357 if { ![_CheckConnection] } { 358 358 return 0 359 359 } 360 360 puts $sid_ $buffer_(out) … … 374 374 itcl::body Rappture::VisViewer::_SendHelper.old {} { 375 375 if { ![_CheckConnection] } { 376 376 return 0 377 377 } 378 378 set bytesLeft [string length $buffer_(out)] … … 407 407 408 408 if { ![_CheckConnection] } { 409 409 return 0 410 410 } 411 411 # Even though the data is sent in only 1 "puts", we need to verify that … … 429 429 itcl::body Rappture::VisViewer::ReceiveBytes { size } { 430 430 if { ![_CheckConnection] } { 431 431 return 0 432 432 } 433 433 set bytes [read $sid_ $size] … … 457 457 itcl::body Rappture::VisViewer::_ReceiveHelper {} { 458 458 if { ![_CheckConnection] } { 459 459 return 0 460 460 } 461 461 set n [gets $sid_ line] 462 462 463 463 if { $n < 0 } { 464 465 464 Disconnect 465 return 0 466 466 } 467 467 set line [string trim $line] 468 468 if { $line == "" } { 469 469 return 470 470 } 471 471 if { [string compare -length 3 $line "nv>"] == 0 } { 472 473 474 475 476 477 478 479 472 ReceiveEcho <<line $line 473 append buffer_(in) [string range $line 3 end] 474 append buffer_(in) "\n" 475 if {[info complete $buffer_(in)]} { 476 set request $buffer_(in) 477 set buffer_(in) "" 478 $_parser eval $request 479 } 480 480 } elseif { [string compare -length 20 $line "NanoVis Server Error:"] == 0} { 481 482 483 481 # this shows errors coming back from the engine 482 ReceiveEcho <<error $line 483 puts stderr "Render Server Error: $line\n" 484 484 } else { 485 486 487 485 # this shows errors coming back from the engine 486 ReceiveEcho <<error $line 487 puts stderr "Garbled message: $line\n" 488 488 } 489 489 }
Note: See TracChangeset
for help on using the changeset viewer.