Changeset 823


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

# on 2004/10/04 16:20:26, toby did:
Require BWidget (remove non-BWidget code)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2004/09/28 22:31:01 to 2004/10/04 16:20:26
    • Property rcs:lines changed from +22 -9 to +71 -177
    • Property rcs:rev changed from 1.74 to 1.75
    r809 r823  
    136136set expgui(docdir) [file join $expgui(scriptdir) doc]
    137137#----------------------------------------------------------------
     138# use EXPGUI directory for packages
    138139lappend auto_path $expgui(scriptdir)
    139 set expgui(havetix) 0
    140 set expgui(haveBW) 1
    141 # for debugging non-BWidget version set environment variable NOBWIDGET
    142 catch {if $env(NOBWIDGET) {set expgui(haveBW) 0}}
    143 if $expgui(haveBW) {
    144     if [catch {package require BWidget}] {set expgui(haveBW) 0}
    145 }
    146 # get the notebook widget if not using BWidgets
    147 if {!$expgui(haveBW)} {source [file join $expgui(scriptdir) notebook.tcl]}
    148140#----------------------------------------------------------------
    149141source [file join $expgui(scriptdir) opts.tcl]
     
    177169        -message $msg -icon warning -type Ignore -default ignore \
    178170        -helplink "expguierr.html Customizewarning"
     171}
     172if [catch {package require BWidget}] {
     173    set msg "Error loading the BWidget package: This should not happen if you use the version of Tcl/Tk (tcl84+.exe) distributed with EXPGUI"
     174    MyMessageBox -parent . -title "BWidget load error" \
     175        -message $msg -icon error -type Error -default error \
     176        -helplink "debug_tcltk.html"
     177    destroy .
    179178}
    180179SetTkDefaultOptions $expgui(font)
     
    17811780    }
    17821781    # Top box
    1783     if $expgui(haveBW) {
    1784         catch {destroy $expgui(histFrame).pflag}
    1785     }
     1782    catch {destroy $expgui(histFrame).pflag}
    17861783    if {$expgui(globalmode) != 0} {
    17871784        $expgui(histFrame).top.txt config \
     
    17941791        set expgui(bkglbl) "Edit Background"
    17951792        set expgui(abslbl) "Edit Abs./Refl."
    1796         if {$expgui(haveBW) && [llength $expmap(phaselist)] > 1} {
     1793        if {[llength $expmap(phaselist)] > 1} {
    17971794            TitleFrame $expgui(histFrame).pflag  \
    17981795                    -borderwidth 4 -side left -relief groove \
     
    22422239        set txt "Phase Fractions"
    22432240    }
    2244     if $expgui(haveBW) {
    2245         $expgui(fracFrame).f1.phaseFrac configure -text $txt
    2246     } else {
    2247         grid [label $phaseFractf1.txt -anchor center -text $txt] \
    2248                 -column 0 -row 0 -sticky news
    2249     }
     2241    $expgui(fracFrame).f1.phaseFrac configure -text $txt
    22502242    # Create the frame inside the canvas, One frame for each Phase.
    22512243    foreach i {1 2 3 4 5 6 7 8 9} {set phasehistlist($i) ""}
     
    23362328            # Label Heading for each phase.
    23372329            set ptype [string trim [hapinfo $hist $i proftype]]
    2338             if {$expgui(haveBW)} {
    2339                 grid [TitleFrame $expgui(ProfileBox).f.$i \
    2340                         -text "Hist $hist -- Phase $i (type $ptype)" \
    2341                         -relief groove -bd 2] \
    2342                         -column 0 -row $ind -sticky ew
    2343                 set ProfileFrame [$expgui(ProfileBox).f.$i getframe]
    2344                 grid [frame $ProfileFrame.1] \
    2345                         -column 0 -row 0 -columnspan 10
    2346                 pack [label $ProfileFrame.1.l  \
    2347                         -text Damping]\
    2348                         -side left
    2349             } else {
    2350                 grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \
    2351                         -column 0 -row $ind -sticky ew
    2352                 set ProfileFrame $expgui(ProfileBox).f.$i
    2353                 grid [frame $ProfileFrame.1] \
    2354                         -column 0 -row 0 -columnspan 10 -sticky ew
    2355                 pack [label $ProfileFrame.1.l  \
    2356                         -text "Phase $i (type $ptype)    Damping"]\
    2357                         -side left
    2358             }
     2330            grid [TitleFrame $expgui(ProfileBox).f.$i \
     2331                      -text "Hist $hist -- Phase $i (type $ptype)" \
     2332                      -relief groove -bd 2] \
     2333                -column 0 -row $ind -sticky ew
     2334            set ProfileFrame [$expgui(ProfileBox).f.$i getframe]
     2335            grid [frame $ProfileFrame.1] \
     2336                -column 0 -row 0 -columnspan 10
     2337            pack [label $ProfileFrame.1.l  \
     2338                      -text Damping]\
     2339                -side left
    23592340            tk_optionMenu $ProfileFrame.1.tkOptDamp entryvar(pdamp_$i) \
    23602341                    0 1 2 3 4 5 6 7 8 9
     
    24462427                incr i
    24472428                set boxtitle "Phase $p, hist [CompressList $histarray($key)]"
    2448                 if {$expgui(haveBW)} {
    2449                     grid [TitleFrame $expgui(ProfileBox).f.$i \
    2450                             -text "(type $ptype)" \
    2451                             -relief groove -bd 2] \
    2452                             -column 0 -row $i -sticky ew
    2453                     set ProfileFrame [$expgui(ProfileBox).f.$i getframe]
    2454                     grid [frame $ProfileFrame.0] \
    2455                             -column 0 -row 0 -columnspan 20 -sticky ew
    2456                 } else {
    2457                     grid [frame $expgui(ProfileBox).f.$i \
    2458                             -relief groove -bd 4] \
    2459                             -column 0 -row $i -sticky ew
    2460                     set ProfileFrame $expgui(ProfileBox).f.$i
    2461                     grid [frame $ProfileFrame.0] \
    2462                             -column 0 -row 0 -columnspan 20 -sticky ew
    2463                     grid [label $ProfileFrame.0.0  \
    2464                             -text "Profile Type $ptype   "] -row 0 -column 0
    2465                 }
     2429                grid [TitleFrame $expgui(ProfileBox).f.$i \
     2430                          -text "(type $ptype)" \
     2431                          -relief groove -bd 2] \
     2432                    -column 0 -row $i -sticky ew
     2433                set ProfileFrame [$expgui(ProfileBox).f.$i getframe]
     2434                grid [frame $ProfileFrame.0] \
     2435                    -column 0 -row 0 -columnspan 20 -sticky ew
    24662436                grid [label $ProfileFrame.0.1  \
    24672437                        -anchor w] -row 0 -column 1
     
    31983168# Creating the notebook and panes
    31993169
    3200 # create an array element describing each notebook page (used with BW only)
     3170# create an array element describing each notebook page
    32013171# element 0 -- pane name
    32023172#         1 -- Label on frame
     
    32423212}
    32433213
    3244 if $expgui(haveBW) {
    3245     pack [NoteBook .n -bd 2] -expand yes -fill both
    3246     # this should not be needed, but for some reason NoteBook is not
    3247     # using the optionDB
    3248     catch {.n configure -font [option get .n font Canvas]}
    3249     foreach item $expgui(notebookpagelist) {
    3250         set frm [lindex $item 0]
    3251         set expgui($frm) [\
     3214pack [NoteBook .n -bd 2] -expand yes -fill both
     3215# this should not be needed, but for some reason NoteBook is not
     3216# using the optionDB
     3217catch {.n configure -font [option get .n font Canvas]}
     3218foreach item $expgui(notebookpagelist) {
     3219    set frm [lindex $item 0]
     3220    set expgui($frm) [\
    32523221            .n insert end $frm -text [lindex $item 1] \
    32533222            -createcmd "set expgui(pagenow) $frm; [lindex $item 2]" \
    32543223            -raisecmd "set expgui(pagenow) $frm; [lindex $item 3]"]
    32553224
    3256         # at this time expgui(frameactionlist) is generated
    3257         # from expgui(notebookpagelist), but in the future it might
    3258         # make sense to use expgui(notebookpagelist) directly
    3259         lappend expgui(frameactionlist) "$frm [list [lindex $item 3]]"
    3260 
    3261         # panes to disable in global "all" mode
    3262         if {[lindex $item 4]} {
    3263             lappend expgui(GlobalModeAllDisable) \
    3264                     "$frm \{.n itemconfigure $frm\}"
    3265         }
    3266     }
    3267 } else {
    3268     Notebook:create .n \
    3269             -pages {lsFrame phaseFrame histFrame fracFrame profFrame}
    3270     pack .n -anchor w -fill both -expand yes
    3271     foreach item {lsFrame phaseFrame histFrame fracFrame profFrame \
    3272             orientFrame} \
    3273             page {"LS Controls" Phase Histogram Scaling Profile \
    3274             "MD Pref Orient"} {
    3275         set expgui($item) [Notebook:frame .n $item]
    3276         Notebook:pageconfig .n $item -command "InitPage $item" -title $page
    3277     }
    3278     lappend expgui(frameactionlist) "lsFrame SetupExtractHist"
    3279     lappend expgui(frameactionlist) "phaseFrame {DisplayAllAtoms $expgui(curPhase) noreset}"
    3280     lappend expgui(frameactionlist) "histFrame DisplayHistogram"
    3281     lappend expgui(frameactionlist) "fracFrame DisplayFrac"
    3282     lappend expgui(frameactionlist) "profFrame DisplayProfile"
    3283     lappend expgui(frameactionlist) "orientFrame DisplayOrient"
    3284     set expgui(GlobalModeAllDisable) {}
    3285     lappend expgui(GlobalModeAllDisable) "histFrame {Notebook:pageconfig .n histFrame}"
    3286     lappend expgui(GlobalModeAllDisable) "profFrame {Notebook:pageconfig .n profFrame}"
     3225    # at this time expgui(frameactionlist) is generated
     3226    # from expgui(notebookpagelist), but in the future it might
     3227    # make sense to use expgui(notebookpagelist) directly
     3228    lappend expgui(frameactionlist) "$frm [list [lindex $item 3]]"
     3229   
     3230    # panes to disable in global "all" mode
     3231    if {[lindex $item 4]} {
     3232        lappend expgui(GlobalModeAllDisable) "$frm \{.n itemconfigure $frm\}"
     3233    }
    32873234}
    32883235
     
    32903237proc RaisePage {nextpage} {
    32913238    global expgui
    3292     if $expgui(haveBW) {
    3293         set expgui(pagenow) $nextpage
    3294         .n see $nextpage
    3295         .n raise $nextpage
    3296     } else {
    3297         Notebook:raise .n $nextpage
    3298         InitPage $nextpage
    3299     }
    3300 }
    3301 # this is only called when BWidget is not in use
    3302 proc InitPage {nextpage} {
    3303     global expgui
    33043239    set expgui(pagenow) $nextpage
    3305     UpdateCurrentPage
    3306 }
     3240    .n see $nextpage
     3241    .n raise $nextpage
     3242}
     3243
    33073244# resize the notebook to fit all the tabs and the largest page
    33083245proc ResizeNotebook {} {
    33093246    global expgui
    3310     if {$expgui(haveBW)} {
    3311         .n compute_size
    3312     } else {
    3313         Notebook:resize .n
    3314     }
     3247    .n compute_size
    33153248}
    33163249
     
    37153648    frame $expgui(histFrame).top -borderwidth 4 -relief groove
    37163649    grid [label $expgui(histFrame).top.txt] -row 0 -column 0
    3717     if $expgui(haveBW) {
    3718         foreach item {backBox diffBox absBox} num {2 3 4} \
    3719                 title {Background "Diffractometer Constants" \
    3720                 "Absorption/Reflectivity Correction"} {
    3721             TitleFrame $expgui(histFrame).$item  \
    3722                     -borderwidth 4 -side left -relief groove -text $title
    3723             set expgui($item) [$expgui(histFrame).$item getframe]
    3724             grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew
    3725             grid rowconfigure $expgui(histFrame) $num -minsize 100
    3726         }
    3727     } else {
    3728         foreach item {backBox diffBox absBox} num {1 2 3} \
    3729                 title {Background "Diffractometer Constants" \
    3730                 "Absorp./Reflect. Corr"} {
    3731             frame $expgui(histFrame).$item  -borderwidth 4 -relief groove
    3732             grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew
    3733             set expgui($item)  $expgui(histFrame).$item
    3734             grid [label $expgui(histFrame).$item.title -text $title] \
    3735                     -row 0 -column 0 -columnspan 10 -sticky nw
    3736         }
    3737     }
    3738 
     3650    foreach item {backBox diffBox absBox} num {2 3 4} title {Background "Diffractometer Constants" "Absorption/Reflectivity Correction"} {
     3651        TitleFrame $expgui(histFrame).$item  \
     3652            -borderwidth 4 -side left -relief groove -text $title
     3653        set expgui($item) [$expgui(histFrame).$item getframe]
     3654        grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew
     3655        grid rowconfigure $expgui(histFrame) $num -minsize 100
     3656    }
    37393657    grid [frame $expgui(histFrame).bb] -column 1 -row 6
    37403658    if [file executable $expgui(exptool)] {
     
    38183736    # Create a large canvas area containing a frame for each phase in the data set.
    38193737    # The canvas and vertical scrollbar are inside a frame called f1
    3820     if $expgui(haveBW) {
    3821         TitleFrame $expgui(fracFrame).f1.scaleBox \
    3822                 -borderwidth 4 -text "Scale Factor"
    3823         #           -borderwidth 4 -width 600 -height 100 -label "Scale Factor"
    3824         grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2
    3825         set expgui(scaleBox)  [$expgui(fracFrame).f1.scaleBox getframe]
    3826         grid [label $expgui(scaleBox).histSFLabel -text Scale] \
    3827                 -row 1 -column 0 -sticky nws  -padx 2 -pady 3
    3828     } else {
    3829         frame $expgui(fracFrame).f1.scaleBox  -borderwidth 4 -relief groove
    3830         grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2
    3831         set expgui(scaleBox)  $expgui(fracFrame).f1.scaleBox
    3832         grid [label $expgui(scaleBox).histSFLabel -text "Scale Factor"] \
    3833                 -row 1 -column 0 -sticky nws  -padx 2 -pady 3
    3834     }
     3738    TitleFrame $expgui(fracFrame).f1.scaleBox \
     3739        -borderwidth 4 -text "Scale Factor"
     3740    #       -borderwidth 4 -width 600 -height 100 -label "Scale Factor"
     3741    grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2
     3742    set expgui(scaleBox)  [$expgui(fracFrame).f1.scaleBox getframe]
     3743    grid [label $expgui(scaleBox).histSFLabel -text Scale] \
     3744        -row 1 -column 0 -sticky nws  -padx 2 -pady 3
    38353745    grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \
    38363746            -row 1 -column 1 -sticky ew -padx 4 -pady 3
     
    38513761    grid columnconfigure $expgui(scaleBox) 6  -weight 1
    38523762   
    3853     if $expgui(haveBW) {
    3854         grid [TitleFrame $expgui(fracFrame).f1.phaseFrac -bd 4 \
    3855                 -text "Phase Fractions" -relief groove] \
    3856                 -sticky news -row 1 -column 0 -columnspan 2
    3857         set PhaseFractBox [$expgui(fracFrame).f1.phaseFrac getframe]
    3858     } else {
    3859         set PhaseFractBox $expgui(fracFrame).f1
    3860     }
     3763    grid [TitleFrame $expgui(fracFrame).f1.phaseFrac -bd 4 \
     3764              -text "Phase Fractions" -relief groove] \
     3765        -sticky news -row 1 -column 0 -columnspan 2
     3766    set PhaseFractBox [$expgui(fracFrame).f1.phaseFrac getframe]
    38613767    grid columnconfigure $expgui(fracFrame).f1 0 -weight 1
    38623768    grid rowconfigure $expgui(fracFrame).f1 1 -weight 1
     
    40083914
    40093915incr row
    4010 if {$expgui(haveBW)} {
    4011     grid [TitleFrame $expgui(lsFrame).f1.a -bd 4 -relief groove \
    4012             -text "Reflection Intensity Extraction" \
    4013             ] -row $row -column 0 -columnspan 6
    4014     set expgui(FobsExtractFrame) [$expgui(lsFrame).f1.a getframe]
    4015 } else {
    4016     grid [frame $expgui(lsFrame).f1.a -bd 4 -relief groove \
    4017             ] -row $row -column 0 -columnspan 6
    4018     set expgui(FobsExtractFrame) $expgui(lsFrame).f1.a
    4019 }
     3916grid [TitleFrame $expgui(lsFrame).f1.a -bd 4 -relief groove \
     3917          -text "Reflection Intensity Extraction" \
     3918         ] -row $row -column 0 -columnspan 6
     3919set expgui(FobsExtractFrame) [$expgui(lsFrame).f1.a getframe]
    40203920
    40213921grid [frame $expgui(FobsExtractFrame).c -bd 4 -relief groove] \
     
    43344234# can be called (in loadexp)
    43354235MakePhasePane
    4336 # and the rest of the windows w/o BWidget
    4337 if {!$expgui(haveBW)} {
    4338     MakeHistPane
    4339     MakeScalingPane
    4340     MakeProfilePane
    4341 }
    43424236
    43434237# handle indirect exits
Note: See TracChangeset for help on using the changeset viewer.