Changeset 3076 for trunk/gui/scripts
- Timestamp:
- Jul 5, 2012, 1:31:40 PM (12 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/drawingcontrols.tcl
r3042 r3076 39 39 private method FormatLabel {str} 40 40 private method Monitor {name state} 41 42 41 private variable _dispatcher "" 43 42 private variable _controls "" … … 181 180 set _name2info($name-disablestyle) $disablestyle 182 181 } 182 183 if 0 { 183 184 # 184 185 # If this element has an <enable> expression, then register … … 232 233 } 233 234 } 234 235 235 foreach cpath $deps { 236 236 $_owner dependenciesfor $cpath $path 237 237 } 238 238 } 239 set _name2info($name-enable) $enable 239 } 240 set _name2info($name-enable) yes 240 241 241 242 #set wid [$_owner widgetfor $path] … … 534 535 $_dispatcher event -idle !layout 535 536 } 537 -
trunk/gui/scripts/drawingentry.tcl
r3072 r3076 45 45 # defined below 46 46 } 47 destructor { } {47 destructor { 48 48 # defined below 49 49 } … … 78 78 private method Withdraw {} 79 79 private method Hotspot { option cname item args } 80 private method IsEnabled { path } 80 81 } 81 82 … … 921 922 $inner.controls delete all 922 923 } 924 set count 0 923 925 foreach path $controls { 924 $inner.controls add $path 926 if { [IsEnabled $path] } { 927 $inner.controls add $path 928 incr count 929 } 930 } 931 if { $count == 0 } { 932 return 925 933 } 926 934 update … … 1000 1008 return [string trim [$_parser eval [list subst -nocommands $value]]] 1001 1009 } 1010 1011 itcl::body Rappture::DrawingEntry::IsEnabled { path } { 1012 set enable [string trim [$_owner xml get $path.about.enable]] 1013 if {"" == $enable} { 1014 return 1 1015 } 1016 if {![string is boolean $enable]} { 1017 set re {([a-zA-Z_]+[0-9]*|\([^\(\)]+\)|[a-zA-Z_]+[0-9]*\([^\(\)]+\))(\.([a-zA-Z_]+[0-9]*|\([^\(\)]+\)|[a-zA-Z_]+[0-9]*\([^\(\)]+\)))*(:[-a-zA-Z0-9/]+)?} 1018 set rest $enable 1019 set enable "" 1020 set deps "" 1021 while {1} { 1022 if {[regexp -indices $re $rest match]} { 1023 foreach {s0 s1} $match break 1024 1025 if {[string index $rest [expr {$s0-1}]] == "\"" 1026 && [string index $rest [expr {$s1+1}]] == "\""} { 1027 # string in ""'s? then leave it alone 1028 append enable [string range $rest 0 $s1] 1029 set rest [string range $rest [expr {$s1+1}] end] 1030 } else { 1031 # 1032 # This is a symbol which should be substituted 1033 # it can be either: 1034 # input.foo.bar 1035 # input.foo.bar:units 1036 # 1037 set cpath [string range $rest $s0 $s1] 1038 set parts [split $cpath :] 1039 set ccpath [lindex $parts 0] 1040 set units [lindex $parts 1] 1041 1042 # make sure we have the standard path notation 1043 set stdpath [$_owner regularize $ccpath] 1044 if {"" == $stdpath} { 1045 puts stderr "WARNING: don't recognize parameter $cpath in <enable> expression for $path. This may be buried in a structure that is not yet loaded." 1046 set stdpath $ccpath 1047 } 1048 # substitute [_controlValue ...] call in place of path 1049 append enable [string range $rest 0 [expr {$s0-1}]] 1050 append enable [format {[_controlValue %s %s]} $stdpath $units] 1051 lappend deps $stdpath 1052 set rest [string range $rest [expr {$s1+1}] end] 1053 } 1054 } else { 1055 append enable $rest 1056 break 1057 } 1058 } 1059 } 1060 return $enable 1061 }
Note: See TracChangeset
for help on using the changeset viewer.