Changeset 303 for trunk/expgui


Ignore:
Timestamp:
Dec 4, 2009 5:03:48 PM (11 years ago)
Author:
toby
Message:

# on 2000/10/03 23:29:29, toby did:
Add definitions and implementation for entrybox array so that invalid
numbers are set to red. Valid ones, or when numbers are reread from
the .EXP are turned back to black

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2000/10/02 16:54:10 to 2000/10/03 23:29:29
    • Property rcs:lines changed from +7 -4 to +69 -58
    • Property rcs:rev changed from 1.34 to 1.35
    r289 r303  
    346346# trace routine on entryvar
    347347proc entvartrace {array elem action} {
    348     global expgui entrycmd entryvar
     348    global expgui entrycmd entryvar entrybox
    349349    if !$entrycmd(trace) return
    350350   
     
    355355        if {$entrycmd($elem) == ""} return
    356356        if [catch {
    357             eval $entrycmd($elem) set [list $entryvar($elem)]
     357            set result [eval $entrycmd($elem) set [list $entryvar($elem)]]
     358            if {!$result} {
     359                if $expgui(debug) {puts "error with $entrycmd($elem)"}
     360                catch {$entrybox($elem) config -fg red}
     361            } else {
     362                catch {$entrybox($elem) config -fg black}
     363            }
    358364            if {[lindex $entrycmd($elem) 0] == "atominfo"} {
    359365                after idle {DisplayAllAtoms noreset}
     
    375381#####                    #####################################################
    376382##############################################################################
    377 # reset routine is used for debugging
    378 proc reset {} {
    379     global expgui script argv
    380     set script $expgui(script)
    381     set argv $expgui(expfile)
    382     # remove traces
    383     global entryvar
    384     foreach cmd [trace vinfo entryvar] {
    385         eval trace vdelete entryvar $cmd
    386     }
    387     global expgui
    388     foreach cmd [trace vinfo expgui(backterms)] {
    389         eval trace vdelete entryvar $cmd
    390     }
    391     foreach cmd [trace vinfo expgui(backtype)] {
    392         eval trace vdelete entryvar $cmd
    393     }
    394     foreach a {
    395         expmap expgui entryvar entrycmd 
    396         expgui_menulist expgui_cmdlist expgui_helplist
    397     } {
    398         global $a
    399         catch {unset  $a}
    400     }
    401     foreach w [winfo children .] {
    402         destroy $w
    403     }
    404 
    405     uplevel #0 {source $script}
    406 }
    407383
    408384# save some of the global options in ~/.gsas_config
     
    689665#  This loads the "phases" widgets with data corresponding to the selected phase.
    690666proc SelectOnePhase {num} {
    691     global entryvar entrycmd expmap expgui
     667    global entryvar entrycmd entrybox expmap expgui
    692668    set crsPhase {}
    693669    $expgui(atomxform) config -text "Xform Atoms" -state disabled
     
    747723        set entrycmd($ent) "phaseinfo $crsPhase $ent"
    748724        set entryvar($ent) [phaseinfo $crsPhase $ent]
     725        # reset item to black
     726        catch {$entrybox($ent) config -fg black}
    749727    }
    750728
     
    12701248#-----------------------------------------------------------------------
    12711249proc DisplayHistogram {} {
    1272     global expgui entrycmd entryvar expmap
     1250    global expgui entrycmd entryvar entrybox expmap
    12731251
    12741252    # trap if more than one histogram is selected unless global mode
     
    13771355            grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \
    13781356                    -width 15 ] -column 4 -row 1
     1357            set entrybox(lam1) $expgui(diffBox).eDCdifc
    13791358            #
    13801359            grid [ label $expgui(diffBox).lDCra -text "Refine DIFA" ] \
     
    13861365            grid [ entry $expgui(diffBox).eDCdifa -textvariable entryvar(lam2) \
    13871366                    -width 15 ] -column 4 -row 2
     1367            set entrybox(lam2) $expgui(diffBox).eDCdifa
    13881368            #
    13891369            grid [ label $expgui(diffBox).lDCzero -text "Zero"] \
     
    13911371            grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \
    13921372                    -width 15 ] -column 4 -row 3
     1373            set entrybox(zero) $expgui(diffBox).eDCzero
    13931374            grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \
    13941375                    -column 1 -row 3 -sticky w
     
    14071388            grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \
    14081389                    -width 15 ] -column 4 -row 1
     1390            set entrybox(lam1) $expgui(diffBox).eDCdifc
    14091391            #
    14101392            grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \
     
    14161398            grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \
    14171399                    -width 15 ] -column 4 -row 3
     1400            set entrybox(zero) $expgui(diffBox).eDCzero
    14181401        } elseif {[string range $expmap(htype_$hist) 1 2] == "XC" && \
    14191402                [histinfo $hist lam2] == 0.0} {
     
    14291412            grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \
    14301413                    -width 15 ] -column 4 -row 1
     1414            set entrybox(lam1) $expgui(diffBox).eDCdifc
    14311415            #
    14321416            grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \
     
    14381422            grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \
    14391423                    -width 15 ] -column 4 -row 3
     1424            set entrybox(zero) $expgui(diffBox).eDCzero
    14401425            #
    14411426            grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \
     
    14471432            grid [ entry $expgui(diffBox).eDCpola \
    14481433                    -textvariable entryvar(pola) -width 15 ] -column 4 -row 4
     1434            set entrybox(pola) $expgui(diffBox).eDCpola
    14491435            grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \
    14501436                    -column 5 -row 4
    14511437            grid [ entry $expgui(diffBox).eDCipola -width 2 \
    14521438                    -textvariable entryvar(ipola)] -column 6 -row 4
     1439            set entrybox(ipola) $expgui(diffBox).eDCipola
    14531440        } elseif {[string range $expmap(htype_$hist) 1 2] == "XC"} {
    14541441        #---------------------------
     
    14591446            grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \
    14601447                    -width 15 ] -column 4 -row 1
     1448            set entrybox(lam1) $expgui(diffBox).eDCdifc
    14611449            grid [ entry $expgui(diffBox).eDCdifa -textvariable entryvar(lam2) \
    14621450                    -width 15 ] -column 5 -row 1
     1451            set entrybox(lam2) $expgui(diffBox).eDCdifa
    14631452            #
    14641453            grid [ label $expgui(diffBox).lDCrref -text "Refine ratio" ] \
     
    14711460                    -textvariable entryvar(kratio) \
    14721461                    -width 15 ] -column 4 -row 2
     1462            set entrybox(kratio) $expgui(diffBox).eDCkratio
    14731463            #
    14741464            grid [ label $expgui(diffBox).lDCzero -text "Zero"] \
     
    14781468            grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \
    14791469                    -column 1 -row 3 -sticky w
     1470            set entrybox(zero) $expgui(diffBox).eDCzero
    14801471            grid [ checkbutton $expgui(diffBox).rfDCzref \
    14811472                    -variable entryvar(zref) ] -column 2 -row 3
     
    14881479            grid [ entry $expgui(diffBox).eDCpola \
    14891480                    -textvariable entryvar(pola) -width 15 ] -column 4 -row 4
     1481            set entrybox(pola) $expgui(diffBox).eDCpola
    14901482            grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \
    14911483                    -column 5 -row 4
    14921484            grid [ entry $expgui(diffBox).eDCipola -width 2 \
    14931485                    -textvariable entryvar(ipola)] -column 6 -row 4
     1486            set entrybox(ipola) $expgui(diffBox).eDCipola
    14941487        } elseif {[string range $expmap(htype_$hist) 1 2] == "XE"} {
    14951488        #-------------
     
    15041497            grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \
    15051498                    -width 15 ] -column 4 -row 1
     1499            set entrybox(lam1) $expgui(diffBox).eDCdifc
    15061500            #
    15071501            grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \
     
    15131507            grid [ entry $expgui(diffBox).eDCpola \
    15141508                    -textvariable entryvar(pola) -width 15 ] -column 4 -row 4
     1509            set entrybox(pola) $expgui(diffBox).eDCpola
    15151510            grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \
    15161511                    -column 5 -row 4
    15171512            grid [ entry $expgui(diffBox).eDCipola -width 2 \
    15181513                    -textvariable entryvar(ipola)] -column 6 -row 4
     1514            set entrybox(ipola) $expgui(diffBox).eDCipola
    15191515        }
    15201516    } elseif {$expgui(globalmode) == 1} {
     
    16781674#-----------------------------------------------------------------------
    16791675proc DisplayFrac {} {
    1680     global expgui entrycmd entryvar expmap
     1676    global expgui entrycmd entryvar entrybox expmap
    16811677
    16821678    # trap if more than one histogram is selected unless global mode
     
    17271723            set entryvar($var) [histinfo [lindex $histlist 0] $var]
    17281724        }
     1725        # reset scale to black
     1726        catch {$entrybox(scale) config -fg black}
    17291727        set parm [grid info $expgui(scaleBox).ent1]
    17301728        if {$parm != ""} {
     
    17381736            set entryvar($var) [eval $entrycmd($var)]
    17391737        }
     1738        # reset scale to black
     1739        catch {$entrybox(scale) config -fg black}
    17401740        set parm [grid info $expgui(scaleBox).but1]
    17411741        if {$parm != ""} {
     
    17871787            grid [entry $framePF.ent -textvariable entryvar(frac$i) -width 15]\
    17881788                    -column 1 -row 0
     1789            set entrybox(frac$i) $framePF.ent
    17891790        }
    17901791        set entrycmd(frac$i) "hapinfo $hist $i frac"
     
    18171818#-----------------------------------------------------------------------
    18181819proc DisplayProfile {} {
    1819     global expgui entrycmd entryvar expmap
     1820    global expgui entrycmd entryvar entrybox expmap
    18201821
    18211822    # trap if more than one histogram is selected unless global mode
     
    18791880                    -width 10 -textvariable entryvar(pcut_$i)]\
    18801881                    -side left
     1882            set entrybox(pcut_$i) $ProfileFrame.1.e1
    18811883            set entrycmd(pcut_$i) "hapinfo $hist $i pcut"
    18821884            set entryvar(pcut_$i) [hapinfo $hist $i pcut]
     
    19071909                        -textvariable entryvar(pterm${num}_$i)\
    19081910                        -width 12] -row $row -column $col
     1911                set entrybox(pterm${num}_$i) $ProfileFrame.ent${num}_${i}
    19091912                set entrycmd(pterm${num}_$i) "hapinfo $hist $i pterm$num"
    19101913                set entryvar(pterm${num}_$i) [hapinfo $hist $i pterm$num]
     
    26272630proc MakePhasePane {} {
    26282631    #\/ \/ \/ \/ \/ \/ \/ BEGINNING OF PHASE PANE CODE \/ \/ \/ \/ \/ \/ \/
    2629     global expgui
     2632    global expgui entryvar entrybox entrycmd
    26302633    frame $expgui(phaseFrame).top
    26312634    set frameLatt [frame $expgui(phaseFrame).frameLatt]
     
    26632666        grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \
    26642667            -column $col -row $row -padx 5
     2668        set entrybox($var) $frameLatt.e$var
    26652669    }
    26662670    incr row
     
    26712675        grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \
    26722676            -column $col -row $row -padx 5
     2677        set entrybox($var) $frameLatt.e$var
    26732678    }
    26742679   
     
    27672772   
    27682773    set f3l1 [label $frame3.coords.l1 -text "Label" -bg beige]
    2769     set f3e1  [entry  $frame3.coords.e1 -textvariable entryvar(label) -width 6]
     2774    grid $f3l1 -column 0 -row 4 -padx 2 -sticky nsw -pady 3
     2775    set expgui(atomlabels) $f3l1
     2776
     2777    set f3e1 [entry  $frame3.coords.e1 -textvariable entryvar(label) -width 6]
     2778    grid $f3e1 -column 1 -row 4 -padx 2 -sticky nsw -pady 3
     2779    set expgui(atomentry) $f3e1
     2780
    27702781    set f3l8 [label $frame3.coords.l8 -text "Coordinates" -bg beige]
    2771     set f3e8  [entry  $frame3.coords.e8 -textvariable entryvar(x) -width 10]
    2772     set f3e9  [entry  $frame3.coords.e9 -textvariable entryvar(y) -width 10]
    2773     set f3e10 [entry $frame3.coords.e10 -textvariable entryvar(z) -width 10]
     2782    grid $f3l8 -column 2 -row 4 -padx 2 -sticky nsw -pady 3
     2783    lappend expgui(atomlabels) $f3l8
    27742784    set f3l11 [label $frame3.coords.l11 -text "Occupancy" -bg beige]
    2775     set f3e11 [entry $frame3.coords.e11 -textvariable entryvar(frac) -width 10]
    2776     set expgui(atomlabels) "$frame3.coords.l1 $frame3.coords.l8 $frame3.coords.l11"
    2777     set expgui(atomentry)  "$frame3.coords.e1 $frame3.coords.e8 $frame3.coords.e9 $frame3.coords.e10 $frame3.coords.e11"
    2778    
    2779     grid $f3l1 -column 0 -row 4 -padx 2 -sticky nsw -pady 3
    2780     grid $f3e1 -column 1 -row 4 -padx 2 -sticky nsw -pady 3
    2781     grid $f3l8 -column 2 -row 4 -padx 2 -sticky nsw -pady 3
    2782     grid $f3e8 -column 3 -row 4 -padx 2 -sticky nsw -pady 3
    2783     grid $f3e9 -column 4 -row 4 -padx 2 -sticky nsw -pady 3
    2784     grid $f3e10 -column 5 -row 4 -padx 2 -sticky nsw -pady 3
    27852785    grid $f3l11 -column 6 -row 4 -padx 2 -sticky nsw -pady 3
    2786     grid $f3e11 -column 7 -row 4 -padx 2 -sticky nsw -pady 3
     2786    lappend expgui(atomlabels) $f3l11
     2787
     2788    foreach var {x y z frac} col {3 4 5 7} {
     2789        set entrybox($var) [entry $frame3.coords.e$var \
     2790                -textvariable entryvar($var) -width 10]
     2791        grid $entrybox($var) -column $col -row 4 -padx 2 -sticky nsw -pady 3
     2792        lappend expgui(atomentry) $entrybox($var)
     2793    }
     2794
    27872795
    27882796    set f3f31 [frame $frame3.f3f31  -width 100 -borderwidth 0 -bg beige]
     
    27972805
    27982806    set expgui(anisoentry) {}
    2799     lappend expgui(anisoentry) [entry $f3f31.e13 -textvariable entryvar(U11) -width 10]
    2800     lappend expgui(anisoentry) [entry $f3f31.e14 -textvariable entryvar(U22) -width 10]
    2801     lappend expgui(anisoentry) [entry $f3f31.e15 -textvariable entryvar(U33) -width 10]
    2802     lappend expgui(anisoentry) [entry $f3f31.e16 -textvariable entryvar(U12) -width 10]
    2803     lappend expgui(anisoentry) [entry $f3f31.e17 -textvariable entryvar(U13) -width 10]
    2804     lappend expgui(anisoentry) [entry $f3f31.e18 -textvariable entryvar(U23) -width 10]
     2807    foreach i {e13 e14 e15 e16 e17 e18} var {U11 U22 U33 U12 U13 U23} {
     2808        lappend expgui(anisoentry) [\
     2809                entry $f3f31.$i -textvariable entryvar($var) \
     2810                -width 10]
     2811        set entrybox($var) $f3f31.$i
     2812    }
    28052813   
    28062814    set col 0
     
    29062914proc MakeScalingPane {} {
    29072915    #v v v v v v v v v v  BEGINNING OF SCALING PANE CODE v v v v v v v v v v
    2908     global expgui
     2916    global expgui entryvar entrybox
    29092917
    29102918    pack [frame $expgui(fracFrame).hs] -side left -expand y -fill both
     
    29422950    grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \
    29432951            -row 1 -column 1 -sticky ew -padx 4 -pady 3
     2952    set entrybox(scale) $expgui(scaleBox).ent1
     2953
    29442954    button $expgui(scaleBox).but1 -text "Set Globally" \
    29452955            -command "editglobalparm histinfo scale {Scale Factor}"
     
    30743084grid [entry $expgui(lsFrame).f1.b.ecyc -width 3 \
    30753085        -textvariable entryvar(cycles)] -row 0 -column 1
     3086set entrybox(cycles) $expgui(lsFrame).f1.b.ecyc
    30763087grid [menubutton $expgui(lsFrame).f1.lprint -textvariable expgui(printopt) \
    30773088        -menu $expgui(lsFrame).f1.lprint.menu -bd 4 -relief raised \
Note: See TracChangeset for help on using the changeset viewer.