Changeset 695 for trunk/gui/scripts


Ignore:
Timestamp:
May 3, 2007, 8:11:17 PM (17 years ago)
Author:
nkissebe
Message:

clean up recovery of lost server connection

File:
1 edited

Legend:

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

    r690 r695  
    7878    private variable _mrepresentation "spheres"
    7979    private variable _cacheimage ""
     80        private variable _busy 0
    8081}
    8182
     
    286287itcl::body Rappture::MolvisViewer::destructor {} {
    287288    #puts stderr "MolvisViewer::destructor()"
     289    image delete $_image(plot)
    288290        disconnect
    289291}
     
    320322# ----------------------------------------------------------------------
    321323itcl::body Rappture::MolvisViewer::connect {{hostlist ""}} {
     324    #puts stderr "Rappture::MolvisViewer::connect($hostlist)"
     325
    322326    if { "" != $hostlist } { set _hostlist $hostlist }
    323327
    324328    set hostlist $_hostlist
     329    $_image(plot) blank
    325330
    326331    if ([isconnected]) {
     
    332337    }
    333338
    334     blt::busy hold $itk_component(hull);
     339    blt::busy hold $itk_component(hull) -cursor watch
    335340   
    336341    update idletasks
     
    406411    catch { after cancel $_rocker(afterid) }
    407412        catch { after cancel $_mevent(afterid) }
    408     image delete $_image(plot)
    409413
    410414    catch {
     
    449453            set w [winfo width $itk_component(3dview)]
    450454            set h [winfo height $itk_component(3dview)]
    451             puts $_sid "screen -push $w $h"
     455            puts $_sid "screen -defer $w $h"
    452456            flush $_sid
    453457            $_dispatcher event -idle !rebuild
     
    513517            $_image(plot) put $_imagecache($tag)
    514518            set _image(id) $tag
    515             $itk_component(3dview) configure -cursor ""
     519                        if { $_busy } {
     520                $itk_component(3dview) configure -cursor ""
     521                                set _busy 0
     522                        }
    516523            update idletasks
    517524            break
     
    542549        set _inrebuild 1
    543550        set changed 0
     551        set _busy 1
     552
     553    $itk_component(3dview) configure -cursor watch
    544554
    545555        # refresh GUI (primarily to make pending cursor changes visible)
     
    635645                        _send enable -defer $obj
    636646                    if { $_labels } {
    637                                 _send label on
     647                                _send label -defer on
    638648                        } else {
    639                                 _send label off
     649                                _send label -defer off
    640650                        }
    641651                set changed 1
     
    680690    } else {
    681691                set _state(client) $state
    682         $itk_component(3dview) configure -cursor ""
    683692                _update
    684693        }
     
    715724    #puts stderr "Rappture::MolvisViewer::_configure($w $h)"
    716725
    717         _send screen -push $w $h
    718726    $_image(plot) configure -width $w -height $h
     727        _send screen $w $h
    719728}
    720729
     
    850859    }
    851860
     861        if { ![info exists _mevent(x)] } {
     862                set option "click"
     863        }
     864
    852865    if { $option == "click" } {
    853866        $itk_component(3dview) configure -cursor fleur
     
    855868
    856869    if { $option == "drag" || $option == "release" } {
    857         set diff [expr $now - $_mevent(time) ]
     870            set diff 0
     871        catch { set diff [expr $now - $_mevent(time) ] }
    858872
    859873        if {$diff < 75 && $option == "drag" } { # 75ms between motion updates
     
    917931itcl::body Rappture::MolvisViewer::_serverDown {} {
    918932    #puts stderr "MolvisViewer::_serverDown()"
     933
    919934    set x [expr {[winfo rootx $itk_component(area)]+10}]
    920935    set y [expr {[winfo rooty $itk_component(area)]+10}]
    921     # this would automatically switch to vtk viewer:
    922     # set parent [winfo parent $itk_component(hull)]
    923     # $parent viewer vtk
     936
    924937    Rappture::Tooltip::cue @$x,$y "Lost connection to visualization server.  This happens sometimes when there are too many users and the system runs out of memory.\n\nTo reconnect, reset the view or press any other control.  Your picture should come right back up."
    925938}
     
    10811094                set _dobj2raise($dataobj) $params(-raise)
    10821095
    1083         $itk_component(3dview) configure -cursor watch
    10841096        $_dispatcher event -idle !rebuild
    10851097    }
     
    11391151        # if anything changed, then rebuild the plot
    11401152        if {$changed} {
    1141         $itk_component(3dview) configure -cursor watch
    11421153        $_dispatcher event -idle !rebuild
    11431154        }
Note: See TracChangeset for help on using the changeset viewer.