Changeset 16
- Timestamp:
- Dec 4, 2009 4:58:57 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expgui
- Property rcs:date changed from 1998/12/31 13:10:07 to 1999/01/01 18:34:49
- Property rcs:lines changed from +122 -67 to +136 -65
- Property rcs:rev changed from 1.3 to 1.4
r14 r16 25 25 # DisplayAllAtoms needs to loop over phases: expgui(curPhase) 26 26 27 if {$tcl_version < 8.0} { 28 tk_dialog .expFileErrorMsg "Version Error" \ 29 "The program requires Tcl/Tk version 8.0 or higher" error 0 "Exit" 30 exit 31 } 32 27 33 if {$argv != ""} { 28 34 set expfile [lindex $argv 0] … … 114 120 set expgui(changed) 0 115 121 mapexp 116 122 set expgui(expModifiedLast) [file mtime $expfile] 123 set expgui(last_History) [string trim [lindex [exphistory last] 1]] 117 124 # set the window/icon title 118 125 wm title . $expfile 126 set expgui(titleunchanged) 1 119 127 wm iconname . [file tail $expfile] 120 128 … … 129 137 130 138 if !$expgui(havetix) { 131 RaisePage phaseFrame139 RaisePage lsFrame 132 140 } else { 133 .n raise phasePane134 set expgui(pagenow) phaseFrame141 .n raise lsPane 142 set expgui(pagenow) lsFrame 135 143 } 136 144 # select the 1st phase … … 153 161 "Energy Disp Xray"} { 154 162 if $flag($num) { 155 $expgui(fm). edit.menuentryconfigure $lbl -state normal163 $expgui(fm).option.menu.editmode entryconfigure $lbl -state normal 156 164 } else { 157 $expgui(fm). edit.menuentryconfigure $lbl -state disabled165 $expgui(fm).option.menu.editmode entryconfigure $lbl -state disabled 158 166 } 159 167 } … … 173 181 # enable traces on entryvar 174 182 set entrycmd(trace) 1 183 # start checking for external changes 184 afterawhile 175 185 } 176 186 … … 202 212 expwrite $expfile 203 213 set expgui(changed) 0 214 set expgui(expModifiedLast) [file mtime $expfile] 215 set expgui(last_History) [string trim [lindex [exphistory last] 1]] 204 216 # set the window/icon title 205 217 wm title . $expfile 218 set expgui(titleunchanged) 1 206 219 wm iconname . [file tail $expfile] 207 220 } … … 298 311 } 299 312 313 # wait until idle 314 proc afterawhile {} { 315 # cancel any other instances of this loop 316 after cancel afterawhile 317 after cancel whenidle 318 after cancel whenidle 319 after idle whenidle 320 } 321 322 proc whenidle {} { 323 global expgui expfile 324 if $expgui(titleunchanged) { 325 if {$expgui(changed) != 0} { 326 wm title . "$expfile (modified)" 327 set expgui(titleunchanged) 0 328 } 329 } 330 #puts whenidle 331 if {[file mtime $expfile] != $expgui(expModifiedLast)} { 332 if {$expgui(changed) == 0} { 333 set ans [tk_dialog .expFileErrorMsg "Reload?" \ 334 "File $expfile has been modified by another program. \ 335 Do you want to load the newer version or loose the modifications \ 336 by editing the current version?" \ 337 warning 0 "Load new" "Continue editing"] 338 } else { 339 set ans [tk_dialog .expFileErrorMsg "Reload?" \ 340 "File $expfile has been modified by another program \ 341 and you have made $expgui(changed) changes to this version. \ 342 Do you want to load the newer version or loose the modifications \ 343 by continuing to edit the current version?" \ 344 warning 0 "Load new" "Continue editing" "Save edited version"] 345 } 346 if {$ans == 0} { 347 loadexp $expfile 348 } elseif {$ans == 1} { 349 # reset the time to the next version 350 set expgui(expModifiedLast) [file mtime $expfile] 351 } elseif {$ans == 2} { 352 savearchiveexp $expfile 353 } 354 } 355 after 2000 afterawhile 356 } 300 357 # -------- called to confirm before exiting 301 358 proc catchQuit {} { … … 322 379 # save and optionally archive the expfile 323 380 proc savearchiveexp {expfile} { 324 global expgui tcl_platform 381 global expgui tcl_platform expmap 325 382 if !$expgui(changed) return 326 383 if $expgui(archive) { … … 396 453 } 397 454 } 455 # add a header 456 exphistory add " EXPGUI [lindex $expgui(Revision) 1] [lindex $expmap(Revision) 1] ($expgui(changed) changes) -- [clock format [clock seconds]]" 398 457 # now save the file 399 458 expwrite $expfile 400 459 set expgui(changed) 0 460 set expgui(expModifiedLast) [file mtime $expfile] 461 set expgui(last_History) [string trim [lindex [exphistory last] 1]] 462 wm title . $expfile 463 set expgui(titleunchanged) 1 401 464 } 402 465 … … 782 845 if {$expgui(pagenow) == [lindex $pair 0]} { 783 846 if !$expgui(havetix) { 784 RaisePage phaseFrame847 RaisePage lsFrame 785 848 } else { 786 .n raise phasePane787 set expgui(pagenow) phaseFrame849 .n raise lsPane 850 set expgui(pagenow) lsFrame 788 851 } 789 852 } … … 1981 2044 if $expgui(havetix) { 1982 2045 pack [tixNoteBook .n] -expand yes -fill both 2046 .n add lsPane -label "LS Controls" -underline 0 2047 .n pageconfigure lsPane -raisecmd \ 2048 "set expgui(pagenow) lsFrame; SetupExtractHist" 2049 lappend expgui(frameactionlist) "lsFrame SetupExtractHist" 1983 2050 .n add phasePane -label "Phase" -underline 0 1984 2051 .n pageconfigure phasePane -raisecmd \ … … 1998 2065 lappend expgui(frameactionlist) "profFrame DisplayProfile" 1999 2066 lappend expgui(GlobalModeAllDisable) "profFrame {.n pageconfigure profPane}" 2000 .n add lsPane -label "LS Controls" -underline 02001 .n pageconfigure lsPane -raisecmd \2002 "set expgui(pagenow) lsFrame; SetupExtractHist"2003 lappend expgui(frameactionlist) "lsFrame SetupExtractHist"2004 2067 # Finding the pathname to the subwidget frames. 2005 2068 set expgui(phaseFrame) [.n subwidget phasePane] … … 2011 2074 pack [frame .bar] -side top -anchor w 2012 2075 pack [frame .n] -anchor w -fill both -expand yes 2013 foreach item { phaseFrame histFrame fracFrame profFrame lsFrame} \2076 foreach item {lsFrame phaseFrame histFrame fracFrame profFrame} \ 2014 2077 page {Phase Histogram Scaling Profile "LS Controls"} { 2015 2078 pack [button .bar.$item -text $page -bd 2 \ … … 2017 2080 set expgui($item) [frame .n.$item -relief flat] 2018 2081 } 2082 lappend expgui(frameactionlist) "lsFrame SetupExtractHist" 2019 2083 lappend expgui(frameactionlist) "histFrame DisplayHistogram" 2020 2084 lappend expgui(frameactionlist) "fracFrame DisplayFrac" 2021 2085 lappend expgui(frameactionlist) "profFrame DisplayProfile" 2022 lappend expgui(frameactionlist) "lsFrame SetupExtractHist"2023 2086 lappend expgui(GlobalModeAllDisable) "histFrame {.bar.histFrame config}" 2024 2087 lappend expgui(GlobalModeAllDisable) "profFrame {.bar.profFrame config}" … … 2549 2612 pack [frame $expgui(lsFrame).f1] -fill both -expand true 2550 2613 grid rowconfigure $expgui(lsFrame).f1 4 -weight 1 2551 grid [frame $expgui(lsFrame).f1.b -bd 4 -relief groove] -row 0 -column 0 2614 grid [label $expgui(lsFrame).f1.his1 -pady 6 -text "Last History:"] -row 0 -column 0 2615 grid [label $expgui(lsFrame).f1.his2 -relief sunken -bd 2 -pady 6 \ 2616 -textvariable expgui(last_History)] \ 2617 -row 0 -column 1 -columnspan 5 -sticky w 2618 grid [frame $expgui(lsFrame).f1.b -bd 4 -relief groove] \ 2619 -row 1 -column 0 -columnspan 2 -pady 3 2552 2620 grid [label $expgui(lsFrame).f1.b.lcyc -text "Number of Cycles"] -row 0 -column 0 2553 2621 grid [entry $expgui(lsFrame).f1.b.ecyc -width 3 \ … … 2555 2623 grid [menubutton $expgui(lsFrame).f1.lprint -textvariable expgui(printopt) \ 2556 2624 -menu $expgui(lsFrame).f1.lprint.menu -bd 4 -relief raised \ 2557 ] -row 0 -column 12625 ] -row 1 -column 2 2558 2626 menu $expgui(lsFrame).f1.lprint.menu 2559 2627 foreach num [lsort [array names printopts]] { … … 2562 2630 -variable entryvar(printopt$num) 2563 2631 } 2564 grid [frame $expgui(lsFrame).f1.c -bd 4 -relief groove] -row 0 -column 22632 grid [frame $expgui(lsFrame).f1.c -bd 4 -relief groove] -row 1 -column 3 2565 2633 grid [label $expgui(lsFrame).f1.c.fol -text "Extract Fobs"] -row 0 -column 2 2566 2634 grid [checkbutton $expgui(lsFrame).f1.c.foc -variable entryvar(fobsextract)] -row 0 -column 3 … … 2600 2668 -command "reset" 2601 2669 } 2602 $expgui(fm).file.menu add checkbutton -label "Archive EXP" -variable expgui(archive) -underline 02603 2670 $expgui(fm).file.menu add command -label "Save" -underline 0 \ 2604 2671 -command {savearchiveexp $expfile} … … 2618 2685 #$expgui(fm).help.menu add command -label "GSAStk" -underline 0 -command { GSAStkHelp } 2619 2686 2687 #---- options menu button 2688 menubutton $expgui(fm).option -text Options -underline 0 \ 2689 -menu $expgui(fm).option.menu 2690 menu $expgui(fm).option.menu 2691 2692 $expgui(fm).option.menu add checkbutton -label "Archive EXP" \ 2693 -variable expgui(archive) -underline 0 2694 2695 $expgui(fm).option.menu add cascade -menu $expgui(fm).option.menu.asort \ 2696 -label "Sort atoms by" 2697 2698 set expgui(asorttype) number 2699 menu $expgui(fm).option.menu.asort 2700 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ 2701 -label number -value number -variable expgui(asorttype) 2702 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ 2703 -label type -value type -variable expgui(asorttype) 2704 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ 2705 -label x -value x -variable expgui(asorttype) 2706 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ 2707 -label y -value y -variable expgui(asorttype) 2708 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ 2709 -label z -value z -variable expgui(asorttype) 2710 2711 2712 $expgui(fm).option.menu add cascade -menu $expgui(fm).option.menu.hsort \ 2713 -label "Sort histograms by" 2714 2715 set expgui(hsorttype) number 2716 menu $expgui(fm).option.menu.hsort 2717 $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ 2718 -label number -value number -variable expgui(hsorttype) 2719 $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ 2720 -label "Histogram type" -value type -variable expgui(hsorttype) 2721 $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ 2722 -label "Bank #" -value bank -variable expgui(hsorttype) 2723 $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ 2724 -label "Angle/Wavelength" -value angle -variable expgui(hsorttype) 2725 2620 2726 #---- Global mode menu button 2621 menubutton $expgui(fm).edit -text "Global mode" -underline 0\2622 - menu $expgui(fm).edit.menu2623 menu $expgui(fm). edit.menu2624 $expgui(fm). edit.menuadd radiobutton -label "Off" \2727 $expgui(fm).option.menu add cascade -menu $expgui(fm).option.menu.editmode \ 2728 -label "Global mode" 2729 menu $expgui(fm).option.menu.editmode 2730 $expgui(fm).option.menu.editmode add radiobutton -label "Off" \ 2625 2731 -variable expgui(globalmode) -underline 0 -value 0\ 2626 2732 -command sethistlist 2627 $expgui(fm). edit.menuadd radiobutton -label "All" \2733 $expgui(fm).option.menu.editmode add radiobutton -label "All" \ 2628 2734 -variable expgui(globalmode) -underline 0 -value 6 \ 2629 2735 -command sethistlist 2630 $expgui(fm). edit.menuadd radiobutton -label "TOF" \2736 $expgui(fm).option.menu.editmode add radiobutton -label "TOF" \ 2631 2737 -variable expgui(globalmode) -underline 0 -value 1 \ 2632 2738 -command sethistlist 2633 $expgui(fm). edit.menuadd radiobutton -label "CW Neutron" \2739 $expgui(fm).option.menu.editmode add radiobutton -label "CW Neutron" \ 2634 2740 -variable expgui(globalmode) -underline 0 -value 2 \ 2635 2741 -command sethistlist 2636 $expgui(fm). edit.menuadd radiobutton -label "Alpha12 Xray" \2742 $expgui(fm).option.menu.editmode add radiobutton -label "Alpha12 Xray" \ 2637 2743 -variable expgui(globalmode) -underline 0 -value 3 \ 2638 2744 -command sethistlist 2639 $expgui(fm). edit.menuadd radiobutton -label "Monochromatic Xray" \2745 $expgui(fm).option.menu.editmode add radiobutton -label "Monochromatic Xray" \ 2640 2746 -variable expgui(globalmode) -underline 0 -value 4 \ 2641 2747 -command sethistlist 2642 $expgui(fm). edit.menuadd radiobutton -label "Energy Disp Xray" \2748 $expgui(fm).option.menu.editmode add radiobutton -label "Energy Disp Xray" \ 2643 2749 -variable expgui(globalmode) -underline 0 -value 5 \ 2644 2750 -command sethistlist 2645 2751 set expgui(globalmode) 0 2646 #---- options menu button 2647 menubutton $expgui(fm).atom -text Options -underline 0 \ 2648 -menu $expgui(fm).atom.menu 2649 menu $expgui(fm).atom.menu 2650 $expgui(fm).atom.menu add cascade -menu $expgui(fm).atom.menu.asort \ 2651 -label "Sort atoms by" 2652 2653 set expgui(asorttype) number 2654 menu $expgui(fm).atom.menu.asort 2655 $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ 2656 -label number -value number -variable expgui(asorttype) 2657 $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ 2658 -label type -value type -variable expgui(asorttype) 2659 $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ 2660 -label x -value x -variable expgui(asorttype) 2661 $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ 2662 -label y -value y -variable expgui(asorttype) 2663 $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ 2664 -label z -value z -variable expgui(asorttype) 2665 2666 2667 $expgui(fm).atom.menu add cascade -menu $expgui(fm).atom.menu.hsort \ 2668 -label "Sort histograms by" 2669 2670 set expgui(hsorttype) number 2671 menu $expgui(fm).atom.menu.hsort 2672 $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ 2673 -label number -value number -variable expgui(hsorttype) 2674 $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ 2675 -label "Histogram type" -value type -variable expgui(hsorttype) 2676 $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ 2677 -label "Bank #" -value bank -variable expgui(hsorttype) 2678 $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ 2679 -label "Angle/Wavelength" -value angle -variable expgui(hsorttype) 2680 2681 pack $expgui(fm).file $expgui(fm).edit $expgui(fm).atom \ 2682 -side left -in $expgui(fm) 2752 2753 pack $expgui(fm).file $expgui(fm).option -side left -in $expgui(fm) 2683 2754 pack $expgui(fm).help -side right -in $expgui(fm) 2684 2755
Note: See TracChangeset
for help on using the changeset viewer.