Changeset 6714


Ignore:
Timestamp:
Mar 24, 2020 4:48:01 PM (4 years ago)
Author:
clarksm
Message:

Make sure all phases/pages get initialized before processing loaders.
There was a problem when new elements were introduced in loader files.
The arbitrary sleep was not long enough.

Location:
branches/1.7/gui/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/1.7/gui/scripts/controlOwner.tcl

    r5679 r6714  
    131131        # register the new widget for the path
    132132        set _path2widget($path) $widget
     133#       puts stderr "controlOwner::widgetfor register $path"
    133134
    134135        # look up the containing panel and store it too
     
    287288        error "\"$newobj\" is not a Rappture::library"
    288289    }
     290#   puts stderr "controlOwner::load"
    289291    foreach path [array names _path2widget] {
    290292        # the following elements do not accept "current" tags, skip them
    291293        set type [[tool] xml element -as type $path]
     294#       puts stderr "controlOwner::load path = $path, type = $type"
    292295        if {[lsearch {group separator control} $type] >= 0} {
    293296            continue
     
    333336        }
    334337    }
     338#   puts stderr "controlOwner::load done"
    335339}
    336340
  • branches/1.7/gui/scripts/loader.tcl

    r6463 r6714  
    214214                    puts stderr "  $result"
    215215                } else {
     216#                   puts stderr "::load example file = $fname"
    216217                    set label [$obj get about.label]
    217218                    if {$label == ""} {
     
    227228                    # translate default file name => default label
    228229                    if {[string equal $defval [file tail $fname]]} {
     230#                       puts stderr "::load set default file = $fname"
    229231                        $_owner xml put $path.default $label
    230232                    }
     
    324326
    325327itcl::body Rappture::Loader::SetDefaultValue { value } {
     328#   puts stderr "Rappture::Loader::SetDefaultValue $value"
    326329    $itk_component(combo) value $value
    327330    _newValue
     
    337340#
    338341itcl::body Rappture::Loader::EventuallySetDefaultValue { value } {
    339     after 100 [itcl::code $this SetDefaultValue $value]
     342    global env
     343    if { [info exists env(RAPPTURE_PHASES_LOADED)] } {
     344        set setDefaultValueNow $env(RAPPTURE_PHASES_LOADED)
     345    } else {
     346        set setDefaultValueNow 2
     347    }
     348
     349#   puts stderr "Rappture::Loader::EventuallySetDefaultValue  $setDefaultValueNow"
     350
     351    if {$setDefaultValueNow == 0} {
     352        after 100 [itcl::code $this EventuallySetDefaultValue $value]
     353    } else {
     354        [itcl::code $this SetDefaultValue $value]
     355    }
    340356}
    341357
     
    350366    set newval [$itk_component(combo) value]
    351367    set obj [$itk_component(combo) translate $newval]
     368#   puts stderr "loader::_newValue $obj  $itk_option(-tool)"
    352369    if {$obj == "@upload"} {
    353370        set tool [Rappture::Tool::resources -appname]
     
    384401            $obj copy $_copyto from $_copyfrom
    385402        }
     403#       puts stderr "loader::_newValue $newval $_label2file($newval)"
    386404        $_owner xml put $_path.file $_label2file($newval)
    387405        $itk_option(-tool) load $obj
  • branches/1.7/gui/scripts/main.tcl

    r6561 r6714  
    290290}
    291291
     292#
     293# force loaders to wait until all phases have been created
     294# EventuallySetDefaultValue checks RAPPTURE_PHASES_LOADED
     295# before loading default loader file
     296#
     297global env
     298set env(RAPPTURE_PHASES_LOADED) 0
     299
    292300foreach comp $phases {
    293301    set title [string trim [$tool xml get $comp.about.label]]
     
    295303        set title "Input #auto"
    296304    }
     305#   puts stderr "main phase name $comp"
     306
    297307    $win.pager insert end -name $comp -title $title
    298308
     
    304314    pack $f.cntls -expand yes -fill both
    305315}
     316
     317set env(RAPPTURE_PHASES_LOADED) 1
    306318
    307319# let components (loaders) in the newly created pages settle
  • branches/1.7/gui/scripts/page.tcl

    r5679 r6714  
    7777
    7878        set type [$xmlobj element -as type $path.$cname]
     79#       puts stderr "::Page $type"
    7980        if {$type == "about"} {
    8081            continue
Note: See TracChangeset for help on using the changeset viewer.