Changeset 87


Ignore:
Timestamp:
Oct 5, 2005 7:28:40 PM (19 years ago)
Author:
mmc
Message:

Fixed "copy/paste with desktop" to convert any \r's to \n's.
This was a problem when pasting from Windows or Mac environments,
when what looked like a clean text file would paste badly into
a text area.

Fixed the Rappture::exec to cleanly separate stdout/stderr
channels. We were getting an error in Spice when a stderr
statement appeared right in the middle of a stdout line of data.
The line was truncated, so the value at the end was interpreted
as a very different number, causing a spike on the graph.
(Example: Common Collector Amplifier, and ".print ac im(vs)")

Fixed Field objects to respect the length scale set by the
overall structure.

Location:
trunk/gui/scripts
Files:
3 edited

Legend:

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

    r64 r87  
    2727    variable execout
    2828
    29     set execout ""
     29    set execout(output) ""
     30    set execout(channel) ""
     31    set execout(extra) ""
     32
    3033    eval blt::bgexec control \
    3134        -keepnewline yes \
     
    3437        $args
    3538
    36     return $execout
     39    # add any extra stuff pending from the last stdout/stderr change
     40    append execout(output) $execout(extra)
     41
     42    return $execout(output)
    3743}
    3844
     
    5460    if {$channel == "stderr"} {
    5561        set newmesg ""
    56         if {[string length $execout] > 0
    57               && [string index $execout end] != "\n"} {
    58             set newmesg "\n"
    59         }
    6062        foreach line [split $message \n] {
    6163            append newmesg "=RAPPTURE-ERROR=>$line\n"
    6264        }
    63         set message [string trimright $newmesg \n]
     65        set message $newmesg
    6466    }
    6567
    66     puts -nonewline $message
    67     append execout $message
     68    #
     69    # If this message is coming in on the same channel as the
     70    # last, then fine, add it on.  But if it's coming in on a
     71    # different channel, we must make sure that we're at a good
     72    # breakpoint.  If there's not a line break at the end of the
     73    # current output, then add the extra stuff onto a buffer
     74    # that we will merge in later once we get to a good point.
     75    #
     76    if {$execout(channel) == ""} {
     77        set execout(channel) $channel
     78    }
     79
     80    set ready [expr {[string length $execout(output)] == 0
     81        || [string index $execout(output) end] == "\n"}]
     82
     83    if {$channel != $execout(channel)} {
     84        if {$ready} {
     85            # changing channels...
     86            if {[string length $execout(extra)] > 0} {
     87                # any extra stuff on this new channel? put it out now
     88                puts -nonewline $execout(extra)
     89                append execout(output) $execout(extra)
     90                set execout(extra) ""
     91            }
     92            puts -nonewline $message
     93            append execout(output) $message
     94            set execout(channel) $channel
     95        } else {
     96            # not ready to change channels -- keep this for later
     97            append execout(extra) $message
     98        }
     99    } else {
     100        # no need to change channels -- keep printing
     101        puts -nonewline $message
     102        append execout(output) $message
     103    }
    68104}
  • trunk/gui/scripts/field.tcl

    r64 r87  
    5555    set _units [$_field get units]
    5656
     57    set xunits [$xmlobj get units]
     58    if {"" == $xunits || "arbitrary" == $xunits} {
     59        set xunits "um"
     60    }
     61
    5762    # determine the overall size of the device
    5863    set z0 [set z1 0]
     
    6570                set z0 [$_xmlobj get components.$elem.corner0]
    6671                set z0 [Rappture::Units::convert $z0 \
    67                     -context um -to um -units off]
     72                    -context $xunits -to $xunits -units off]
    6873
    6974                set z1 [$_xmlobj get components.$elem.corner1]
    7075                set z1 [Rappture::Units::convert $z1 \
    71                     -context um -to um -units off]
     76                    -context $xunits -to $xunits -units off]
    7277
    7378                set _limits($elem) [list $z0 $z1]
  • trunk/gui/scripts/mainwin.tcl

    r45 r87  
    183183            set s [blt::cutbuffer get]
    184184            if {"" != $s && ![string equal $s $_sync(cutbuffer)]} {
     185                #
     186                # Convert any \r's in the cutbuffer to \n's.
     187                #
     188                if {[string first "\r" $s] >= 0} {
     189                    regsub -all "\r\n" $s "\n" s
     190                    regsub -all "\r" $s "\n" s
     191                    blt::cutbuffer set $s
     192                }
     193
    185194                set _sync(cutbuffer) $s
    186195
Note: See TracChangeset for help on using the changeset viewer.