- Timestamp:
- Jul 17, 2009 2:50:11 PM (15 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/barresult.tcl
r1549 r1550 1 1 2 # ---------------------------------------------------------------------- 2 3 # COMPONENT: barresult - X/Y plot in a ResultSet … … 83 84 public method delete {args} 84 85 public method scale {args} 85 public method parameters {title args} { # do nothing } 86 public method parameters {title args} { 87 # do nothing 88 } 86 89 public method download {option args} 87 90 … … 96 99 protected method _enterMarker { g name x y text } 97 100 protected method _leaveMarker { g name } 101 private method _formatTickLabel { w value } 98 102 99 103 private variable _dispatcher "" ;# dispatcher for !events … … 116 120 private variable cur_ "" 117 121 private variable initialized_ 0 122 private variable _tickLabels 118 123 } 119 124 … … 164 169 blt::barchart $f.plot \ 165 170 -highlightthickness 0 -plotpadx 0 -plotpady 0 \ 166 - rightmargin 10171 -barmode aligned -rightmargin 1 167 172 } { 168 173 keep -background -foreground -cursor -font … … 170 175 pack $itk_component(plot) -expand yes -fill both 171 176 172 $itk_component(plot) pen configure activeLine \ 173 -symbol square -pixels 3 -linewidth 2 \ 174 -outline black -fill red -color black 175 176 # 177 $itk_component(plot) pen configure activeBar \ 178 -borderwidth 2 -foreground black -background red 179 177 180 # Add bindings so you can mouse over points to see values: 178 #179 181 bind $itk_component(plot) <Motion> \ 180 182 [itcl::code $this _hilite at %x %y] … … 182 184 [itcl::code $this _hilite off %x %y] 183 185 184 #185 186 # Add support for editing axes: 186 #187 187 Rappture::Balloon $itk_component(hull).axes -title "Axis Options" 188 188 set inner [$itk_component(hull).axes component inner] … … 281 281 -brightness 0 282 282 -width 1 283 -type " line"283 -type "bar" 284 284 -raise 0 285 285 -linestyle solid … … 292 292 } 293 293 set params($opt) $val 294 }295 296 # if type is set to "scatter", then override the width297 if {"scatter" == $params(-type)} {298 set params(-width) 0299 294 } 300 295 … … 618 613 eval $g element delete [$g element names] 619 614 foreach axis [$g axis names] { 620 $g axis configure $axis -hide yes -checklimits no 615 $g axis configure $axis -hide yes -checklimits no -loose yes 621 616 } 622 617 # Presumably you want at least an X-axis and Y-axis displayed. 623 618 $g xaxis configure -hide no 624 619 $g yaxis configure -hide no 625 catch {unset _label2axis}620 array unset _label2axis 626 621 627 622 # … … 737 732 set elem "elem[incr count]" 738 733 set _elem2curve($elem) $xydata 739 740 $g element create $elem -x $xv -y $yv \ 741 -symbol $sym -pixels $pixels -linewidth $lwidth -label $label \ 742 -color $color -dashes $dashes \ 743 -mapx $mapx -mapy $mapy 744 } 734 set labels [$xydata hints xticks] 735 if { $labels != "" } { 736 $g axis configure $mapx \ 737 -command [itcl::code $this _formatTickLabel] \ 738 -minorticks 0 739 set _tickLabels $labels 740 } 741 $g element create $elem -x $xv -y $yv \ 742 -borderwidth $lwidth -label $label \ 743 -background $color -foreground $color -mapx $mapx -mapy $mapy 744 } 745 745 } 746 746 … … 805 805 itcl::body Rappture::BarResult::_resetLimits {} { 806 806 set g $itk_component(plot) 807 foreach axis [$g axis names] { 808 $g axis configure $axis -min "" -max "" 809 } 810 return 807 811 808 812 # … … 990 994 Rappture::Tooltip::tooltip cancel 991 995 } 996 set bg [$g element cget $elem -background] 997 set fg [$g element cget $elem -background] 998 foreach {h s v} [Rappture::color::RGBtoHSV $fg] break 999 if { $v > 0.2 } { 1000 set v [expr $v - 0.2] 1001 } 1002 set fg [Rappture::color::HSVtoRGB $h $s $v] 1003 $g pen configure activeBar -background $bg -foreground $fg 992 1004 $g element activate $elem 993 1005 set _hilite(elem) $elem … … 1475 1487 itcl::body Rappture::BarResult::_getLineMarkerOptions {style} { 1476 1488 array set lineOptions { 1477 "-color" "- outline"1489 "-color" "-color" 1478 1490 "-dashes" "-dashes" 1479 "-linecolor" "- outline"1480 "-linewidth" "- linewidth"1491 "-linecolor" "-foreground" 1492 "-linewidth" "-borderwidth" 1481 1493 } 1482 1494 set options {} … … 1590 1602 } 1591 1603 } 1604 1605 itcl::body Rappture::BarResult::_formatTickLabel { w value } { 1606 # Determine the element name from the value 1607 1608 set index [expr round($value)] 1609 if { $index != $value } { 1610 return $value 1611 } 1612 return [lindex $_tickLabels [expr $index - 1]] 1613 if { $label == "" } { 1614 return $value 1615 } 1616 return $label 1617 } -
trunk/gui/scripts/curve.tcl
r1549 r1550 220 220 yticks yaxis.ticklabels 221 221 yunits yaxis.units 222 bars xaxis.bars223 222 } { 224 223 set str [$_curve get $path] -
trunk/gui/scripts/histogram.tcl
r1342 r1550 1 1 2 2 # ---------------------------------------------------------------------- 3 3 # COMPONENT: histogram - extracts data from an XML description of a field -
trunk/gui/scripts/molvisviewer.tcl
r1547 r1550 74 74 public method ResetView {} 75 75 public method add {dataobj {options ""}} 76 public method atomscale {option {models "all"} }77 public method bondthickness {option {models "all"} }76 public method spherescale {option {models "all"} } 77 public method stickradius {option {models "all"} } 78 78 public method delete {args} 79 79 public method download {option args} … … 81 81 public method isconnected {} 82 82 public method labels {option {model "all"}} 83 public method cartoon {option {model "all"}} 84 public method cartoontrace {option {model "all"}} 83 85 public method opacity {option {models "all"} } 84 86 public method parameters {title args} { … … 196 198 # Setup default settings for widget. 197 199 array set _settings [subst { 200 $this-spherescale 0.25 201 $this-stickradius 0.14 202 $this-cartoon no 203 $this-cartoontrace no 198 204 $this-model ballnstick 199 205 $this-modelimg [Rappture::icon ballnstick] 206 $this-opacity 1.0 207 $this-ortho no 208 $this-rock no 209 $this-showlabels no 200 210 $this-showlabels-initialized no 201 $this-showlabels no202 $this-rock no203 $this-ortho no204 $this-atomscale 0.25205 $this-bondthickness 0.14206 $this-opacity 1.0207 211 }] 208 212 … … 398 402 $inner configure -borderwidth 4 399 403 400 label $inner.drawinglabel -text "Drawing Method" -font "Arial 9 bold" 404 label $inner.drawinglabel -text "Molecule Reprsentation" \ 405 -font "Arial 9 bold" 401 406 402 407 label $inner.pict -image $_settings($this-modelimg) 408 403 409 radiobutton $inner.bstick -text "balls and sticks" \ 404 410 -command [itcl::code $this representation ballnstick all] \ 405 411 -variable Rappture::MolvisViewer::_settings($this-model) \ 406 412 -value ballnstick -font "Arial 9" -pady 0 413 Rappture::Tooltip::for $inner.bstick \ 414 "Display atoms (balls) and connections (sticks) " 415 407 416 radiobutton $inner.spheres -text "spheres" \ 408 417 -command [itcl::code $this representation spheres all] \ 409 418 -variable Rappture::MolvisViewer::_settings($this-model) \ 410 419 -value spheres -font "Arial 9" -pady 0 420 Rappture::Tooltip::for $inner.spheres \ 421 "Display atoms as spheres. Do not display bonds." 422 423 radiobutton $inner.sticks -text "sticks" \ 424 -command [itcl::code $this representation sticks all] \ 425 -variable Rappture::MolvisViewer::_settings($this-model) \ 426 -value sticks -font "Arial 9" -pady 0 427 Rappture::Tooltip::for $inner.sticks \ 428 "Display bonds as sticks. Do not display atoms." 429 411 430 radiobutton $inner.lines -text "lines" \ 412 431 -command [itcl::code $this representation lines all] \ 413 432 -variable Rappture::MolvisViewer::_settings($this-model) \ 414 433 -value lines -font "Arial 9" -pady 0 415 416 scale $inner.atomscale -width 10 -font "Arial 9 bold" \ 417 -from 0.1 -to 2.0 -resolution 0.05 -label "Atom Scale" \ 434 Rappture::Tooltip::for $inner.lines \ 435 "Display bonds as lines. Do not display atoms." 436 437 scale $inner.spherescale -width 10 -font "Arial 9 bold" \ 438 -from 0.1 -to 2.0 -resolution 0.05 -label "Sphere Scale" \ 418 439 -showvalue true -orient horizontal \ 419 -command [itcl::code $this atomscale] \ 420 -variable Rappture::MolvisViewer::_settings($this-atomscale) 421 $inner.atomscale set $_settings($this-atomscale) 422 423 scale $inner.bondthickness -width 10 -font "Arial 9 bold" \ 424 -from 0.1 -to 1.0 -resolution 0.025 -label "Bond Thickness" \ 440 -command [itcl::code $this spherescale] \ 441 -variable Rappture::MolvisViewer::_settings($this-spherescale) 442 $inner.spherescale set $_settings($this-spherescale) 443 Rappture::Tooltip::for $inner.spherescale \ 444 "Adjust scale of atoms (spheres or balls). 1.0 is the full VDW radius." 445 446 scale $inner.stickradius -width 10 -font "Arial 9 bold" \ 447 -from 0.1 -to 1.0 -resolution 0.025 -label "Stick Radius" \ 425 448 -showvalue true -orient horizontal \ 426 -command [itcl::code $this bondthickness] \ 427 -variable Rappture::MolvisViewer::_settings($this-bondthickness) 428 $inner.bondthickness set $_settings($this-bondthickness) 449 -command [itcl::code $this stickradius] \ 450 -variable Rappture::MolvisViewer::_settings($this-stickradius) 451 Rappture::Tooltip::for $inner.stickradius \ 452 "Adjust scale of bonds (sticks)." 453 $inner.stickradius set $_settings($this-stickradius) 429 454 430 455 checkbutton $inner.labels -text "Show labels on atoms" \ … … 432 457 -variable [itcl::scope _settings($this-showlabels)] \ 433 458 -font "Arial 9 bold" 459 Rappture::Tooltip::for $inner.labels \ 460 "Display atom symbol and serial number." 461 434 462 checkbutton $inner.rock -text "Rock model back and forth" \ 435 463 -command [itcl::code $this rock toggle] \ 436 464 -variable Rappture::MolvisViewer::_settings($this-rock) \ 437 465 -font "Arial 9 bold" 466 Rappture::Tooltip::for $inner.rock \ 467 "Rotate the object back and forth around the y-axis." 468 438 469 checkbutton $inner.ortho -text "Orthoscopic projection" \ 439 470 -command [itcl::code $this projection update] \ 440 471 -variable Rappture::MolvisViewer::_settings($this-ortho) \ 441 472 -font "Arial 9 bold" 473 Rappture::Tooltip::for $inner.ortho \ 474 "Toggle between orthoscopic/perspective projection modes." 475 476 checkbutton $inner.cartoon -text "Cartoon" \ 477 -command [itcl::code $this cartoon update] \ 478 -variable [itcl::scope _settings($this-cartoon)] \ 479 -font "Arial 9 bold" 480 Rappture::Tooltip::for $inner.cartoon \ 481 "Set cartoon representation of bonds (sticks)." 482 483 checkbutton $inner.cartoontrace -text "Cartoon Trace" \ 484 -command [itcl::code $this cartoontrace update] \ 485 -variable [itcl::scope _settings($this-cartoontrace)] \ 486 -font "Arial 9 bold" 487 Rappture::Tooltip::for $inner.cartoontrace \ 488 "Set cartoon representation of bonds (sticks)." 442 489 443 490 label $inner.spacer 444 491 blt::table $inner \ 445 492 0,0 $inner.drawinglabel -anchor w -columnspan 4 \ 446 1,1 $inner.pict -anchor w -rowspan 3 \ 447 1,2 $inner.spheres -anchor w -columnspan 2 \ 448 2,2 $inner.lines -anchor w -columnspan 2 \ 449 3,2 $inner.bstick -anchor w -columnspan 2 \ 450 4,0 $inner.labels -anchor w -columnspan 4 -pady {6 0} \ 451 5,0 $inner.rock -anchor w -columnspan 4 -pady {6 0} \ 452 6,0 $inner.ortho -anchor w -columnspan 4 -pady {6 0} \ 453 8,1 $inner.atomscale -fill x -columnspan 4 -pady {6 0} \ 454 10,1 $inner.bondthickness -fill x -columnspan 4 -pady {6 0} 493 1,1 $inner.pict -anchor w -rowspan 4 \ 494 1,2 $inner.bstick -anchor w -columnspan 2 \ 495 2,2 $inner.spheres -anchor w -columnspan 2 \ 496 3,2 $inner.sticks -anchor w -columnspan 2 \ 497 4,2 $inner.lines -anchor w -columnspan 2 \ 498 5,0 $inner.labels -anchor w -columnspan 4 -pady {6 0} \ 499 6,0 $inner.rock -anchor w -columnspan 4 -pady {6 0} \ 500 7,0 $inner.ortho -anchor w -columnspan 4 -pady {6 0} \ 501 8,1 $inner.spherescale -fill x -columnspan 4 -pady {6 0} \ 502 10,1 $inner.stickradius -fill x -columnspan 4 -pady {6 0} \ 503 12,0 $inner.cartoon -anchor w -columnspan 4 -pady {6 0} \ 504 13,0 $inner.cartoontrace -anchor w -columnspan 4 -pady {6 0} \ 455 505 456 506 blt::table configure $inner c0 -resize expand -width 2 … … 458 508 blt::table configure $inner c3 -resize expand 459 509 blt::table configure $inner r* -resize none 460 blt::table configure $inner r1 1-resize expand510 blt::table configure $inner r14 -resize expand 461 511 } 462 512 … … 800 850 set rep $_model($model-newrepresentation) 801 851 set transp $_model($model-newtransparency) 802 SendCmd " $_model($model-newrepresentation) -defer -model $model"852 SendCmd "representation -defer -model $model $rep" 803 853 if { $_model($model-newtransparency) == "ghost" } { 804 854 SendCmd "deactivate -defer -model $model" … … 846 896 847 897 projection update 848 atomscale update849 bondthickness update898 spherescale update 899 stickradius update 850 900 labels update 901 cartoon update 902 cartoontrace update 851 903 representation update 852 904 opacity update … … 1205 1257 1206 1258 # ---------------------------------------------------------------------- 1207 # USAGE: representation spheres 1208 # USAGE: representation ballnstick 1209 # USAGE: representation lines 1259 # USAGE: representation spheres|ballnstick|lines|sticks 1210 1260 # 1211 1261 # Used internally to change the molecular representation used to render … … 1219 1269 set option $_settings($this-model) 1220 1270 } 1221 set _settings($this-modelimg) [Rappture::icon $option] 1271 if { $option == "sticks" } { 1272 set _settings($this-modelimg) [Rappture::icon lines] 1273 } else { 1274 set _settings($this-modelimg) [Rappture::icon $option] 1275 } 1222 1276 set inner [$itk_component(main) panel "View Settings"] 1223 1277 $inner.pict configure -image $_settings($this-modelimg) … … 1244 1298 } 1245 1299 if { [isconnected] } { 1246 SendCmd " $option -model $model"1300 SendCmd "representation -model $model $option" 1247 1301 #$_dispatcher event -idle !rebuild 1248 1302 } … … 1536 1590 1537 1591 # ---------------------------------------------------------------------- 1538 # USAGE: atomscale radius ?model?1539 # atomscale update ?model?1592 # USAGE: spherescale radius ?model? 1593 # spherescale update ?model? 1540 1594 # 1541 1595 # Used internally to change the molecular atom scale used to render … … 1546 1600 # ---------------------------------------------------------------------- 1547 1601 1548 itcl::body Rappture::MolvisViewer:: atomscale { option {models "all"} } {1602 itcl::body Rappture::MolvisViewer::spherescale { option {models "all"} } { 1549 1603 if { $option == "update" } { 1550 set radius $_settings($this- atomscale)1604 set radius $_settings($this-spherescale) 1551 1605 } elseif { [string is double $option] } { 1552 1606 set radius $option … … 1557 1611 error "bad option \"$option\"" 1558 1612 } 1559 set _settings($this- atomscale) $radius1613 set _settings($this-spherescale) $radius 1560 1614 if { $models == "all" } { 1561 1615 set models [array names _mlist] … … 1564 1618 foreach model $models { 1565 1619 if { [info exists _active($model)] } { 1566 SendCmd " atomscale -model $model $radius"1620 SendCmd "spherescale -model $model $radius" 1567 1621 } else { 1568 SendCmd " atomscale -model $model $overrideradius"1569 } 1570 } 1571 } 1572 1573 # ---------------------------------------------------------------------- 1574 # USAGE: bondthickness thickness ?models?1575 # bondthickness update ?models?1576 # 1577 # Used internally to change the molecular bond thickness used to render1622 SendCmd "spherescale -model $model $overrideradius" 1623 } 1624 } 1625 } 1626 1627 # ---------------------------------------------------------------------- 1628 # USAGE: stickradius radius ?models? 1629 # stickradius update ?models? 1630 # 1631 # Used internally to change the stick radius used to render 1578 1632 # our scene. 1579 1633 # 1580 # Note: Only sets the specified thickness for active models. If the model1634 # Note: Only sets the specified radius for active models. If the model 1581 1635 # is inactive, then it overridden with the value "0.25". 1582 1636 # ---------------------------------------------------------------------- 1583 1637 1584 itcl::body Rappture::MolvisViewer:: bondthickness { option {models "all"} } {1638 itcl::body Rappture::MolvisViewer::stickradius { option {models "all"} } { 1585 1639 if { $option == "update" } { 1586 set thickness $_settings($this-bondthickness)1640 set radius $_settings($this-stickradius) 1587 1641 } elseif { [string is double $option] } { 1588 set thickness $option1589 if { ($ thickness < 0.1) || ($thickness > 2.0) } {1590 error "bad bind thickness \"$thickness\""1642 set radius $option 1643 if { ($radius < 0.1) || ($radius > 2.0) } { 1644 error "bad stick radius \"$radius\"" 1591 1645 } 1592 1646 } else { 1593 1647 error "bad option \"$option\"" 1594 1648 } 1595 set _settings($this- bondthickness) $thickness1649 set _settings($this-stickradius) $radius 1596 1650 if { $models == "all" } { 1597 1651 set models [array names _mlist] 1598 1652 } 1599 set override thickness [expr $thickness * 0.8]1653 set overrideradius [expr $radius * 0.8] 1600 1654 foreach model $models { 1601 1655 if { [info exists _active($model)] } { 1602 SendCmd " bondthickness -model $model $thickness"1656 SendCmd "stickradius -model $model $radius" 1603 1657 } else { 1604 SendCmd " bondthickness -model $model $overridethickness"1658 SendCmd "stickradius -model $model $overrideradius" 1605 1659 } 1606 1660 } … … 1611 1665 # opacity update ?models? 1612 1666 # 1613 # Used internally to change the molecular bond thicknessused to render1667 # Used internally to change the opacity (transparency) used to render 1614 1668 # our scene. 1615 1669 # 1616 # Note: Only sets the specified t hicknessfor active models. If the model1670 # Note: Only sets the specified transparency for active models. If the model 1617 1671 # is inactive, then it overridden with the value "0.75". 1618 1672 # ---------------------------------------------------------------------- … … 1673 1727 } 1674 1728 } 1729 1730 # ---------------------------------------------------------------------- 1731 # USAGE: cartoon on|off|toggle 1732 # USAGE: cartoon update 1733 # 1734 # Used internally to turn labels associated with atoms on/off, and to 1735 # update the positions of the labels so they sit on top of each atom. 1736 # ---------------------------------------------------------------------- 1737 itcl::body Rappture::MolvisViewer::cartoon {option {models "all"}} { 1738 set cartoon $_settings($this-cartoon) 1739 if { $option == "update" } { 1740 set cartoon $_settings($this-cartoon) 1741 } elseif { [string is boolean $option] } { 1742 set cartoon $option 1743 } else { 1744 error "bad option \"$option\"" 1745 } 1746 set _settings($this-cartoon) $cartoon 1747 if { $models == "all" } { 1748 set models [array names _mlist] 1749 } 1750 set overridecartoon "off" 1751 foreach model $models { 1752 if { [info exists _active($model)] } { 1753 SendCmd "cartoon -model $model $cartoon" 1754 } else { 1755 SendCmd "cartoon -model $model $overridecartoon" 1756 } 1757 } 1758 } 1759 1760 # ---------------------------------------------------------------------- 1761 # USAGE: cartoontrace on|off|toggle 1762 # USAGE: cartoontrace update 1763 # 1764 # Used internally to turn labels associated with atoms on/off, and to 1765 # update the positions of the labels so they sit on top of each atom. 1766 # ---------------------------------------------------------------------- 1767 itcl::body Rappture::MolvisViewer::cartoontrace {option {models "all"}} { 1768 set trace $_settings($this-cartoontrace) 1769 if { $option == "update" } { 1770 set trace $_settings($this-cartoontrace) 1771 } elseif { [string is boolean $option] } { 1772 set trace $option 1773 } else { 1774 error "bad option \"$option\"" 1775 } 1776 set _settings($this-cartoontrace) $trace 1777 if { $models == "all" } { 1778 set models [array names _mlist] 1779 } 1780 set overridetrace "off" 1781 foreach model $models { 1782 if { [info exists _active($model)] } { 1783 SendCmd "cartoontrace -model $model $trace" 1784 } else { 1785 SendCmd "cartoontrace -model $model $overridetrace" 1786 } 1787 } 1788 } -
trunk/gui/scripts/resultviewer.tcl
r1549 r1550 218 218 } 219 219 ::Rappture::Curve { 220 set bars [$dataobj hints bars]220 set type [$dataobj hints type] 221 221 set mode "xy" 222 if { $ bars != "" && $bars} {222 if { $type == "bars" } { 223 223 if {![info exists _mode2widget($mode)]} { 224 224 set w $itk_interior.xy
Note: See TracChangeset
for help on using the changeset viewer.