Changeset 3087


Ignore:
Timestamp:
Jul 11, 2012, 10:28:29 AM (12 years ago)
Author:
mmc
Message:

Fixed a problem in the enable condition processing for choice values like
input.choice(material) == "Bi2Te3". The string "Bi2Te3" wasn't being
treated as a quoted string. Instead, the "Bi2" part was being treated
as a name like input.xxx. It now looks for the leading quote and then
finds the trailing quote and leaves the quoted string alone.

File:
1 edited

Legend:

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

    r2992 r3087  
    216216                foreach {s0 s1} $match break
    217217
    218                 if {[string index $rest [expr {$s0-1}]] == "\""
    219                       && [string index $rest [expr {$s1+1}]] == "\""} {
     218                if {[string index $rest [expr {$s0-1}]] == "\""} {
    220219                    # string in ""'s? then leave it alone
    221                     append enable [string range $rest 0 $s1]
    222                     set rest [string range $rest [expr {$s1+1}] end]
     220                    append enable [string range $rest 0 [expr {$s0-1}]]
     221                    set rest [string range $rest $s0 end]
     222                    if {[regexp -indices {[^\"]+\"} $rest match]} {
     223                        foreach {s0 s1} $match break
     224                        append enable [string range $rest $s0 $s1]
     225                        set rest [string range $rest [expr {$s1+1}] end]
     226                    } else {
     227                        puts stderr "WARNING: mismatched quote in enable condition for $path"
     228                        puts stderr "   expr: [string trim [$_owner xml get $path.about.enable]]"
     229                        set rest ""
     230                    }
    223231                } else {
    224232                    #
Note: See TracChangeset for help on using the changeset viewer.