Ignore:
Timestamp:
Oct 22, 2010, 4:06:10 PM (14 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r1839 r1929  
    5858    private variable _download "";# snapshot for download
    5959}
    60                                                                                
     60                                                                               
    6161itk::usual MoleculeViewer {
    6262}
     
    7575    $_dispatcher register !fixsize
    7676    $_dispatcher dispatch $this !fixsize \
    77         "[itcl::code $this emblems fixPosition]; list"
     77        "[itcl::code $this emblems fixPosition]; list"
    7878
    7979    itk_option add hull.width hull.height
     
    103103
    104104    itk_component add controls {
    105         frame $itk_interior.cntls
     105        frame $itk_interior.cntls
    106106    } {
    107         usual
    108         rename -background -controlbackground controlBackground Background
     107        usual
     108        rename -background -controlbackground controlBackground Background
    109109    }
    110110    pack $itk_component(controls) -side right -fill y
    111111
    112112    itk_component add reset {
    113         button $itk_component(controls).reset \
    114             -borderwidth 1 -padx 1 -pady 1 \
    115             -bitmap [Rappture::icon reset] \
    116             -command [itcl::code $this _zoom reset]
     113        button $itk_component(controls).reset \
     114            -borderwidth 1 -padx 1 -pady 1 \
     115            -bitmap [Rappture::icon reset] \
     116            -command [itcl::code $this _zoom reset]
    117117    } {
    118         usual
    119         ignore -borderwidth
    120         rename -highlightbackground -controlbackground controlBackground Background
     118        usual
     119        ignore -borderwidth
     120        rename -highlightbackground -controlbackground controlBackground Background
    121121    }
    122122    pack $itk_component(reset) -padx 4 -pady 4
     
    124124
    125125    itk_component add zoomin {
    126         button $itk_component(controls).zin \
    127             -borderwidth 1 -padx 1 -pady 1 \
    128             -bitmap [Rappture::icon zoomin] \
    129             -command [itcl::code $this _zoom in]
     126        button $itk_component(controls).zin \
     127            -borderwidth 1 -padx 1 -pady 1 \
     128            -bitmap [Rappture::icon zoomin] \
     129            -command [itcl::code $this _zoom in]
    130130    } {
    131         usual
    132         ignore -borderwidth
    133         rename -highlightbackground -controlbackground controlBackground Background
     131        usual
     132        ignore -borderwidth
     133        rename -highlightbackground -controlbackground controlBackground Background
    134134    }
    135135    pack $itk_component(zoomin) -padx 4 -pady 4
     
    137137
    138138    itk_component add zoomout {
    139         button $itk_component(controls).zout \
    140             -borderwidth 1 -padx 1 -pady 1 \
    141             -bitmap [Rappture::icon zoomout] \
    142             -command [itcl::code $this _zoom out]
     139        button $itk_component(controls).zout \
     140            -borderwidth 1 -padx 1 -pady 1 \
     141            -bitmap [Rappture::icon zoomout] \
     142            -command [itcl::code $this _zoom out]
    143143    } {
    144         usual
    145         ignore -borderwidth
    146         rename -highlightbackground -controlbackground controlBackground Background
     144        usual
     145        ignore -borderwidth
     146        rename -highlightbackground -controlbackground controlBackground Background
    147147    }
    148148    pack $itk_component(zoomout) -padx 4 -pady 4
     
    150150
    151151    itk_component add labels {
    152         label $itk_component(controls).labels \
    153             -borderwidth 1 -padx 1 -pady 1 \
    154             -bitmap [Rappture::icon atoms]
     152        label $itk_component(controls).labels \
     153            -borderwidth 1 -padx 1 -pady 1 \
     154            -bitmap [Rappture::icon atoms]
    155155    } {
    156         usual
    157         ignore -borderwidth
    158         rename -highlightbackground -controlbackground controlBackground Background
     156        usual
     157        ignore -borderwidth
     158        rename -highlightbackground -controlbackground controlBackground Background
    159159    }
    160160    pack $itk_component(labels) -padx 4 -pady 8 -ipadx 1 -ipady 1
    161161    Rappture::Tooltip::for $itk_component(labels) "Show/hide the labels on atoms"
    162162    bind $itk_component(labels) <ButtonPress> \
    163         [itcl::code $this emblems toggle]
     163        [itcl::code $this emblems toggle]
    164164
    165165    #
     
    167167    #
    168168    itk_component add area {
    169         frame $itk_interior.area
     169        frame $itk_interior.area
    170170    }
    171171    pack $itk_component(area) -expand yes -fill both
    172172    bind $itk_component(area) <Configure> \
    173         [list $_dispatcher event -idle !fixsize]
     173        [list $_dispatcher event -idle !fixsize]
    174174
    175175    itk_component add renderer {
    176         vtkTkRenderWidget $itk_component(area).ren -rw $this-renWin
     176        vtkTkRenderWidget $itk_component(area).ren -rw $this-renWin
    177177    } {
    178178    }
     
    184184    blt::busy hold $itk_component(area) -cursor left_ptr
    185185    bind $itk_component(area)_Busy <ButtonPress> \
    186         [itcl::code $this _move click %x %y]
     186        [itcl::code $this _move click %x %y]
    187187    bind $itk_component(area)_Busy <B1-Motion> \
    188         [itcl::code $this _move drag %x %y]
     188        [itcl::code $this _move drag %x %y]
    189189    bind $itk_component(area)_Busy <ButtonRelease> \
    190         [itcl::code $this _move release %x %y]
     190        [itcl::code $this _move release %x %y]
    191191
    192192    emblems on
     
    220220itcl::body Rappture::MoleculeViewer::add {dataobj {settings ""}} {
    221221    array set params {
    222         -color auto
    223         -brightness 0
    224         -width 1
    225         -raise 0
    226         -linestyle solid
    227         -description ""
    228         -param ""
     222        -color auto
     223        -brightness 0
     224        -width 1
     225        -raise 0
     226        -linestyle solid
     227        -description ""
     228        -param ""
    229229    }
    230230    foreach {opt val} $settings {
    231         if {![info exists params($opt)]} {
    232             error "bad settings \"$opt\": should be [join [lsort [array names params]] {, }]"
    233         }
    234         set params($opt) $val
     231        if {![info exists params($opt)]} {
     232            error "bad settings \"$opt\": should be [join [lsort [array names params]] {, }]"
     233        }
     234        set params($opt) $val
    235235    }
    236236 
     
    238238
    239239    if {$pos < 0} {
    240         if {![Rappture::library isvalid $dataobj]} {
    241             error "bad value \"$dataobj\": should be Rappture::library object"
    242         }
     240        if {![Rappture::library isvalid $dataobj]} {
     241            error "bad value \"$dataobj\": should be Rappture::library object"
     242        }
    243243   
    244         set emblem [$dataobj get components.molecule.about.emblems]
    245         if {$emblem == "" || ![string is boolean $emblem] || !$emblem} {
    246             emblems off
    247         } else {
    248             emblems on
    249         }
    250 
    251         lappend _dlist $dataobj
    252         set _dobj2raise($dataobj) $params(-raise)
    253 
    254         $_dispatcher event -idle !redraw
     244        set emblem [$dataobj get components.molecule.about.emblems]
     245        if {$emblem == "" || ![string is boolean $emblem] || !$emblem} {
     246            emblems off
     247        } else {
     248            emblems on
     249        }
     250
     251        lappend _dlist $dataobj
     252        set _dobj2raise($dataobj) $params(-raise)
     253
     254        $_dispatcher event -idle !redraw
    255255    }
    256256}
     
    266266    set dlist $_dlist
    267267    foreach obj $dlist {
    268         if {[info exists _dobj2raise($obj)] && $_dobj2raise($obj)} {
    269             set i [lsearch -exact $dlist $obj]
    270             if {$i >= 0} {
    271                 set dlist [lreplace $dlist $i $i]
    272                 lappend dlist $obj
    273             }
    274         }
     268        if {[info exists _dobj2raise($obj)] && $_dobj2raise($obj)} {
     269            set i [lsearch -exact $dlist $obj]
     270            if {$i >= 0} {
     271                set dlist [lreplace $dlist $i $i]
     272                lappend dlist $obj
     273            }
     274        }
    275275    }
    276276    return $dlist
     
    285285itcl::body Rappture::MoleculeViewer::delete {args} {
    286286    if {[llength $args] == 0} {
    287         set args $_dlist
     287        set args $_dlist
    288288    }
    289289
     
    291291    set changed 0
    292292    foreach dataobj $args {
    293         set pos [lsearch -exact $_dlist $dataobj]
    294         if {$pos >= 0} {
    295             set _dlist [lreplace $_dlist $pos $pos]
    296             catch {unset _dobj2raise($dataobj)}
    297             set changed 1
    298         }
     293        set pos [lsearch -exact $_dlist $dataobj]
     294        if {$pos >= 0} {
     295            set _dlist [lreplace $_dlist $pos $pos]
     296            catch {unset _dobj2raise($dataobj)}
     297            set changed 1
     298        }
    299299    }
    300300
    301301    # if anything changed, then rebuild the plot
    302302    if {$changed} {
    303         $_dispatcher event -idle !redraw
     303        $_dispatcher event -idle !redraw
    304304    }
    305305}
     
    317317itcl::body Rappture::MoleculeViewer::download {option args} {
    318318    switch $option {
    319         coming {
    320             if {[catch {blt::winop snap $itk_component(area) $_download}]} {
    321                 $_download configure -width 1 -height 1
    322                 $_download put #000000
    323             }
    324         }
    325         controls {
    326             # no controls for this download yet
    327             return ""
    328         }
    329         now {
    330             # Get the image data (as base64) and decode it back to binary.
    331             # This is better than writing to temporary files.  When we switch
    332             # to the BLT picture image it won't be necessary to decode the
    333             # image data.
    334             set bytes [$_download data -format "jpeg -quality 100"]
    335             set bytes [Rappture::encoding::decode -as b64 $bytes]
    336             return [list .jpg $bytes]
    337         }
    338         default {
    339             error "bad option \"$option\": should be coming, controls, now"
    340         }
     319        coming {
     320            if {[catch {blt::winop snap $itk_component(area) $_download}]} {
     321                $_download configure -width 1 -height 1
     322                $_download put #000000
     323            }
     324        }
     325        controls {
     326            # no controls for this download yet
     327            return ""
     328        }
     329        now {
     330            # Get the image data (as base64) and decode it back to binary.
     331            # This is better than writing to temporary files.  When we switch
     332            # to the BLT picture image it won't be necessary to decode the
     333            # image data.
     334            set bytes [$_download data -format "jpeg -quality 100"]
     335            set bytes [Rappture::encoding::decode -as b64 $bytes]
     336            return [list .jpg $bytes]
     337        }
     338        default {
     339            error "bad option \"$option\": should be coming, controls, now"
     340        }
    341341    }
    342342}
     
    349349itcl::body Rappture::MoleculeViewer::_clear {} {
    350350    foreach a $_actors {
    351         $this-ren RemoveActor $a
    352         rename $a ""
     351        $this-ren RemoveActor $a
     352        rename $a ""
    353353    }
    354354    set _actors ""
     
    356356
    357357    foreach lim {xmin xmax ymin ymax zmin zmax} {
    358         set _limits($lim) ""
     358        set _limits($lim) ""
    359359    }
    360360
     
    376376    set dev [lindex [get] end]
    377377    if {"" != $dev} {
    378         set lib [Rappture::library standard]
    379 
    380         set counter 0
    381         foreach atom [$dev children -type atom components.molecule] {
    382             set symbol [$dev get components.molecule.$atom.symbol]
    383             set xyz [$dev get components.molecule.$atom.xyz]
    384             regsub {,} $xyz {} xyz
    385 
    386             # update overall limits for molecules along all axes
    387             foreach axis {x y z} val $xyz {
    388                 if {"" == $_limits(${axis}min)} {
    389                     set _limits(${axis}min) $val
    390                     set _limits(${axis}max) $val
    391                 } else {
    392                     if {$val < $_limits(${axis}min)} {
    393                         set _limits(${axis}min) $val
    394                     }
    395                     if {$val > $_limits(${axis}max)} {
    396                         set _limits(${axis}max) $val
    397                     }
    398                 }
    399             }
    400 
    401             # create an actor for each atom
    402             set aname $this-actor[incr counter]
    403             vtkActor $aname
    404             $aname SetMapper $this-map
    405             eval $aname SetPosition $xyz
    406             $this-ren AddActor $aname
    407 
    408             set sfac 0.7
    409             set scale [$lib get elements.($symbol).scale]
    410             if {$scale != ""} {
    411                 $aname SetScale [expr {$sfac*$scale}]
    412             }
    413             set color [$lib get elements.($symbol).color]
    414             if {$color != ""} {
    415                 eval [$aname GetProperty] SetColor [_color2rgb $color]
    416             }
    417 
    418             lappend _actors $aname
    419 
    420             # create a label for each atom
    421             set lname $this-label$counter
    422             vtkTextActor $lname
    423             $lname SetInput "$counter $symbol"
    424             $lname ScaledTextOff
    425 
    426             set tprop [$lname GetTextProperty]
    427             $tprop SetJustificationToCentered
    428             $tprop SetVerticalJustificationToCentered
    429             $tprop ShadowOn
    430             $tprop SetColor 1 1 1
    431 
    432             set _label2atom($lname) $aname
    433             lappend _actors $lname
    434         }
    435         if {[$itk_component(labels) cget -relief] == "sunken"} {
    436             emblems on
    437         }
    438         _zoom reset
     378        set lib [Rappture::library standard]
     379
     380        set counter 0
     381        foreach atom [$dev children -type atom components.molecule] {
     382            set symbol [$dev get components.molecule.$atom.symbol]
     383            set xyz [$dev get components.molecule.$atom.xyz]
     384            regsub {,} $xyz {} xyz
     385
     386            # update overall limits for molecules along all axes
     387            foreach axis {x y z} val $xyz {
     388                if {"" == $_limits(${axis}min)} {
     389                    set _limits(${axis}min) $val
     390                    set _limits(${axis}max) $val
     391                } else {
     392                    if {$val < $_limits(${axis}min)} {
     393                        set _limits(${axis}min) $val
     394                    }
     395                    if {$val > $_limits(${axis}max)} {
     396                        set _limits(${axis}max) $val
     397                    }
     398                }
     399            }
     400
     401            # create an actor for each atom
     402            set aname $this-actor[incr counter]
     403            vtkActor $aname
     404            $aname SetMapper $this-map
     405            eval $aname SetPosition $xyz
     406            $this-ren AddActor $aname
     407
     408            set sfac 0.7
     409            set scale [$lib get elements.($symbol).scale]
     410            if {$scale != ""} {
     411                $aname SetScale [expr {$sfac*$scale}]
     412            }
     413            set color [$lib get elements.($symbol).color]
     414            if {$color != ""} {
     415                eval [$aname GetProperty] SetColor [_color2rgb $color]
     416            }
     417
     418            lappend _actors $aname
     419
     420            # create a label for each atom
     421            set lname $this-label$counter
     422            vtkTextActor $lname
     423            $lname SetInput "$counter $symbol"
     424            $lname ScaledTextOff
     425
     426            set tprop [$lname GetTextProperty]
     427            $tprop SetJustificationToCentered
     428            $tprop SetVerticalJustificationToCentered
     429            $tprop ShadowOn
     430            $tprop SetColor 1 1 1
     431
     432            set _label2atom($lname) $aname
     433            lappend _actors $lname
     434        }
     435        if {[$itk_component(labels) cget -relief] == "sunken"} {
     436            emblems on
     437        }
     438        _zoom reset
    439439    }
    440440    $this-ren ResetCamera
     
    454454itcl::body Rappture::MoleculeViewer::_zoom {option} {
    455455    switch -- $option {
    456         in {
    457             [$this-ren GetActiveCamera] Zoom 1.25
    458         }
    459         out {
    460             [$this-ren GetActiveCamera] Zoom 0.8
    461         }
    462         reset {
    463             $this-ren ResetCamera
    464             [$this-ren GetActiveCamera] SetViewAngle 30
    465             _3dView 45 45 0
    466         }
     456        in {
     457            [$this-ren GetActiveCamera] Zoom 1.25
     458        }
     459        out {
     460            [$this-ren GetActiveCamera] Zoom 0.8
     461        }
     462        reset {
     463            $this-ren ResetCamera
     464            [$this-ren GetActiveCamera] SetViewAngle 30
     465            _3dView 45 45 0
     466        }
    467467    }
    468468    $_dispatcher event -later !fixsize
     
    480480itcl::body Rappture::MoleculeViewer::_move {option x y} {
    481481    switch -- $option {
    482         click {
    483             blt::busy configure $itk_component(area) -cursor fleur
    484             set _click(x) $x
    485             set _click(y) $y
    486             set _click(theta) $_view(theta)
    487             set _click(phi) $_view(phi)
    488             set _click(psi) $_view(psi)
    489         }
    490         drag {
    491             if {[array size _click] == 0} {
    492                 _move click $x $y
    493             } else {
    494                 set w [winfo width $itk_component(renderer)]
    495                 set h [winfo height $itk_component(renderer)]
    496                 if {$w <= 0 || $h <= 0} {
    497                     return
    498                 }
    499 
    500                 if {[catch {
    501                     # this fails sometimes for no apparent reason
    502                     set dx [expr {double($x-$_click(x))/$w}]
    503                     set dy [expr {double($y-$_click(y))/$h}]
    504                 }]} {
    505                     return
    506                 }
    507 
    508                 #
    509                 # Rotate the camera in 3D
    510                 #
    511                 if {$_view(psi) > 90 || $_view(psi) < -90} {
    512                     # when psi is flipped around, theta moves backwards
    513                     set dy [expr {-$dy}]
    514                 }
    515                 set theta [expr {$_view(theta) - $dy*180}]
    516                 while {$theta < 0} { set theta [expr {$theta+180}] }
    517                 while {$theta > 180} { set theta [expr {$theta-180}] }
    518                 #if {$theta < 2} { set theta 2 }
    519                 #if {$theta > 178} { set theta 178 }
    520 
    521                 if {$theta > 45 && $theta < 135} {
    522                     set phi [expr {$_view(phi) - $dx*360}]
    523                     while {$phi < 0} { set phi [expr {$phi+360}] }
    524                     while {$phi > 360} { set phi [expr {$phi-360}] }
    525                     set psi $_view(psi)
    526                 } else {
    527                     set phi $_view(phi)
    528                     set psi [expr {$_view(psi) - $dx*360}]
    529                     while {$psi < -180} { set psi [expr {$psi+360}] }
    530                     while {$psi > 180} { set psi [expr {$psi-360}] }
    531                 }
    532 
    533                 _3dView $theta $phi $psi
    534                 emblems fixPosition
    535                 $_dispatcher event -idle !render
    536 
    537                 set _click(x) $x
    538                 set _click(y) $y
    539             }
    540         }
    541         release {
    542             _move drag $x $y
    543             blt::busy configure $itk_component(area) -cursor left_ptr
    544             catch {unset _click}
    545         }
    546         default {
    547             error "bad option \"$option\": should be click, drag, release"
    548         }
     482        click {
     483            blt::busy configure $itk_component(area) -cursor fleur
     484            set _click(x) $x
     485            set _click(y) $y
     486            set _click(theta) $_view(theta)
     487            set _click(phi) $_view(phi)
     488            set _click(psi) $_view(psi)
     489        }
     490        drag {
     491            if {[array size _click] == 0} {
     492                _move click $x $y
     493            } else {
     494                set w [winfo width $itk_component(renderer)]
     495                set h [winfo height $itk_component(renderer)]
     496                if {$w <= 0 || $h <= 0} {
     497                    return
     498                }
     499
     500                if {[catch {
     501                    # this fails sometimes for no apparent reason
     502                    set dx [expr {double($x-$_click(x))/$w}]
     503                    set dy [expr {double($y-$_click(y))/$h}]
     504                }]} {
     505                    return
     506                }
     507
     508                #
     509                # Rotate the camera in 3D
     510                #
     511                if {$_view(psi) > 90 || $_view(psi) < -90} {
     512                    # when psi is flipped around, theta moves backwards
     513                    set dy [expr {-$dy}]
     514                }
     515                set theta [expr {$_view(theta) - $dy*180}]
     516                while {$theta < 0} { set theta [expr {$theta+180}] }
     517                while {$theta > 180} { set theta [expr {$theta-180}] }
     518                #if {$theta < 2} { set theta 2 }
     519                #if {$theta > 178} { set theta 178 }
     520
     521                if {$theta > 45 && $theta < 135} {
     522                    set phi [expr {$_view(phi) - $dx*360}]
     523                    while {$phi < 0} { set phi [expr {$phi+360}] }
     524                    while {$phi > 360} { set phi [expr {$phi-360}] }
     525                    set psi $_view(psi)
     526                } else {
     527                    set phi $_view(phi)
     528                    set psi [expr {$_view(psi) - $dx*360}]
     529                    while {$psi < -180} { set psi [expr {$psi+360}] }
     530                    while {$psi > 180} { set psi [expr {$psi-360}] }
     531                }
     532
     533                _3dView $theta $phi $psi
     534                emblems fixPosition
     535                $_dispatcher event -idle !render
     536
     537                set _click(x) $x
     538                set _click(y) $y
     539            }
     540        }
     541        release {
     542            _move drag $x $y
     543            blt::busy configure $itk_component(area) -cursor left_ptr
     544            catch {unset _click}
     545        }
     546        default {
     547            error "bad option \"$option\": should be click, drag, release"
     548        }
    549549    }
    550550}
     
    566566    set blank 0
    567567    foreach lim {xmin xmax ymin ymax zmin zmax} {
    568         if {"" == $_limits($lim)} {
    569             set blank 1
    570             break
    571         }
     568        if {"" == $_limits($lim)} {
     569            set blank 1
     570            break
     571        }
    572572    }
    573573    if {$blank} {
    574         set xm 0
    575         set ym 0
    576         set zm 0
     574        set xm 0
     575        set ym 0
     576        set zm 0
    577577    } else {
    578         set xm [expr {0.5*($_limits(xmax)+$_limits(xmin))}]
    579         set ym [expr {0.5*($_limits(ymax)+$_limits(ymin))}]
    580         set zm [expr {0.5*($_limits(zmax)+$_limits(zmin))}]
     578        set xm [expr {0.5*($_limits(xmax)+$_limits(xmin))}]
     579        set ym [expr {0.5*($_limits(ymax)+$_limits(ymin))}]
     580        set zm [expr {0.5*($_limits(zmax)+$_limits(zmin))}]
    581581    }
    582582
     
    613613itcl::body Rappture::MoleculeViewer::emblems {option} {
    614614    switch -- $option {
    615         on {
    616             set state 1
    617         }
    618         off {
    619             set state 0
    620         }
    621         toggle {
    622             if {[$itk_component(labels) cget -relief] == "sunken"} {
    623                 set state 0
    624             } else {
    625                 set state 1
    626             }
    627         }
    628         fixPosition {
    629             foreach lname [array names _label2atom] {
    630                 set aname $_label2atom($lname)
    631                 set xyz [$aname GetPosition]
    632                 eval $this-xyzconv SetValue $xyz
    633                 set xy [$this-xyzconv GetComputedViewportValue $this-ren]
    634                 eval $lname SetDisplayPosition $xy
    635             }
    636             return
    637         }
    638         default {
    639             error "bad option \"$option\": should be on, off, toggle, fixPosition"
    640         }
     615        on {
     616            set state 1
     617        }
     618        off {
     619            set state 0
     620        }
     621        toggle {
     622            if {[$itk_component(labels) cget -relief] == "sunken"} {
     623                set state 0
     624            } else {
     625                set state 1
     626            }
     627        }
     628        fixPosition {
     629            foreach lname [array names _label2atom] {
     630                set aname $_label2atom($lname)
     631                set xyz [$aname GetPosition]
     632                eval $this-xyzconv SetValue $xyz
     633                set xy [$this-xyzconv GetComputedViewportValue $this-ren]
     634                eval $lname SetDisplayPosition $xy
     635            }
     636            return
     637        }
     638        default {
     639            error "bad option \"$option\": should be on, off, toggle, fixPosition"
     640        }
    641641    }
    642642
    643643    if {$state} {
    644         $itk_component(labels) configure -relief sunken
    645         foreach lname [array names _label2atom] {
    646             catch {$this-ren AddActor2D $lname}
    647         }
    648         emblems fixPosition
     644        $itk_component(labels) configure -relief sunken
     645        foreach lname [array names _label2atom] {
     646            catch {$this-ren AddActor2D $lname}
     647        }
     648        emblems fixPosition
    649649    } else {
    650         $itk_component(labels) configure -relief raised
    651         foreach lname [array names _label2atom] {
    652             catch {$this-ren RemoveActor $lname}
    653         }
     650        $itk_component(labels) configure -relief raised
     651        foreach lname [array names _label2atom] {
     652            catch {$this-ren RemoveActor $lname}
     653        }
    654654    }
    655655    $_dispatcher event -idle !render
     
    683683itcl::configbody Rappture::MoleculeViewer::device {
    684684    if {"" != $itk_option(-device)
    685           && ![Rappture::library isvalid $itk_option(-device)]} {
    686         error "bad value \"$itk_option(-device)\": should be Rappture::library object"
     685          && ![Rappture::library isvalid $itk_option(-device)]} {
     686        error "bad value \"$itk_option(-device)\": should be Rappture::library object"
    687687    }
    688688    delete
    689689
    690690    if {"" != $itk_option(-device)} {
    691         add $itk_option(-device)
    692         set state [$itk_option(-device) get components.molecule.about.emblems]
    693         if {$state == "" || ![string is boolean $state] || !$state} {
    694             emblems off
    695         } else {
    696             emblems on
    697         }
     691        add $itk_option(-device)
     692        set state [$itk_option(-device) get components.molecule.about.emblems]
     693        if {$state == "" || ![string is boolean $state] || !$state} {
     694            emblems off
     695        } else {
     696            emblems on
     697        }
    698698    }
    699699    $_dispatcher event -idle !redraw
Note: See TracChangeset for help on using the changeset viewer.