- Timestamp:
- Nov 20, 2008 5:17:50 AM (15 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/controlOwner.tcl
r1207 r1225 270 270 set currentpath $path.$_type2curpath($type) 271 271 } else { 272 # default incase i forgot an inpu it type in _type2curpath272 # default incase i forgot an input type in _type2curpath 273 273 set currentpath $path.current 274 274 } 275 275 276 276 # copy new value to the XML tree 277 [tool] xml copy $currentpath from $newobj $currentpath 277 # we only copy the values if they existed in newobj 278 # so we don't overwrite values that were set in previous loads. 279 # this is needed for when the users specify copy.from and copy.to 280 # in a loader. in this case, _path2widget holds a list of all 281 # widgets. if there are two loaders loading two different widgets, 282 # and each loader uses the copy from/to functionality, 283 # the second load could wipe out the values set in the first load 284 # because on the second load, the copied paths from the first load no 285 # longer exist in newobj and blanks are copied to the paths 286 # in [tool] xml set by the first loader. the solution is to check 287 # newobj and see if the path exists. if the path exists, then we copy 288 # it over to [tool] xml, otherwise we ignore it. 289 if {"" != [$newobj element -as component $currentpath]} { 290 [tool] xml copy $currentpath from $newobj $currentpath 291 } 278 292 279 293 # also copy to the widget associated with the tree -
trunk/gui/scripts/loader.tcl
r1077 r1225 42 42 private variable _dnpaths "" ;# list of download element paths 43 43 private common _dnpath2state ;# maps download path => yes/no state 44 private variable _copyfrom "" ;# copy xml objects from here in example lib 45 private variable _copyto "" ;# copy xml objects here in example lib 46 private variable _label2file ;# maps combobox labels to filenames 44 47 } 45 48 … … 199 202 if {![info exists entries($label)]} { 200 203 set entries($label) $obj 204 set _label2file($label) [file tail $fname] 201 205 } 202 206 … … 215 219 } 216 220 221 set _copyfrom [$_owner xml get $path.copy.from] 222 set _copyto [$_owner xml get $path.copy.to] 223 217 224 # 218 225 # Assign the default value to this widget, if there is one. … … 336 343 $itk_component(combo) component entry configure -state disabled 337 344 } elseif {$obj != "" && $itk_option(-tool) != ""} { 345 if {("" != $_copyfrom) && ("" != $_copyto)} { 346 $obj copy $_copyto from $_copyfrom 347 } 348 $_owner xml put $_path.file $_label2file($newval) 338 349 $itk_option(-tool) load $obj 339 350 set _lastlabel $newval
Note: See TracChangeset
for help on using the changeset viewer.