Changeset 5160


Ignore:
Timestamp:
Mar 21, 2015, 5:59:48 PM (5 years ago)
Author:
ldelgass
Message:

Override SendCmd? method from VisViewer? superclass rather than using a renamed
method

File:
1 edited

Legend:

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

    r5135 r5160  
    11# -*- mode: tcl; indent-tabs-mode: nil -*-
    2 
    32# ----------------------------------------------------------------------
    43#  COMPONENT: molvisviewer - view a molecule in 3D
     
    117116    protected method Rebuild { }
    118117    protected method Rotate {option x y}
    119     protected method ServerCmd { string }
     118    protected method SendCmd { string }
    120119    protected method Unmap {}
    121120    protected method Vmouse  {option b m x y}
     
    699698            lappend info "user" $user
    700699            lappend info "session" $session
    701             ServerCmd "clientinfo [list $info]"
     700            SendCmd "clientinfo [list $info]"
    702701        }
    703702
     
    731730}
    732731
    733 itcl::body Rappture::MolvisViewer::ServerCmd { cmd } {
    734     debug "in ServerCmd ($cmd)\n"
     732itcl::body Rappture::MolvisViewer::SendCmd { cmd } {
     733    debug "in SendCmd ($cmd)\n"
    735734
    736735    if { $_state(server) != $_state(client) } {
    737         SendCmd "frame -defer $_state(client)"
     736        VisViewer::SendCmd "frame -defer $_state(client)"
    738737        set _state(server) $_state(client)
    739738    }
    740739    if { $_rocker(server) != $_rocker(client) } {
    741         SendCmd "rock -defer $_rocker(client)"
     740        VisViewer::SendCmd "rock -defer $_rocker(client)"
    742741        set _rocker(server) $_rocker(client)
    743742    }
    744     SendCmd "$cmd"
     743    VisViewer::SendCmd "$cmd"
    745744}
    746745
     
    891890        set _cacheid 0
    892891
    893         ServerCmd "raw -defer {set auto_color,0}"
    894         ServerCmd "raw -defer {set auto_show_lines,0}"
     892        SendCmd "raw -defer {set auto_color,0}"
     893        SendCmd "raw -defer {set auto_show_lines,0}"
    895894    }
    896895    set _first ""
     
    935934                lappend info "tool_revision" \
    936935                    [$xmlobj get tool.version.application.revision]
    937                 ServerCmd "clientinfo [list $info]"
     936                SendCmd "clientinfo [list $info]"
    938937            }
    939938            foreach _atom [$dataobj children -type atom components.molecule] {
     
    965964                # We know we're buffered here, so append the "loadpdb" command
    966965                # with the data payload immediately afterwards.
    967                 ServerCmd "loadpdb -defer follows $model $state $numBytes"
     966                SendCmd "loadpdb -defer follows $model $state $numBytes"
    968967                SendData $data1
    969968                set _dataobjs($model-$state)  1
     
    978977                # We know we're buffered here, so append the "loadpdb" command
    979978                # with the data payload immediately afterwards.
    980                 ServerCmd "loadpdb -defer follows $model $state $numBytes"
     979                SendCmd "loadpdb -defer follows $model $state $numBytes"
    981980                SendData $data2
    982981                set _dataobjs($model-$state)  1
     
    10271026                    # We know we're buffered here, so append the "loadpdb"
    10281027                    # command with the data payload immediately afterwards.
    1029                     ServerCmd "loadpdb -defer follows $model $state $numBytes"
     1028                    SendCmd "loadpdb -defer follows $model $state $numBytes"
    10301029                    SendData $data3
    10311030                }
     
    10511050        if { $vector != "" } {
    10521051            set vertices [ComputeParallelepipedVertices $dataobj]
    1053             ServerCmd "raw -defer {verts = \[$vertices\]\n}"
    1054             ServerCmd "raw -defer {run \$PYMOL_SITE_PATH/rappture/box.py\n}"
    1055             ServerCmd "raw -defer {draw_box(verts)\n}"
     1052            SendCmd "raw -defer {verts = \[$vertices\]\n}"
     1053            SendCmd "raw -defer {run \$PYMOL_SITE_PATH/rappture/box.py\n}"
     1054            SendCmd "raw -defer {draw_box(verts)\n}"
    10561055            set _cell 1
    10571056        }
     
    10631062    foreach model [array names _mlist] {
    10641063        if { $_mlist($model) == 1 } {
    1065             ServerCmd "disable -defer $model"
     1064            SendCmd "disable -defer $model"
    10661065            set _mlist($model) 0
    10671066            set changed 1
    10681067        } elseif { $_mlist($model) == 2 } {
    10691068            set _mlist($model) 1
    1070             ServerCmd "enable -defer $model"
     1069            SendCmd "enable -defer $model"
    10711070            set changed 1
    10721071        } elseif { $_mlist($model) == 3 } {
     
    10841083                set rep $_model($model-newrep)
    10851084                set transp $_model($model-newtransparency)
    1086                 ServerCmd "representation -defer -model $model $rep"
     1085                SendCmd "representation -defer -model $model $rep"
    10871086                set changed 1
    10881087                set _model($model-transparency) $_model($model-newtransparency)
     
    11031102        set _state(server) 1
    11041103        set _state(client) 1
    1105         ServerCmd "frame 1"
     1104        SendCmd "frame 1"
    11061105        set flush 1
    11071106    } elseif { ![info exists _imagecache($state,$_rocker(client))] } {
    11081107        set _state(server) $state
    11091108        set _state(client) $state
    1110         ServerCmd "frame $state"
     1109        SendCmd "frame $state"
    11111110        set flush 1
    11121111    } else {
     
    11201119        set w  [winfo width $itk_component(3dview)]
    11211120        set h  [winfo height $itk_component(3dview)]
    1122         ServerCmd "reset"
    1123         ServerCmd "screen $w $h"
    1124         ServerCmd "rotate $_view(mx) $_view(my) $_view(mz)"
    1125         ServerCmd "pan $_view(x) $_view(y)"
    1126         ServerCmd "zoom $_view(zoom)"
     1121        SendCmd "reset"
     1122        SendCmd "screen $w $h"
     1123        SendCmd "rotate $_view(mx) $_view(my) $_view(mz)"
     1124        SendCmd "pan $_view(x) $_view(y)"
     1125        SendCmd "zoom $_view(zoom)"
    11271126        debug "rebuild: rotate $_view(mx) $_view(my) $_view(mz)"
    11281127
    1129         ServerCmd "raw -defer {zoom complete=1}"
     1128        SendCmd "raw -defer {zoom complete=1}"
    11301129        set _reset 0
    11311130    }
     
    11511150        set readyForNextFrame 0;        # Don't advance to the next frame
    11521151                                        # until we get an image.
    1153         #ServerCmd "ppm";                 # Flush the results.
     1152        #SendCmd "ppm";                 # Flush the results.
    11541153    }
    11551154    blt::busy hold $itk_component(hull)
     
    11831182
    11841183itcl::body Rappture::MolvisViewer::DoResize { } {
    1185     ServerCmd "screen $_width $_height"
     1184    SendCmd "screen $_width $_height"
    11861185    $_image(plot) configure -width $_width -height $_height
    11871186    # Immediately invalidate cache, defer update until mapped
     
    12001199
    12011200itcl::body Rappture::MolvisViewer::DoRotate {} {
    1202     ServerCmd "rotate $_view(a) $_view(b) $_view(c)"
     1201    SendCmd "rotate $_view(a) $_view(b) $_view(c)"
    12031202    array unset _imagecache
    12041203    set _rotatePending 0
     
    12451244        set _view(y) [expr $_view(y) + $dy]
    12461245        array unset _imagecache
    1247         ServerCmd "pan $dx $dy"
     1246        SendCmd "pan $dx $dy"
    12481247        return
    12491248    }
     
    12601259        set _view(y) [expr $_view(y) + $dy]
    12611260        array unset _imagecache
    1262         ServerCmd "pan $dx $dy"
     1261        SendCmd "pan $dx $dy"
    12631262    }
    12641263    set _mevent(x) $x
     
    12811280        "in" {
    12821281            set _view(zoom) [expr $_view(zoom) + $factor]
    1283             ServerCmd "zoom $factor"
     1282            SendCmd "zoom $factor"
    12841283        }
    12851284        "out" {
    12861285            set _view(zoom) [expr $_view(zoom) - $factor]
    1287             ServerCmd "zoom -$factor"
     1286            SendCmd "zoom -$factor"
    12881287        }
    12891288        "reset" {
    12901289            set _view(zoom) 0
    1291             ServerCmd "reset"
     1290            SendCmd "reset"
    12921291        }
    12931292    }
     
    13321331        if { ![info exists _imagecache($_state(server),$_rocker(client))] } {
    13331332            set _rocker(server) $_rocker(client)
    1334             ServerCmd "rock $_rocker(client)"
     1333            SendCmd "rock $_rocker(client)"
    13351334        }
    13361335        UpdateState
     
    13651364        }
    13661365    }
    1367     ServerCmd "vmouse $vButton $vModifier $vState $x $y"
     1366    SendCmd "vmouse $vButton $vModifier $vState $x $y"
    13681367    set _mevent(time) $now
    13691368}
     
    14241423        set _view(my) [expr {$_view(my) + $my}]
    14251424        set _view(mz) [expr {$_view(mz) + $mz}]
    1426         #ServerCmd "rotate $mx $my $mz"
     1425        #SendCmd "rotate $mx $my $mz"
    14271426        EventuallyRotate $mx $my $mz
    14281427        debug "_vmmouse: rotate $_view(mx) $_view(my) $_view(mz)"
     
    15221521                }]
    15231522                EventuallyRotate $a $b $c
    1524                 #ServerCmd "rotate $a $b $c"
     1523                #SendCmd "rotate $a $b $c"
    15251524                debug "Rotate $x $y: rotate $_view(vx) $_view(vy) $_view(vz)"
    15261525                set _click(x) $x
     
    15811580    }
    15821581    if { [isconnected] } {
    1583         ServerCmd "representation -model $model $option"
     1582        SendCmd "representation -model $model $option"
    15841583        #$_dispatcher event -idle !rebuild
    15851584    }
     
    16221621            "Use perspective projection"
    16231622        set _settings($this-ortho) 1
    1624         ServerCmd "orthoscopic on"
     1623        SendCmd "orthoscopic on"
    16251624    } else {
    16261625        $itk_component(ortho) configure -image [Rappture::icon molvis-3dpers]
     
    16281627            "Use orthoscopic projection"
    16291628        set _settings($this-ortho) 0
    1630         ServerCmd "orthoscopic off"
     1629        SendCmd "orthoscopic off"
    16311630    }
    16321631}
     
    16621661            "Hide the cell."
    16631662        set _settings($this-showcell) 1
    1664         ServerCmd "raw {show everything,unitcell}"
     1663        SendCmd "raw {show everything,unitcell}"
    16651664    } else {
    16661665        Rappture::Tooltip::for $itk_component(ortho) \
    16671666            "Show the cell."
    16681667        set _settings($this-showcell) 0
    1669         ServerCmd "raw {hide everything,unitcell}"
     1668        SendCmd "raw {hide everything,unitcell}"
    16701669    }
    16711670}
     
    16901689        height  0
    16911690    }
    1692     ServerCmd "reset"
     1691    SendCmd "reset"
    16931692    DoResize
    1694     ServerCmd "rotate $_view(mx) $_view(my) $_view(mz)"
     1693    SendCmd "rotate $_view(mx) $_view(my) $_view(mz)"
    16951694    debug "ResetView: rotate $_view(mx) $_view(my) $_view(mz)"
    1696     ServerCmd "pan $_view(x) $_view(y)"
    1697     ServerCmd "zoom $_view(zoom)"
     1695    SendCmd "pan $_view(x) $_view(y)"
     1696    SendCmd "zoom $_view(zoom)"
    16981697}
    16991698
     
    17791778    focus $inner.cancel
    17801779
    1781     ServerCmd "print $token $width $height $bgcolor"
     1780    SendCmd "print $token $width $height $bgcolor"
    17821781
    17831782    $popup activate $widget below
     
    18431842    set _settings($this-spherescale) $radius
    18441843    if { $models == "all" } {
    1845         ServerCmd "spherescale -model all $radius"
     1844        SendCmd "spherescale -model all $radius"
    18461845        return
    18471846    }
    18481847    set overrideradius [expr $radius * 0.8]
    1849     ServerCmd "spherescale -model all $overrideradius"
     1848    SendCmd "spherescale -model all $overrideradius"
    18501849    foreach model $models {
    18511850        if { [info exists _active($model)] } {
    1852             ServerCmd "spherescale -model $model $radius"
     1851            SendCmd "spherescale -model $model $radius"
    18531852        }
    18541853    }
     
    18791878    set _settings($this-stickradius) $radius
    18801879    if { $models == "all" } {
    1881         ServerCmd "stickradius -model all $radius"
     1880        SendCmd "stickradius -model all $radius"
    18821881        return
    18831882    }
    18841883    set overrideradius [expr $radius * 0.8]
    1885     ServerCmd "stickradius -model all $overrideradius"
     1884    SendCmd "stickradius -model all $overrideradius"
    18861885    foreach model $models {
    18871886        if { [info exists _active($model)] } {
    1888             ServerCmd "stickradius -model $model $radius"
     1887            SendCmd "stickradius -model $model $radius"
    18891888        }
    18901889    }
     
    19181917    set models [array names _active]
    19191918    if { [llength $models] == 0 } {
    1920         ServerCmd "transparency -model all $transparency"
     1919        SendCmd "transparency -model all $transparency"
    19211920        return
    19221921    }
    19231922    set overridetransparency 0.60
    1924     ServerCmd "transparency -model all $overridetransparency"
     1923    SendCmd "transparency -model all $overridetransparency"
    19251924    foreach model $models {
    1926         ServerCmd "transparency -model $model $transparency"
     1925        SendCmd "transparency -model $model $transparency"
    19271926    }
    19281927}
     
    19481947    set _settings($this-showlabels) $showlabels
    19491948    if { $models == "all" } {
    1950         ServerCmd "label -model all $showlabels"
     1949        SendCmd "label -model all $showlabels"
    19511950        return
    19521951    }
    1953     ServerCmd "label -model all off"
     1952    SendCmd "label -model all off"
    19541953    if { $showlabels } {
    19551954        foreach model $models {
    19561955            if { [info exists _active($model)] } {
    1957                 ServerCmd "label -model $model $showlabels"
     1956                SendCmd "label -model $model $showlabels"
    19581957            }
    19591958        }
     
    19801979    set _settings($this-cartoontrace) $trace
    19811980    if { $models == "all" } {
    1982         ServerCmd "cartoontrace -model all $trace"
     1981        SendCmd "cartoontrace -model all $trace"
    19831982        return
    19841983    }
    1985     ServerCmd "cartoontrace -model all off"
     1984    SendCmd "cartoontrace -model all off"
    19861985    if { $trace } {
    19871986        foreach model $models {
    19881987            if { [info exists _active($model)] } {
    1989                 ServerCmd "cartoontrace -model $model $trace"
     1988                SendCmd "cartoontrace -model $model $trace"
    19901989            }
    19911990        }
Note: See TracChangeset for help on using the changeset viewer.