Ignore:
Timestamp:
Aug 16, 2005, 1:12:56 AM (19 years ago)
Author:
mmc
Message:
  • Added a new Rappture.result() function to the Python library. This makes it easy to finalize results. See examples/graph for example use.
  • Added examples/graph to illustrate a simple tool with a string and two numbers for input.
  • Fixed the XY graph to show crosshairs and pop-up info when you mouse over particular points.
  • Fixed Rappture::exec so that it doesn't add stray newlines when a program has lots (more than 8k) of output.
  • Fixed the analyzer to recognize the <tool><analyzer> tag. When set to "last", this automatically clears the last result. Handy for programs like SPICE, where you don't compare much, but keep running one new simulation after another.
  • Fixed <string> entries to enable the Simulate button after each editing keystroke.
File:
1 edited

Legend:

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

    r26 r43  
    9393
    9494# ----------------------------------------------------------------------
    95 # USAGE: show @<x>,<y>|<widget>+<x>,<y>
     95# USAGE: show @<x>,<y>|<widget>+/-<x>,<y>
    9696#
    9797# 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>
    9999# (tooltip pops up beneath widget by default), or a specific root
    100100# window coordinate of the form @x,y.
     
    106106itcl::body Rappture::Tooltip::show {where} {
    107107    set hull $itk_component(hull)
     108    set signx "+"
     109    set signy "+"
    108110
    109111    if {[regexp {^@([0-9]+),([0-9]+)$} $where match x y]} {
    110112        set xpos $x
    111113        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}]
    115118    } elseif {[winfo exists $where]} {
    116119        set xpos [expr {[winfo rootx $where]+10}]
    117120        set ypos [expr {[winfo rooty $where]+[winfo height $where]}]
    118121    } 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"
    120123    }
    121124
     
    152155    # Make sure the tooltip doesn't go off screen.  Then, put it up.
    153156    #
    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
    166183    update
    167184
     
    264281                if {[string index $loc 0] == "@"} {
    265282                    .rappturetooltip show $loc
    266                 } elseif {[string index $loc 0] == "+"} {
     283                } elseif {[regexp {^[-+]} $loc]} {
    267284                    .rappturetooltip show $widget$loc
    268285                } else {
Note: See TracChangeset for help on using the changeset viewer.