Ignore:
Timestamp:
Sep 21, 2010 11:28:51 PM (10 years ago)
Author:
toby
Message:

mapexp: set expgui(mapstat) to trigger trace; move tab disable from sethistlist to StageTabUse?; trigger StageTabUse? when mapexp is used; StageTabUse?: disable tabs w/o phase or hist; simplify upgrade menu; addcmds: select a histogram after adding if none selected; revise SVN update code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/expgui

    r1014 r1015  
    16991699        }
    17001700    }
    1701     # disable the unallowed pages in all mode
    1702     if {$expgui(globalmode) == 6} {
    1703         foreach pair $expgui(GlobalModeAllDisable) {
    1704             if {$expgui(pagenow) == [lindex $pair 0]} {
    1705                 RaisePage lsFrame
    1706             }
    1707             eval [lindex $pair 1] -state disabled
    1708         }
    1709     } else {
    1710         foreach pair $expgui(GlobalModeAllDisable) {
    1711             eval [lindex $pair 1] -state normal
    1712         }
    1713     }
     1701    StageTabUse
     1702    # # disable the unallowed pages in all mode
     1703    # if {$expgui(globalmode) == 6} {
     1704    #   foreach pair $expgui(GlobalModeAllDisable) {
     1705    #       if {$expgui(pagenow) == [lindex $pair 0]} {
     1706    #           RaisePage lsFrame
     1707    #       }
     1708    #       eval [lindex $pair 1] -state disabled
     1709    #   }
     1710    # } else {
     1711    #   foreach pair $expgui(GlobalModeAllDisable) {
     1712    #       eval [lindex $pair 1] -state normal
     1713    #   }
     1714    # }
    17141715    set histlist {}
    17151716    if  {$expgui(hsorttype) == "type"} {
     
    33873388    }
    33883389}
     3390# procedure to disable tabs when phases or histograms are not defined
     3391proc StageTabUse {args} {
     3392    global expgui
     3393    # reset everything
     3394    foreach item [lrange $::expgui(notebookpagelist) 0 end] {
     3395        set frm [lindex $item 0]
     3396        .n itemconfigure $frm -state normal
     3397    }
     3398    # disable the unallowed pages in all mode
     3399    if {$expgui(globalmode) == 6} {
     3400        foreach pair $expgui(GlobalModeAllDisable) {
     3401            if {$expgui(pagenow) == [lindex $pair 0]} {
     3402                RaisePage lsFrame
     3403            }
     3404            eval [lindex $pair 1] -state disabled
     3405        }
     3406    } else {
     3407        foreach pair $expgui(GlobalModeAllDisable) {
     3408            eval [lindex $pair 1] -state normal
     3409        }
     3410    }
     3411    # no phases are present, one must add a phase 1st
     3412    if {[llength $::expmap(phaselist)] == 0} {
     3413        foreach item [lrange $::expgui(notebookpagelist) 2 end] {
     3414            set frm [lindex $item 0]
     3415            .n itemconfigure $frm -state disabled
     3416        }
     3417        return
     3418    }
     3419    # do any of the phases have atoms?
     3420    set flag 1
     3421    foreach phase $::expmap(phaselist) {
     3422        if {[array names ::expmap atomlist_$phase] != ""} {
     3423            if {[llength $::expmap(atomlist_$phase)] > 0} {
     3424                set flag 0
     3425                break
     3426            }
     3427        }
     3428    }
     3429    # no atoms are present, one must add at least one before continuing
     3430    if $flag {
     3431        foreach item [lrange $::expgui(notebookpagelist) 2 end] {
     3432            set frm [lindex $item 0]
     3433            .n itemconfigure $frm -state disabled
     3434        }
     3435        return
     3436    }
     3437
     3438    # no data is present, one must add a histogram next
     3439    if {[llength $::expmap(nhst)] == 0} {
     3440        foreach item [lrange $::expgui(notebookpagelist) 4 end] {
     3441            set frm [lindex $item 0]
     3442            .n itemconfigure $frm -state disabled
     3443        }
     3444        return
     3445    }
     3446}
     3447# expgui(mapstat) is set by mapexp when it is called
     3448# mapexp will be called when the .EXP file is changed (addition of phases, atoms or histograms)
     3449trace variable expgui(mapstat) w StageTabUse
    33893450
    33903451# this is used to bring up the selected frame
     
    42084269        -command {set expgui(debug) 1}
    42094270}
    4210 # add update commands to buffer
    4211 if [CheckUpdateImplemented $expgui(gsasdir)] {
     4271# add update commands to menu
     4272if {[file exists [file join  $expgui(gsasdir) .svn]]} {
    42124273    $expgui(fm).file.menu add command -command CheckAndDoUpdate -label "Update GSAS/EXPGUI"
    4213 #    $expgui(fm).file.menu add cascade -menu $expgui(fm).file.menu.track \
    4214 #       -label "Select EXPGUI version"
    4215 #    menu $expgui(fm).file.menu.track
    4216 #    $expgui(fm).file.menu.track add radiobutton -command {SetSVNbranch trunk} -label Development -value trunk \
    4217 #       -variable expgui(SVNversion)
    4218 #    $expgui(fm).file.menu.track add radiobutton -command {SetSVNbranch stable} -label Standard -value stable \
    4219 #       -variable expgui(SVNversion)
    4220     # get info about the current version on the server. Someday we might want to compare this
    4221     # say every month and notify when there is a new version to update
    4222     set repos [GetSVNrepository [file normalize $expgui(gsasdir)]]
    4223     # send a "p" to accept the server fingerprint in case needed on 1st access
    4224     set svninp [file normalize "~/svntmp.txt"]
    4225     set fp [open $svninp "w"]
    4226     puts $fp "p"
    4227     close $fp
    4228     if [catch {set out [exec svn info $repos < $svninp]} err] {
    4229         puts "svn info error = $err"
    4230     }
    4231     catch {file delete $svninp}
    4232     set expgui(SVNversion) [lindex [split $repos '/'] end]
    4233     # cleanup batch file from a previous update
    4234     if {$::tcl_platform(platform) == "windows" && $::tcl_platform(os) != "Windows 95"} {
    4235         catch {
    4236             file delete [file normalize ~/expgui_update.bat]
    4237         }
    4238     }
    42394274} else {
    4240     $expgui(fm).file.menu add command -label "Show update problem" -command {
    4241         if {! [file exists [file join $expgui(gsasdir) .svn]]} {
    4242             MyMessageBox -parent . -title "No .svn" \
    4243                 -message "Unable to update because the gsas/.svn directory is not present." \
    4244                 -icon warning
    4245         } else {
    4246             MyMessageBox -parent . -title "No .svn" \
    4247                 -message "Unable to update because the subversion (svn) program is not in the path." \
    4248                 -icon warning
    4249         }
    4250     }
     4275    $expgui(fm).file.menu add command  -state disabled -label "Self-updating not installed"
    42514276}
    42524277foreach c {h H} {bind . <Alt-$c> [list showhelp]}
Note: See TracChangeset for help on using the changeset viewer.