Changeset 770 for trunk/fillcif.tcl


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

# on 2004/01/30 00:41:11, toby did:
update to match new version of CIFEDIT etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/fillcif.tcl

    • Property rcs:date changed from 2003/08/11 19:23:12 to 2004/01/30 00:41:11
    • Property rcs:lines changed from +6 -6 to +36 -47
    • Property rcs:rev changed from 1.5 to 1.6
    r727 r770  
    1919#      this file (Included with EXPGUI)
    2020#
    21 #  3) file CIF_index must be in the same directory as this file
    22 #      (Included with EXPGUI)
    23 #      This file is an index to the CIF dictionaries in use and is generated
    24 #      using routines in indexCIFdict.tcl
    25 #     note that variable CIF(cif_path) dictates where these dictionary
    26 #     files will be found and the GSAS data directory (../data/) included.
    27 #
    28 #  4) The CIF core & powder dictionaries are included in the GSAS data
     21#  3) The CIF core & powder dictionaries are included in the GSAS data
    2922#      directory (../data/), files cif_core_2.2.dic and cif_pd.dic
    3023#      (Included with GSAS/EXPGUI distribution)
    3124#
    32 5) The GSAS2CIF template files (template_instrument.cif,
     254) The GSAS2CIF template files (template_instrument.cif,
    3326#      template_phase.cif and template_publ.cif) are included in the GSAS data
    3427#      directory (../data/).
    3528#      (Included with GSAS/EXPGUI distribution)
    3629
    37 if {$tcl_version < 8.2} {
    38     tk_dialog .error {Old Tcl/Tk} \
    39             "Sorry, the CIF Browser requires version 8.2 or later of the Tcl/Tk package. This is $tcl_version" \
    40             warning 0 Sorry
    41     exit
    42 }
    43 
    44 if {[llength $argv] != 1} {
    45     set file [tk_getOpenFile -title "Select GSAS Experiment" -parent . \
    46             -defaultextension EXP -filetypes {{"GSAS experiment" .EXP}}]
    47     if {$file == ""} {exit}
    48     set prefix [file root $file]
    49 } else {
    50     set prefix $argv
    51 }
    52 
    53 if {[set dir [file dirname $prefix]] != ""} {
    54     cd $dir
    55     set prefix [file tail $prefix]
    56 }
    5730# where is this file running from?
    5831set script [info script]
     
    7548}
    7649set scriptdir [file dirname $script ]
     50
     51if {$tcl_version < 8.2} {
     52    tk_dialog .error {Old Tcl/Tk} \
     53            "Sorry, the CIF Browser requires version 8.2 or later of the Tcl/Tk package. This is $tcl_version" \
     54            warning 0 Sorry
     55    exit
     56}
     57
     58if {[llength $argv] != 1} {
     59    set file [tk_getOpenFile -title "Select GSAS Experiment" -parent . \
     60            -defaultextension EXP -filetypes {{"GSAS experiment" .EXP}}]
     61    if {$file == ""} {exit}
     62    set prefix [file root $file]
     63} else {
     64    set prefix $argv
     65}
     66
     67if {[set dir [file dirname $prefix]] != ""} {
     68    cd $dir
     69    set prefix [file tail $prefix]
     70}
    7771# used by some gsascmds routines
    7872set expgui(scriptdir) $scriptdir
     
    404398wm title $defw "CIF definitions"
    405399set CIF(defBox) $defw.t
    406 grid [text $CIF(defBox) -width 65 -xscrollcommand "$defw.x set" \
    407         -yscrollcommand "$defw.y set"] -column 0 -row 0 -sticky news
     400grid [text $CIF(defBox) -width 45 -height 18 -xscrollcommand "$defw.x set" \
     401        -yscrollcommand "$defw.y set" -wrap word] -column 0 -row 0 -sticky news
    408402grid [scrollbar $defw.y -command "$CIF(defBox) yview"] -column 1 -row 0 -sticky ns
    409403grid [scrollbar $defw.x -command "$CIF(defBox) xview" \
     
    414408wm withdraw $defw
    415409
    416 if {![file exists [file join $scriptdir CIF_index]]} {
    417     MyMessageBox -parent . -title "No CIF index" \
    418             -message "File CIF_index was not found in directory $scriptdir. Without this file, CIF definitions can not be read and editing is not recommended. See routine indexCIFdict.tcl for info on creating CIF_index" \
    419             -icon error -type {"Oh darn"} -default "oh darn"
    420 } elseif [catch {
    421     source  [file join $scriptdir CIF_index]
    422 } errmsg] {
    423     MyMessageBox -parent . -title "CIF index error" \
    424             -message "An error occured reading file CIF_index (directory $scriptdir). Without this file, CIF definitions can not be read and editing is not recommended. See routine indexCIFdict.tcl for info on creating CIF_index. Error: $errmsg" \
    425             -icon error -type {"Oh darn"} -default "oh darn"
    426 }
    427 
    428 
    429 # add location of these files & the typical GSAS data directory
    430 # to the dictionary search path
    431 lappend CIF(cif_path) $scriptdir [file join [file dirname $scriptdir] data]
     410# is there a defined list of dictionary files?
     411if {[catch {set ::CIF(dictfilelist)}]} {
     412    set dictfilelist [glob -nocomplain \
     413                          [file join $::expgui(gsasdir) data *.dic]]
     414    foreach f $dictfilelist {
     415        lappend ::CIF(dictfilelist) $f
     416        set ::CIF(dict_$f) 1
     417    }
     418}
     419# load the initial CIF dictionaries
     420LoadDictIndices
    432421
    433422# make frame for the CIF browser
Note: See TracChangeset for help on using the changeset viewer.