Changeset 935 for trunk/expgui


Ignore:
Timestamp:
Mar 3, 2010 9:27:00 AM (11 years ago)
Author:
toby
Message:

EXPGUI:

  • Implement routine to locate window where user wants (see LocateWindow?)
  • allow pgplot in gsas/pgl or gsas/pgplot

Import_cif: make sure that missing or defaulted values for Uiso & occ are set to valid values.

gsascmds:

  • implement LocateWindow?
  • update to use saved pgplot location: $expgui(pgplotdir)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    r930 r935  
    223223    }
    224224}
    225 # do we have a PGPLOT fonts file?
    226 # if it is in the "wrong" place/name -- make it "right"
    227 if {![file exists [file join $expgui(gsasdir) pgl grfont.dat]] && \
    228         [file exists [file join $expgui(gsasdir) fonts grfont.dat]]} {
    229     catch {file mkdir [file join $expgui(gsasdir) pgl]}
    230     file copy [file join $expgui(gsasdir) fonts grfont.dat] \
    231             [file join $expgui(gsasdir) pgl grfont.dat]
    232 }
    233 # do we have a PGPLOT fonts file?
    234 if {![file exists [file join $expgui(gsasdir) pgl grfont.dat]] && \
    235         [file exists [file join $expgui(gsasdir) fonts pgfont.dat]]} {
    236     catch {file mkdir [file join $expgui(gsasdir) pgl]}
    237     file copy [file join $expgui(gsasdir) fonts pgfont.dat] \
    238             [file join $expgui(gsasdir) pgl grfont.dat]
    239 }
    240 # do we have a PGPLOT fonts file?
    241 if {![file exists [file join $expgui(gsasdir) pgl grfont.dat]] && \
    242         [file exists [file join $expgui(gsasdir) pgl pgfont.dat]]} {
    243     file copy [file join $expgui(gsasdir) pgl pgfont.dat] \
    244             [file join $expgui(gsasdir) pgl grfont.dat]
    245 }
    246 if ![file exists [file join $expgui(gsasdir) pgl grfont.dat]] {
     225# find the pgplot directory
     226if {[file exists [file join $expgui(gsasdir) pgl]]} {
     227    set expgui(pgplotdir) [file join $expgui(gsasdir) pgl]
     228} elseif {[file exists [file join $expgui(gsasdir) pgplot]]} {
     229    set expgui(pgplotdir) [file join $expgui(gsasdir) pgplot]
     230} else {
    247231    MyMessageBox -parent . -title "PGPLOT Error" \
    248             -message "Warning -- Unable to find file GRFONT.DAT in [file join $expgui(gsasdir) pgl]. GSAS graphics will not work. Is GSAS correctly installed?" \
     232            -message "Warning -- Unable to find PGPLOT directory. GSAS graphics will not work without this. Is GSAS correctly installed?" \
     233            -icon warning -type {"Limp Ahead"} -default "Limp Ahead" \
     234            -helplink "expguierr.html NoPGPLOT"
     235    set expgui(resize) 1
     236    set expgui(pgplotdir) ""
     237}
     238
     239# old code used to fix up bad distributions
     240# # do we have a PGPLOT fonts file?
     241# # if it is in the "wrong" place/name -- make it "right"
     242# if {![file exists [file join $expgui(pgplotdir) grfont.dat]] && \
     243#       [file exists [file join $expgui(gsasdir) fonts grfont.dat]]} {
     244#     catch {file mkdir $expgui(pgplotdir)}
     245#     file copy [file join $expgui(gsasdir) fonts grfont.dat] \
     246#           [file join $expgui(pgplotdir)  grfont.dat]
     247# }
     248# # do we have a PGPLOT fonts file?
     249# if {![file exists [file join $expgui(pgplotdir)  grfont.dat]] && \
     250#       [file exists [file join $expgui(gsasdir) fonts pgfont.dat]]} {
     251#     catch {file mkdir $expgui(pgplotdir)}
     252#     file copy [file join $expgui(gsasdir) fonts pgfont.dat] \
     253#           [file join $expgui(pgplotdir)  grfont.dat]
     254# }
     255# # do we have a PGPLOT fonts file?
     256# if {![file exists [file join $expgui(pgplotdir)  grfont.dat]] && \
     257#       [file exists [file join $expgui(pgplotdir)  pgfont.dat]]} {
     258#     file copy [file join $expgui(pgplotdir)  pgfont.dat] \
     259#           [file join $expgui(pgplotdir)  grfont.dat]
     260# }
     261
     262if { $expgui(pgplotdir) != "" && \
     263         ![file exists [file join $expgui(pgplotdir)  grfont.dat]]} {
     264    MyMessageBox -parent . -title "PGPLOT Error" \
     265            -message "Warning -- Unable to find file GRFONT.DAT in $expgui(pgplotdir). GSAS graphics will not work. Is GSAS correctly installed?" \
    249266            -icon warning -type {"Limp Ahead"} -default "Limp Ahead" \
    250267            -helplink "expguierr.html NoPGPLOT"
     
    282299}
    283300if {$expgui(expfile) == ""} {
    284     # center the parent window because the getExpFileName window
    285     # will be centered above it.
    286     wm withdraw .
    287     set x [expr [winfo screenwidth .]/2 - [winfo reqwidth .]/2 ]
    288     set y [expr [winfo screenheight .]/2 - [winfo reqheight .]/2]
    289     wm geom . +$x+$y
    290     wm deiconify .
     301    # place the parent window because the getExpFileName window will be centered above it.
     302    set xpos 50
     303    catch {set xpos $expgui(xpos)}
     304    set ypos 50
     305    catch {set ypos $expgui(ypos)}
     306    set poscntr "nsew"
     307    catch {set posnctr $expgui(poscenter)}
     308    LocateWindow "." $xpos $ypos $poscntr
    291309    # windows needed this update before when using tk_getOpenFile.
    292310    # I am not sure it is still needed.
     
    43904408    #wm geom . [winfo reqwidth .]x[winfo reqheight .]
    43914409    wm geom . {}
    4392     # center the EXPGUI window
    4393     wm withdraw .
    4394     set x [expr [winfo screenwidth .]/2 - [winfo reqwidth .]/2 ]
    4395     set y [expr [winfo screenheight .]/2 - [winfo reqheight .]/2]
    4396     wm geom . +$x+$y
    4397     wm deiconify .
    4398 }
    4399 
     4410}
     4411# place the EXPGUI window
     4412set xpos 50
     4413catch {set xpos $expgui(xpos)}
     4414set ypos 50
     4415catch {set ypos $expgui(ypos)}
     4416set poscntr "nsew"
     4417catch {set posnctr $expgui(poscenter)}
     4418LocateWindow "." $xpos $ypos $poscntr
     4419update
    44004420RaisePage lsFrame
    44014421if {[CountHistory] > 200} {
Note: See TracChangeset for help on using the changeset viewer.