Changeset 2087 for trunk/tester/scripts


Ignore:
Timestamp:
Feb 7, 2011 6:13:01 PM (9 years ago)
Author:
braffert
Message:

tester: added progress bar when running test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tester/scripts/main.tcl

    r2086 r2087  
    171171pack $win.testrun.title -side top -anchor w
    172172
     173Rappture::Progress $win.testrun.progress
    173174button $win.testrun.abort -text "Abort"
    174175pack $win.testrun.abort -side bottom -pady {8 0}
     
    346347            # plug this object into the "Abort" button
    347348            $testrun.abort configure -command [list $testobj abort]
     349
     350            # hide progress bar
     351            pack forget $testrun.progress
    348352        }
    349353        add {
     354            set message [lindex $args 0]
     355            # scan for progress updates
     356            while {[regexp -indices \
     357                {=RAPPTURE-PROGRESS=> *([-+]?[0-9]+) +([^\n]*)(\n|$)} $message \
     358                 match percent mesg]} {
     359
     360                foreach {i0 i1} $percent break
     361                set percent [string range $message $i0 $i1]
     362
     363                foreach {i0 i1} $mesg break
     364                set mesg [string range $message $i0 $i1]
     365
     366                pack $testrun.progress -fill x -padx 10 -pady 10
     367                $testrun.progress settings -percent $percent -message $mesg
     368
     369                foreach {i0 i1} $match break
     370                set message [string replace $message $i0 $i1]
     371            }
     372
    350373            $testrun.scrl.info configure -state normal
    351             $testrun.scrl.info insert end [lindex $args 0]
     374            $testrun.scrl.info insert end $message
    352375
    353376            # if there are too many lines, delete some
Note: See TracChangeset for help on using the changeset viewer.