Changeset 238 for trunk/expgui


Ignore:
Timestamp:
Dec 4, 2009 5:02:42 PM (13 years ago)
Author:
toby
Message:

# on 2000/07/20 22:13:40, toby did:
use file join on notebook.tcl
move source atomcons.tcl to be done when pane is initialized
create UpdateCurrentPage? to update all displayed panes
put UpdateCurrentPage? into sethistlist; atoms are now updated after a reload
use array element for notebook panes [expgui(notebookpagelist)]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2000/07/06 22:43:40 to 2000/07/20 22:13:40
    • Property rcs:lines changed from +118 -158 to +80 -57
    • Property rcs:rev changed from 1.28 to 1.29
    r234 r238  
    102102}
    103103# get the notebook widget if not using BWidgets
    104 if {!$expgui(haveBW)} {source $expgui(scriptdir)/notebook.tcl}
     104if {!$expgui(haveBW)} {source [file join $expgui(scriptdir) notebook.tcl]}
    105105#----------------------------------------------------------------
    106106if [file exists [file join $expgui(scriptdir) opts.tcl]] {
     
    115115# commands for adding phases, histograms & atoms
    116116source [file join $expgui(scriptdir) addcmds.tcl]
    117 # commands for constraints
    118 source [file join $expgui(scriptdir) atomcons.tcl]
    119117# commands for preferred orientation
    120118source [file join $expgui(scriptdir) orient.tcl]
     
    261259    SetupExtractHist
    262260
    263     # update the histogram list & the page, if shown
     261    # update the histogram list & update the page
    264262    sethistlist
    265 
    266     # update the atoms display
    267 #    DisplayAllAtoms noreset
    268     SelectOnePhase $expgui(curPhase)
    269263
    270264    # start checking for external changes
     
    688682    foreach n $expmap(phaselist) type $expmap(phasetype) {
    689683        if {$n == $num && $type <= 3} {
    690             $expgui(phaseFrame).top.ps.$num config -relief sunken
     684            catch {$expgui(phaseFrame).top.ps.$num config -relief sunken}
    691685            set crsPhase $num
    692686            if {$type == 3} {
     
    701695            }
    702696        } else {
    703             $expgui(phaseFrame).top.ps.$n config -relief raised
     697            catch {$expgui(phaseFrame).top.ps.$n config -relief raised}
    704698        }
    705699    }
     
    12401234        }
    12411235    }
     1236    UpdateCurrentPage
     1237}
     1238
     1239proc UpdateCurrentPage {} {
     1240    global expgui
    12421241    foreach set $expgui(frameactionlist) {
    1243         if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1]
     1242        if {$expgui(pagenow) == [lindex $set 0]} {catch [lindex $set 1]}
    12441243    }
    12451244}
     
    24432442# Creating the notebook with 5 panes: Phase, Histogram, Scaling, Profile
    24442443# & LS controls
     2444# 0 name,
     2445# 1 title
     2446# 2 create command
     2447# 3 raise command
     2448# 4 disable page in global mode (0/1)
     2449
    24452450if $expgui(haveBW) {
    24462451    pack [NoteBook .n -bd 2] -expand yes -fill both
    2447     set expgui(lsFrame) [\
    2448             .n insert end lsFrame -text "LS Controls" \
    2449             -raisecmd "set expgui(pagenow) lsFrame; SetupExtractHist"]
    2450     lappend expgui(frameactionlist) "lsFrame SetupExtractHist"
    2451     set expgui(phaseFrame) [\
    2452             .n insert end phasePane -text "Phase" \
    2453             -raisecmd "set expgui(pagenow) phaseFrame; \
    2454             DisplayAllAtoms noreset"]
    2455 #    lappend expgui(frameactionlist) "phaseFrame {DisplayAllAtoms noreset}"
    2456     set expgui(histFrame) [\
    2457             .n insert end histPane -text "Histogram" \
    2458             -raisecmd "set expgui(pagenow) histFrame; DisplayHistogram" \
    2459             -createcmd MakeHistPane]
    2460     lappend expgui(frameactionlist) "histFrame DisplayHistogram"
    2461     lappend expgui(GlobalModeAllDisable) "histFrame {.n itemconfigure histPane}"
    2462     set expgui(fracFrame) [\
    2463             .n insert end fracPane -text "Scaling" \
    2464             -raisecmd "set expgui(pagenow) fracFrame; DisplayFrac" \
    2465             -createcmd MakeScalingPane]
    2466     lappend expgui(frameactionlist) "fracFrame DisplayFrac"
    2467     set expgui(profFrame) [\
    2468             .n insert end profPane -text Profile \
    2469             -raisecmd "set expgui(pagenow) profFrame; DisplayProfile"\
    2470             -createcmd MakeProfilePane]
    2471     lappend expgui(frameactionlist) "profFrame DisplayProfile"
    2472     lappend expgui(GlobalModeAllDisable) "profFrame {.n itemconfigure profPane}"
    2473     set expgui(consFrame) [\
    2474             .n insert end consPane -text Constraints \
    2475             -raisecmd "set expgui(pagenow) consFrame; DisplayConstraintsPane"\
    2476             -createcmd MakeConstraintsPane]
    2477     lappend expgui(frameactionlist) "consFrame DisplayConstraintsPane"
    2478 
    2479     set expgui(orientFrame) [\
    2480             .n insert end prefPane -text "MD Pref Orient" \
    2481             -raisecmd "set expgui(pagenow) orientFrame; DisplayOrient"\
    2482             -createcmd MakeOrientPane]
    2483     lappend expgui(frameactionlist) "orientFrame DisplayOrient"
     2452    # create an array element describing each notebook page
     2453    # element 0 -- pane name
     2454    #         1 -- Label on frame
     2455    #         2 -- initialization command
     2456    #         3 -- update command
     2457    #         4 -- 0/1 Use 1 if pane should be disabled in when all histograms
     2458    #                are selected in global mode, 0 otherwise
     2459    set expgui(notebookpagelist) {
     2460        {lsFrame     "LS Controls" \
     2461                "" \
     2462                SetupExtractHist \
     2463                0}
     2464        {phaseFrame   Phase        \
     2465                "" \
     2466                "SelectOnePhase \$expgui(curPhase); DisplayAllAtoms noreset" \
     2467                0}
     2468        {histFrame    Histogram \
     2469                MakeHistPane \
     2470                DisplayHistogram \
     2471                1}
     2472        {fracFrame    Scaling \
     2473                MakeScalingPane \
     2474                DisplayFrac \
     2475                0}
     2476        {profFrame    Profile \
     2477                MakeProfilePane \
     2478                DisplayProfile \
     2479                1}
     2480        {consFrame    Constraints \
     2481                "source [file join $expgui(scriptdir) atomcons.tcl]; MakeConstraintsPane" \
     2482                DisplayConstraintsPane \
     2483                0}
     2484        {orientFrame  "MD Pref Orient" \
     2485                MakeOrientPane \
     2486                DisplayOrient \
     2487                0}
     2488        {odfFrame  "SH Pref Orient" \
     2489                "source [file join $expgui(scriptdir) odf.tcl]; MakeODFPane" \
     2490                DisplayODFPane \
     2491                0}
     2492    }
     2493    foreach item $expgui(notebookpagelist) {
     2494        set frm [lindex $item 0]
     2495        set expgui($frm) [\
     2496            .n insert end $frm -text [lindex $item 1] \
     2497            -createcmd [lindex $item 2] \
     2498            -raisecmd "set expgui(pagenow) $frm; [lindex $item 3]"]
     2499
     2500        # at this time expgui(frameactionlist) is generated
     2501        # from expgui(notebookpagelist), but in the future it might
     2502        # make sense to use expgui(notebookpagelist) directly
     2503        lappend expgui(frameactionlist) "$frm [list [lindex $item 3]]"
     2504
     2505        # panes to disable in global "all" mode
     2506        if {[lindex $item 4]} {
     2507            lappend expgui(GlobalModeAllDisable) \
     2508                    "$frm \{.n itemconfigure $frm\}"
     2509        }
     2510    }
    24842511} else {
    2485     Notebook:create .n -pages {lsFrame phaseFrame histFrame fracFrame profFrame}
     2512    Notebook:create .n \
     2513            -pages {lsFrame phaseFrame histFrame fracFrame profFrame}
    24862514    pack .n -anchor w -fill both -expand yes
    24872515    foreach item {lsFrame phaseFrame histFrame fracFrame profFrame \
     
    25192547    global expgui
    25202548    set expgui(pagenow) $nextpage
    2521     foreach set $expgui(frameactionlist) {
    2522         # don't worry about errors
    2523         catch {
    2524             if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1]
    2525         }
    2526     }
     2549    UpdateCurrentPage
    25272550}
    25282551# resize the notebook to fit all the tabs and the largest page
Note: See TracChangeset for help on using the changeset viewer.