Ignore:
Timestamp:
Sep 15, 2016 11:29:21 PM (8 years ago)
Author:
ldelgass
Message:

merge from trunk to blt4_trunk branch

Location:
branches/blt4_trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4_trunk

  • branches/blt4_trunk/gui/scripts/combochecks.tcl

    r6414 r6548  
    130130        $itk_component(ddlist) reset
    131131        foreach part $newval {
     132            set oldpart $part
    132133            set part [translate $part]
     134            if {[string compare $part ""] == 0} {
     135                # part could not be translated to a component
     136                error "bad value \"$oldpart\": should be one of \"[join [choices get -label] {, }]\""
     137            }
    133138            $itk_component(ddlist) state $part 1
    134139        }
     
    261266            set newval [$itk_component(ddlist) current -label]
    262267            set val [$itk_component(entry) get]
    263             if {$newval ne "" && $newval ne $val} {
     268            if {$newval eq ""} {
     269                # all options are unchecked, use the old val
     270                # wrap val (from entry) in a list to protect embedded whitespace
     271                value [list $val]
     272            } elseif {$newval ne $val} {
     273                # new value selected, update the widget
    264274                value $newval
    265275                if {[string length $itk_option(-interactcommand)] > 0} {
    266276                    uplevel #0 $itk_option(-interactcommand)
    267277                }
    268             }
    269             if {$newval eq ""} {
    270                 value $val
    271278            }
    272279        }
  • branches/blt4_trunk/gui/scripts/field.tcl

    r6414 r6548  
    11721172    package require vtk
    11731173
    1174     set reader $this-datasetreader
    1175     vtkDataSetReader $reader
    1176 
    1177     # Write the contents to a file just in case it's binary.
    1178     set tmpfile file[pid].vtk
    1179     set f [open "$tmpfile" "w"]
    1180     fconfigure $f -translation binary -encoding binary
    1181     puts $f $contents
    1182     close $f
    1183 
    1184     $reader SetFileName $tmpfile
    1185     $reader ReadAllNormalsOn
    1186     $reader ReadAllTCoordsOn
    1187     $reader ReadAllScalarsOn
    1188     $reader ReadAllColorScalarsOn
    1189     $reader ReadAllVectorsOn
    1190     $reader ReadAllTensorsOn
    1191     $reader ReadAllFieldsOn
    1192     $reader Update
    1193     file delete $tmpfile
    1194 
    1195     set dataset [$reader GetOutput]
     1174    if {[string index $contents 0] == "<"} {
     1175        set reader $this-xmlreader
     1176        vtkXMLGenericDataObjectReader $reader
     1177
     1178        # Write the contents to a file, since the XML reader
     1179        # can't read from a memory buffer
     1180        set tmpfile file[pid]-vtk.xml
     1181        set f [open "$tmpfile" "w"]
     1182        fconfigure $f -translation binary -encoding binary
     1183        puts $f $contents
     1184        close $f
     1185
     1186        $reader SetFileName $tmpfile
     1187        $reader Update
     1188        file delete $tmpfile
     1189
     1190        set dataset [$reader GetOutputAsDataSet]
     1191    } else {
     1192        set reader $this-datasetreader
     1193        vtkDataSetReader $reader
     1194
     1195        # Write the contents to a file just in case it's binary.
     1196        set tmpfile file[pid].vtk
     1197        set f [open "$tmpfile" "w"]
     1198        fconfigure $f -translation binary -encoding binary
     1199        puts $f $contents
     1200        close $f
     1201
     1202        $reader SetFileName $tmpfile
     1203        $reader ReadAllNormalsOn
     1204        $reader ReadAllTCoordsOn
     1205        $reader ReadAllScalarsOn
     1206        $reader ReadAllColorScalarsOn
     1207        $reader ReadAllVectorsOn
     1208        $reader ReadAllTensorsOn
     1209        $reader ReadAllFieldsOn
     1210        $reader Update
     1211        file delete $tmpfile
     1212
     1213        set dataset [$reader GetOutput]
     1214    }
    11961215    if { $dataset == "" } {
    11971216        puts stderr "Failed to parse VTK file"
  • branches/blt4_trunk/gui/scripts/map.tcl

    r6531 r6548  
    180180        return
    181181    }
     182    # If there is a <current>, use it
     183    set current [$map element -as object "current"]
     184    if {$current != ""} {
     185        set map $current
     186    }
    182187
    183188    # Set global map properties
     
    235240    set parent [$_tree findchild root "layers"]
    236241    set layers [$map element -as object "layers"]
    237     foreach layer [$layers children -type layer] {
     242    set layerList [list]
     243    if {$layers != ""} {
     244        set layerList [$layers children -type layer]
     245    }
     246    foreach layer $layerList {
    238247        # Unique identifier for layer.
    239248        set name [$layers element -as id "$layer"]
  • branches/blt4_trunk/gui/scripts/mapviewer.tcl

    r6531 r6548  
    21432143        2,0 $inner.wireframe -cspan 2 -anchor w -pady 2 \
    21442144        3,0 $inner.lighting  -cspan 2 -anchor w -pady 2 \
    2145         4,0 $inner.time_l    -cspan 2 -anchor w -pady 2 \
    2146         4,1 $inner.time      -cspan 2 -fill x   -pady 2 \
    2147         5,0 $inner.ambient_l -cspan 2 -anchor w -pady 2 \
    2148         5,1 $inner.ambient   -cspan 2 -fill x   -pady 2
     2145        4,0 $inner.time_l            -anchor w -pady 2 \
     2146        4,1 $inner.time              -fill x   -pady 2 \
     2147        5,0 $inner.ambient_l         -anchor w -pady 2 \
     2148        5,1 $inner.ambient           -fill x   -pady 2
    21492149#        4,0 $inner.edges     -cspan 2  -anchor w -pady 2
    21502150
     
    33153315                    -text $info(label) \
    33163316                    -font "Arial 9" -anchor w
    3317                 blt::table $f $row,1 $f.${ctlname}_lbl -anchor w -pady 2 -cspan 2
     3317                blt::table $f $row,1 $f.${ctlname}_lbl -anchor w -pady 2
    33183318                Rappture::Tooltip::for $f.${ctlname}_lbl [join $tooltip \n]
    33193319            } else {
     
    33243324                    -command [itcl::code $this \
    33253325                                  SetLayerVisibility $dataobj $layer]
    3326                 blt::table $f $row,1 $f.${ctlname}_visible -anchor w -pady 2 -cspan 2
     3326                blt::table $f $row,1 $f.${ctlname}_visible -anchor w -pady 2
    33273327                Rappture::Tooltip::for $f.${ctlname}_visible [join $tooltip \n]
    33283328            }
     
    33323332                if { $info(driver) == "colorramp" } {
    33333333                    set colormap $ctlname
     3334                    set f2 $f.cmap_$ctlname
     3335                    frame $f2
    33343336                    if { ![info exists _image(legend-$colormap)] } {
    33353337                        set _image(legend-$colormap) [image create photo]
    33363338                    }
    33373339                    itk_component add legend-$colormap-min {
    3338                         label $f.legend-$colormap-min -text 0
     3340                        label $f2.legend-$colormap-min -text 0
    33393341                    }
    33403342                    itk_component add legend-$colormap-max {
    3341                         label $f.legend-$colormap-max -text 1
     3343                        label $f2.legend-$colormap-max -text 1
    33423344                    }
    33433345                    itk_component add legend-$colormap {
    3344                         label $f.legend-$colormap -image $_image(legend-$colormap)
    3345                     }
    3346                     blt::table $f $row,0 $f.legend-$colormap-min -anchor w -pady 0 -cspan 2
    3347                     blt::table $f $row,2 $f.legend-$colormap-max -anchor e -pady 0
    3348                     incr row
    3349                     blt::table $f $row,0 $f.legend-$colormap -anchor w -pady 2 -cspan 3
     3346                        label $f2.legend-$colormap -image $_image(legend-$colormap)
     3347                    }
     3348                    blt::table $f2 0,0 $f2.legend-$colormap-min -anchor w -pady 0
     3349                    blt::table $f2 0,1 $f2.legend-$colormap-max -anchor e -pady 0
     3350                    blt::table $f2 1,0 $f2.legend-$colormap -anchor w -pady 2 -cspan 2
     3351
     3352                    blt::table $f $row,0 $f2 -anchor w -pady 0 -cspan 2
    33503353                    incr row
    33513354                    RequestLegend $colormap 256 16
     
    33553358                 $info(type) != "mask" &&
    33563359                ($info(type) != "image" || $imgIdx > 1) } {
    3357                 label $f.${ctlname}_opacity_l -text "Opacity" -font "Arial 9"
    3358                 ::scale $f.${ctlname}_opacity -from 0 -to 100 \
     3360                set f2 $f.op_$ctlname
     3361                frame $f2
     3362                label $f2.${ctlname}_opacity_l -text "Opacity" -font "Arial 9"
     3363                ::scale $f2.${ctlname}_opacity -from 0 -to 100 \
    33593364                    -orient horizontal -showvalue off \
    33603365                    -variable [itcl::scope _opacity($tag)] \
     
    33623367                    -command [itcl::code $this \
    33633368                                  SetLayerOpacity $dataobj $layer]
    3364                 Rappture::Tooltip::for $f.${ctlname}_opacity "Set opacity of $info(label) layer"
    3365                 blt::table $f $row,0 $f.${ctlname}_opacity_l -anchor w -pady 2 -cspan 2
    3366                 blt::table $f $row,2 $f.${ctlname}_opacity -anchor w -pady 2
     3369                Rappture::Tooltip::for $f2.${ctlname}_opacity "Set opacity of $info(label) layer"
     3370                blt::table $f2 0,0 $f2.${ctlname}_opacity_l -anchor w -pady 2
     3371                blt::table $f2 0,1 $f2.${ctlname}_opacity -anchor w -pady 2
     3372
     3373                blt::table $f $row,0 $f2 -anchor w -pady 0 -cspan 2
    33673374                incr row
    33683375            }
     
    33753382    SendCmd "[list map attrib [encoding convertto utf-8 [join $attrib ,]]]"
    33763383    label $f.map_attrib -text [join $attrib \n] -font "Arial 9"
    3377     blt::table $f $row,0 $f.map_attrib -anchor sw -pady 2 -cspan 3
     3384    blt::table $f $row,0 $f.map_attrib -anchor sw -pady 2 -cspan 2
    33783385    #incr row
    33793386    if { $row > 0 } {
    33803387        blt::table configure $f r* c* -resize none
    3381         blt::table configure $f r$row c2 -resize expand
     3388        blt::table configure $f r$row c1 -resize expand
    33823389    }
    33833390}
Note: See TracChangeset for help on using the changeset viewer.