Ignore:
Timestamp:
Mar 6, 2009, 8:41:16 PM (16 years ago)
Author:
dkearney
Message:

code clean up, hate tabs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/visviewer.tcl

    r1277 r1294  
    3535    private variable idleTimeout_ 43200000; # 12 hours
    3636    #private variable idleTimeout_ 5000;    # 5 seconds
    37     #private variable idleTimeout_ 0;       # No timeout
     37    #private variable idleTimeout_ 0;       # No timeout
    3838
    3939    protected variable _dispatcher ""   ;# dispatcher for !events
     
    133133    #
    134134    itk_component add drawer {
    135         panedwindow $itk_interior.drawer \
    136             -orient horizontal -opaqueresize 1 -handlepad 0 \
    137             -handlesize 1 -sashwidth 2     
     135        panedwindow $itk_interior.drawer \
     136            -orient horizontal -opaqueresize 1 -handlepad 0 \
     137            -handlesize 1 -sashwidth 2
    138138    }
    139139    pack $itk_component(drawer) -expand yes -fill both
     
    207207# Connect --
    208208#
    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
    214214#    was been turned off in nanoscale].
    215215#
     
    260260            # release the busy window over the hull.
    261261            $_dispatcher cancel !serverDown
    262             if { $idleTimeout_ > 0 } {
    263                 $_dispatcher event -after $idleTimeout_ !timeout
    264             }
     262            if { $idleTimeout_ > 0 } {
     263                $_dispatcher event -after $idleTimeout_ !timeout
     264            }
    265265            blt::busy release $itk_component(hull)
    266266            fconfigure $sid_ -buffering line
     
    308308itcl::body Rappture::VisViewer::_CheckConnection {} {
    309309    if { [IsConnected] } {
    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
     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
    318318    }
    319319    # If we aren't connected, assume it's because the connection to the
     
    326326    set code [catch { Connect } ok]
    327327    if { $code == 0 && $ok} {
    328         $_dispatcher event -idle !rebuild
    329         Rappture::Tooltip::cue hide
    330         return 1
     328        $_dispatcher event -idle !rebuild
     329        Rappture::Tooltip::cue hide
     330        return 1
    331331    } else {
    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
     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
    334334    }
    335335}
     
    356356itcl::body Rappture::VisViewer::_SendHelper {} {
    357357    if { ![_CheckConnection] } {
    358         return 0
     358        return 0
    359359    }
    360360    puts $sid_ $buffer_(out)
     
    374374itcl::body Rappture::VisViewer::_SendHelper.old {} {
    375375    if { ![_CheckConnection] } {
    376         return 0
     376        return 0
    377377    }
    378378    set bytesLeft [string length $buffer_(out)]
     
    407407
    408408    if { ![_CheckConnection] } {
    409         return 0
     409        return 0
    410410    }
    411411    # Even though the data is sent in only 1 "puts", we need to verify that
     
    429429itcl::body Rappture::VisViewer::ReceiveBytes { size } {
    430430    if { ![_CheckConnection] } {
    431         return 0
     431        return 0
    432432    }
    433433    set bytes [read $sid_ $size]
     
    457457itcl::body Rappture::VisViewer::_ReceiveHelper {} {
    458458    if { ![_CheckConnection] } {
    459         return 0
     459        return 0
    460460    }
    461461    set n [gets $sid_ line]
    462    
     462
    463463    if { $n < 0 } {
    464         Disconnect
    465         return 0
     464        Disconnect
     465        return 0
    466466    }
    467467    set line [string trim $line]
    468468    if { $line == "" } {
    469         return
     469        return
    470470    }
    471471    if { [string compare -length 3 $line "nv>"] == 0 } {
    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         }
     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        }
    480480    } elseif { [string compare -length 20 $line "NanoVis Server Error:"] == 0} {
    481         # this shows errors coming back from the engine
    482         ReceiveEcho <<error $line
    483         puts stderr "Render Server Error: $line\n"
     481        # this shows errors coming back from the engine
     482        ReceiveEcho <<error $line
     483        puts stderr "Render Server Error: $line\n"
    484484    } else {
    485         # this shows errors coming back from the engine
    486         ReceiveEcho <<error $line
    487         puts stderr "Garbled message: $line\n"
     485        # this shows errors coming back from the engine
     486        ReceiveEcho <<error $line
     487        puts stderr "Garbled message: $line\n"
    488488    }
    489489}
Note: See TracChangeset for help on using the changeset viewer.