Changeset 67 for trunk/gui


Ignore:
Timestamp:
Sep 25, 2005, 10:11:43 PM (19 years ago)
Author:
mmc
Message:

Fixed the resultset to include a -missingdata option, which
controls how we treat missing data. The old behavior was
"prompt", which prompts the user to simulate and fill in any
missing data. The new behavior is "skip", which adjusts the
controls to skip over missing data, jumping back to some
previous result. This makes it easier to examine data that
was actually simulated, especially when two controls must
change in unison to explore the data.

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r64 r67  
    234234        }
    235235        set _current $newval
     236
     237        after cancel [itcl::code $this _redraw]
     238        after idle [itcl::code $this _redraw]
     239        event generate $itk_component(hull) <<Value>>
     240
    236241        return $_current
    237242    }
  • trunk/gui/scripts/resultset.tcl

    r64 r67  
    1414option add *ResultSet.width 4i widgetDefault
    1515option add *ResultSet.height 4i widgetDefault
     16option add *ResultSet.missingData skip widgetDefault
    1617option add *ResultSet.toggleBackground gray widgetDefault
    1718option add *ResultSet.toggleForeground white widgetDefault
     
    2829    itk_option define -textfont textFont Font ""
    2930    itk_option define -boldfont boldFont Font ""
     31    itk_option define -missingdata missingData MissingData ""
    3032    itk_option define -clearcommand clearCommand ClearCommand ""
    3133    itk_option define -settingscommand settingsCommand SettingsCommand ""
     
    413415            grid $w -row $_counter -column 1 -sticky ew
    414416            bind $w <<Value>> \
    415                 [itcl::code $_dispatcher event -after 100 !settings]
     417                [itcl::code $_dispatcher event -after 100 !settings column $col widget $w]
    416418            set _col2widget($col) $w
    417419
     
    566568        #
    567569        _doSettings $plist
    568     } else {
     570    } elseif {$itk_option(-missingdata) == "skip"} {
     571        #
     572        # No data for these settings.  Try leaving the next
     573        # column open, then the next, and so forth, until
     574        # we find some data.
     575        #
     576        array set eventdata $args
     577        if {[info exists eventdata(column)]} {
     578            set changed $eventdata(column)
     579            set allcols [lrange [$_results column names] 1 end]
     580            set i [lsearch -exact $allcols $changed]
     581            set search [concat \
     582                [lrange $allcols [expr {$i+1}] end] \
     583                [lrange $allcols 0 [expr {$i-1}]] \
     584            ]
     585            set nsearch [llength $search]
     586
     587            set tweak(widget) ""
     588            set tweak(value) ""
     589            for {set i 0} {$i < $nsearch} {incr i} {
     590                set format $eventdata(column)
     591                set tuple [$eventdata(widget) get current]
     592                for {set j [expr {$i+1}]} {$j < $nsearch} {incr j} {
     593                    set col [lindex $search $j]
     594                    set w $_col2widget($col)
     595                    lappend format $col
     596                    lappend tuple [$w get current]
     597                }
     598                set ilist [$_results find -format $format -- $tuple]
     599                if {[llength $ilist] > 0} {
     600                    set col [lindex $search $i]
     601                    set tweak(widget) $_col2widget($col)
     602                    set first [lindex $ilist 0]
     603                    set tweak(value) [$_results get -format $col -- $first]
     604                    break
     605                }
     606            }
     607
     608            # set the value to the next valid result
     609            if {$tweak(widget) != ""} {
     610                $tweak(widget) current $tweak(value)
     611            }
     612        }
     613
     614    } elseif {$itk_option(-missingdata) == "prompt"} {
    569615        # prompt the user to simulate these settings
    570616        _doPrompt on
     
    631677    $_dispatcher event -idle !settings
    632678}
     679
     680# ----------------------------------------------------------------------
     681# OPTION: -missingdata
     682# ----------------------------------------------------------------------
     683itcl::configbody Rappture::ResultSet::missingdata {
     684    set opts {prompt skip}
     685    if {[lsearch -exact $opts $itk_option(-missingdata)] < 0} {
     686        error "bad value \"$itk_option(-missingdata)\": should be [join $opts {, }]"
     687    }
     688}
Note: See TracChangeset for help on using the changeset viewer.