- Timestamp:
- Aug 16, 2005, 1:12:56 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r23 r43 311 311 set status [catch {load $file} msg] 312 312 if {$status != 0} { 313 set result $msg 313 global errorInfo 314 set result "$msg\n$errorInfo" 314 315 } 315 316 } else { … … 329 330 $itk_component(runinfo) delete 1.0 end 330 331 $itk_component(runinfo) insert end "Problem launching job:\n\n" 331 $itk_component(runinfo) insert end$result332 _simOutput $result 332 333 $itk_component(runinfo) configure -state disabled 334 $itk_component(runinfo) see 1.0 333 335 } else { 334 336 $itk_component(notebook) current analyze … … 370 372 # ---------------------------------------------------------------------- 371 373 itcl::body Rappture::Analyzer::load {file} { 374 # only show the last result? then clear first 375 if {[$_tool xml get tool.analyzer] == "last"} { 376 clear 377 } 378 372 379 # try to load new results from the given file 373 380 set xmlobj [Rappture::library $file] … … 509 516 set page [$itk_component(resultselector) value] 510 517 set page [$itk_component(resultselector) translate $page] 511 set f [$itk_component(resultpages) page $page] 512 $f.rviewer plot clear 513 foreach {index opts} $_plotlist { 514 $f.rviewer plot add $index $opts 518 if {"" != $page} { 519 set f [$itk_component(resultpages) page $page] 520 $f.rviewer plot clear 521 foreach {index opts} $_plotlist { 522 $f.rviewer plot add $index $opts 523 } 515 524 } 516 525 } -
trunk/gui/scripts/exec.tcl
r23 r43 63 63 } 64 64 65 puts $message66 append execout $message "\n"65 puts -nonewline $message 66 append execout $message 67 67 } -
trunk/gui/scripts/textentry.tcl
r35 r43 39 39 40 40 protected method _layout {} 41 protected method _newValue {} 41 42 42 43 private variable _dispatcher "" ;# dispatcher for !events … … 70 71 if {[string length $hints] > 0} { 71 72 itk_component add hints { 72 label $itk_interior.hints -anchor w -text $hints73 ::label $itk_interior.hints -anchor w -text $hints 73 74 } { 74 75 usual … … 244 245 -foreground $itk_option(-textforeground) 245 246 247 bind $itk_component(entry) <KeyPress> [itcl::code $this _newValue] 248 246 249 itk_component add emenu { 247 250 menu $itk_component(entry).menu -tearoff 0 … … 295 298 -foreground $itk_option(-textforeground) 296 299 $itk_component(scrollbars) contents $itk_component(text) 300 301 bind $itk_component(text) <KeyPress> [itcl::code $this _newValue] 297 302 298 303 itk_component add tmenu { … … 331 336 -width $itk_option(-width) -height $itk_option(-width) 332 337 } 338 } 339 340 # ---------------------------------------------------------------------- 341 # USAGE: _newValue 342 # 343 # Invoked automatically whenever the value in the entry changes. 344 # Sends a <<Value>> event to notify clients of the change. 345 # ---------------------------------------------------------------------- 346 itcl::body Rappture::TextEntry::_newValue {} { 347 event generate $itk_component(hull) <<Value>> 333 348 } 334 349 -
trunk/gui/scripts/tooltip.tcl
r26 r43 93 93 94 94 # ---------------------------------------------------------------------- 95 # USAGE: show @<x>,<y>|<widget>+ <x>,<y>95 # USAGE: show @<x>,<y>|<widget>+/-<x>,<y> 96 96 # 97 97 # Clients use this to pop up the tooltip on the screen. The position 98 # should be either a <widget> name with an optional offset + <x>,<y>98 # should be either a <widget> name with an optional offset +/-<x>,<y> 99 99 # (tooltip pops up beneath widget by default), or a specific root 100 100 # window coordinate of the form @x,y. … … 106 106 itcl::body Rappture::Tooltip::show {where} { 107 107 set hull $itk_component(hull) 108 set signx "+" 109 set signy "+" 108 110 109 111 if {[regexp {^@([0-9]+),([0-9]+)$} $where match x y]} { 110 112 set xpos $x 111 113 set ypos $y 112 } elseif {[regexp {^(.*)\+([0-9]+),([0-9]+)$} $where match win x y]} { 113 set xpos [expr {[winfo rootx $win]+$x}] 114 set ypos [expr {[winfo rooty $win]+$y}] 114 } elseif {[regexp {^(.*)([-+])([0-9]+),([-+]?)([0-9]+)$} $where match win signx x signy y]} { 115 if {$signy == ""} { set signy $signx } 116 set xpos [expr {[winfo rootx $win] + $x}] 117 set ypos [expr {[winfo rooty $win] + $y}] 115 118 } elseif {[winfo exists $where]} { 116 119 set xpos [expr {[winfo rootx $where]+10}] 117 120 set ypos [expr {[winfo rooty $where]+[winfo height $where]}] 118 121 } else { 119 error "bad position \"$where\": should be widget name,+x,y, or @x,y"122 error "bad position \"$where\": should be widget+x,y, or @x,y" 120 123 } 121 124 … … 152 155 # Make sure the tooltip doesn't go off screen. Then, put it up. 153 156 # 154 update 155 if {$xpos+[winfo reqwidth $hull] > [winfo screenwidth $hull]} { 156 set xpos [expr {[winfo screenwidth $hull]-[winfo reqwidth $hull]}] 157 } 158 if {$xpos < 0} { set xpos 0 } 159 160 if {$ypos+[winfo reqheight $hull] > [winfo screenheight $hull]} { 161 set ypos [expr {[winfo screenheight $hull]-[winfo reqheight $hull]}] 162 } 163 if {$ypos < 0} { set ypos 0 } 164 165 wm geometry $hull +$xpos+$ypos 157 update idletasks 158 if {$signx == "+"} { 159 if {$xpos+[winfo reqwidth $hull] > [winfo screenwidth $hull]} { 160 set xpos [expr {[winfo screenwidth $hull]-[winfo reqwidth $hull]}] 161 } 162 if {$xpos < 0} { set xpos 0 } 163 } else { 164 if {$xpos-[winfo reqwidth $hull] < 0} { 165 set xpos [expr {[winfo screenwidth $hull]-[winfo reqwidth $hull]}] 166 } 167 set xpos [expr {[winfo screenwidth $hull]-$xpos}] 168 } 169 170 if {$signy == "+"} { 171 if {$ypos+[winfo reqheight $hull] > [winfo screenheight $hull]} { 172 set ypos [expr {[winfo screenheight $hull]-[winfo reqheight $hull]}] 173 } 174 if {$ypos < 0} { set ypos 0 } 175 } else { 176 if {$ypos-[winfo reqheight $hull] < 0} { 177 set ypos [expr {[winfo screenheight $hull]-[winfo reqheight $hull]}] 178 } 179 set ypos [expr {[winfo screenheight $hull]-$ypos}] 180 } 181 182 wm geometry $hull $signx$xpos$signy$ypos 166 183 update 167 184 … … 264 281 if {[string index $loc 0] == "@"} { 265 282 .rappturetooltip show $loc 266 } elseif {[ string index $loc 0] == "+"} {283 } elseif {[regexp {^[-+]} $loc]} { 267 284 .rappturetooltip show $widget$loc 268 285 } else { -
trunk/gui/scripts/xyresult.tcl
r25 r43 16 16 option add *XyResult.height 4i widgetDefault 17 17 option add *XyResult.gridColor #d9d9d9 widgetDefault 18 option add *XyResult.hiliteColor black widgetDefault19 18 option add *XyResult.controlBackground gray widgetDefault 20 19 option add *XyResult.font \ … … 33 32 34 33 itk_option define -gridcolor gridColor GridColor "" 35 itk_option define -hilitecolor hiliteColor HiliteColor ""36 34 37 35 constructor {args} { # defined below } … … 58 56 private variable _vmin "" ;# autoscale min for y-axis 59 57 private variable _vmax "" ;# autoscale max for y-axis 60 private variable _hilite "";# info from last _hilite operation58 private variable _hilite ;# info from last _hilite operation 61 59 } 62 60 … … 104 102 105 103 # special pen for highlighting active traces 106 $itk_component(plot) element bind all <Enter> \ 107 [itcl::code $this _hilite on %x %y] 108 $itk_component(plot) element bind all <Leave> \ 104 #$itk_component(plot) element bind all <Enter> \ 105 # [itcl::code $this _hilite on %x %y] 106 #$itk_component(plot) element bind all <Leave> \ 107 # [itcl::code $this _hilite off %x %y] 108 array set _hilite { 109 elem "" 110 color "" 111 } 112 bind $itk_component(plot) <Motion> \ 113 [itcl::code $this _hilite at %x %y] 114 bind $itk_component(plot) <Leave> \ 109 115 [itcl::code $this _hilite off %x %y] 110 111 bind $itk_component(plot) <Leave> \112 [list Rappture::Tooltip::tooltip cancel]113 116 114 117 Blt_ZoomStack $itk_component(plot) … … 461 464 # ---------------------------------------------------------------------- 462 465 itcl::body Rappture::XyResult::_hilite {state x y} { 463 set elem [$itk_component(plot) element get current] 466 set g $itk_component(plot) 467 if {$state == "at"} { 468 if {[$g element closest $x $y info]} { 469 set elem $info(name) 470 set x [$g axis transform x $info(x)] 471 set y [$g axis transform y $info(y)] 472 set state 1 473 } else { 474 set state 0 475 } 476 } 477 464 478 if {$state} { 479 $g crosshairs configure -hide no -position @$x,$y 465 480 # 466 481 # Highlight ON: … … 469 484 # - pop up tooltip about data 470 485 # 471 set t [$itk_component(plot) element cget $elem -linewidth] 472 $itk_component(plot) element configure $elem -linewidth [expr {$t+2}] 473 474 set _hilite [$itk_component(plot) element cget $elem -color] 475 $itk_component(plot) element configure $elem \ 476 -color $itk_option(-hilitecolor) 486 if {"" == $_hilite(elem)} { 487 set t [$g element cget $elem -linewidth] 488 $g element configure $elem -linewidth [expr {$t+2}] 489 set _hilite(elem) $elem 490 } 477 491 478 492 set tip "" … … 480 494 set curve $_elem2curve($elem) 481 495 set tip [$curve hints tooltip] 496 if {[info exists info(y)]} { 497 set units [$curve hints yunits] 498 append tip "\n$info(y)$units" 499 500 if {[info exists info(x)]} { 501 set units [$curve hints xunits] 502 append tip " @ $info(x)$units" 503 } 504 } 505 set tip [string trim $tip] 482 506 } 483 507 if {"" != $tip} { 484 set x [expr {$x+4}] ;# move the tooltip over a bit 485 set y [expr {$y+4}] 486 Rappture::Tooltip::text $itk_component(plot) $tip 487 Rappture::Tooltip::tooltip show $itk_component(plot) +$x,$y 508 if {$x > 0.5*[winfo width $g]} { 509 set x "-[expr {$x-4}]" ;# move tooltip to the left 510 } else { 511 set x "+[expr {$x+4}]" ;# move tooltip to the right 512 } 513 if {$y > 0.5*[winfo height $g]} { 514 set y "-[expr {$y-4}]" ;# move tooltip to the top 515 } else { 516 set y "+[expr {$y+4}]" ;# move tooltip to the bottom 517 } 518 Rappture::Tooltip::text $g $tip 519 Rappture::Tooltip::tooltip show $g $x,$y 488 520 } 489 521 } else { … … 494 526 # - take down tooltip 495 527 # 496 set t [$itk_component(plot) element cget $elem -linewidth] 497 $itk_component(plot) element configure $elem -linewidth [expr {$t-2}] 498 499 if {"" != $_hilite} { 500 $itk_component(plot) element configure $elem -color $_hilite 528 $g crosshairs configure -hide yes 529 530 if {"" != $_hilite(elem)} { 531 set t [$g element cget $_hilite(elem) -linewidth] 532 $g element configure $_hilite(elem) -linewidth [expr {$t-2}] 533 set _hilite(elem) "" 501 534 } 502 535 Rappture::Tooltip::tooltip cancel -
trunk/python/Rappture/__init__.py
r9 r43 3 3 from interface import interface 4 4 from number import number 5 from result import result -
trunk/python/Rappture/library.py
r22 r43 9 9 # ====================================================================== 10 10 from xml.dom import minidom 11 import re, string 11 import re, string, time 12 12 13 13 class library: -
trunk/python/setup.py
r9 r43 4 4 description='Rapid Application Infrastructure library for nanoHUB.org', 5 5 url='http://www.nanohub.org/', 6 py_modules=['Rappture.library','Rappture.interface','Rappture.number' ],6 py_modules=['Rappture.library','Rappture.interface','Rappture.number','Rappture.result'], 7 7 )
Note: See TracChangeset
for help on using the changeset viewer.