Changeset 1413
- Timestamp:
- Jul 6, 2014 12:53:47 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r1399 r1413 56 56 install_with_easyinstall('PyOpenGl') 57 57 print('*******************************************************') 58 print('OpenGL has been installed. Please restartGSAS-II')58 print('OpenGL has been installed. Restarting GSAS-II') 59 59 print('*******************************************************') 60 loc = os.path.dirname(__file__) 61 subprocess.Popen([sys.executable,os.path.join(loc,'GSASII.py')]) 60 62 sys.exit() 61 63 -
trunk/GSASIIElem.py
r1392 r1413 205 205 xsec = open(filename,'Ur') 206 206 except: 207 print '**** ERROR - File Xsect.dat not found in directory %s' % sys.path[0]207 print '**** ERROR - File Xsect.dat not found in directory %s' % os.path.split(filename)[0] 208 208 sys.exit() 209 209 S = '1' -
trunk/GSASIIexprGUI.py
r1396 r1413 19 19 the user is asked to assign parameters from the dictionary to each variable. 20 20 21 Default expressions are read from file DefaultExpressions.txt using 22 :func:`GSASIIpath.LoadConfigFile`. 23 21 24 ''' 22 25 import re 23 26 import sys 24 27 import wx 28 import os.path 25 29 import wx.lib.scrolledpanel as wxscroll 26 30 import numpy as np 31 import GSASIIpath 32 GSASIIpath.SetVersionNumber("$Revision$") 27 33 import GSASIIgrid as G2gd 28 34 import GSASIIpy3 as G2py3 … … 60 66 return parmLists 61 67 68 #========================================================================== 69 defaultExpressions = None 70 def LoadDefaultExpressions(): 71 '''Read a configuration file with default expressions from all files named 72 DefaultExpressions.txt found in the path. Duplicates are removed and 73 expressions are sorted alphabetically 74 ''' 75 global defaultExpressions 76 if defaultExpressions is not None: return # run this routine only once 77 defaultExpressions = sorted(list(set(GSASIIpath.LoadConfigFile('DefaultExpressions.txt')))) 78 62 79 #========================================================================== 63 80 class ExpressionDialog(wx.Dialog): … … 148 165 self.usedVars = usedVars 149 166 'variable names that have been used and should not be reused by default' 167 defSize = (620,340) # seems like a good size 168 'Starting size for dialog' 150 169 151 170 # process dictionary of values and create an index … … 164 183 self.timer = wx.Timer() 165 184 self.timer.Bind(wx.EVT_TIMER,self.OnValidate) 166 185 LoadDefaultExpressions() 167 186 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER 168 wx.Dialog.__init__(self, parent, wx.ID_ANY, wintitle, style=style )187 wx.Dialog.__init__(self, parent, wx.ID_ANY, wintitle, style=style, size=defSize) 169 188 self.mainsizer = wx.BoxSizer(wx.VERTICAL) 170 189 label = wx.StaticText(self, wx.ID_ANY, header) … … 194 213 self.exsizer.Add(label, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) 195 214 196 self.exCtrl = wx.TextCtrl(self, wx.ID_ANY, size=(150,-1),style=wx.TE_PROCESS_ENTER) 215 #self.exCtrl = wx.TextCtrl(self, wx.ID_ANY, size=(150,-1),style=wx.TE_PROCESS_ENTER) 216 self.exCtrl = wx.ComboBox(self, wx.ID_ANY, "", (90, 50), (160, -1), 217 defaultExpressions, 218 wx.CB_DROPDOWN| wx.TE_PROCESS_ENTER 219 ) 197 220 self.exCtrl.Bind(wx.EVT_CHAR, self.OnChar) 221 self.exCtrl.Bind(wx.EVT_COMBOBOX, self.OnValidate) 198 222 self.exCtrl.Bind(wx.EVT_TEXT_ENTER, self.OnValidate) 199 223 self.exsizer.Add(self.exCtrl, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0) … … 253 277 self.exCtrl.SetValue(self.expr) 254 278 self.OnValidate(None) 255 self.SetMinSize( (620,300)) # seems like a good size279 self.SetMinSize(defSize) 256 280 #self.errbox.SetAutoLayout(1) 257 281 #self.errbox.SetupScrolling() … … 288 312 ''' 289 313 self.Layout() 290 self.mainsizer.Fit(self)314 #self.mainsizer.Fit(self) 291 315 self.SendSizeEvent() # force repaint 292 316 if self.ShowModal() == wx.ID_OK: … … 483 507 self.varbox.Refresh() 484 508 self.Layout() 485 self.mainsizer.Fit(self)509 #self.mainsizer.Fit(self) 486 510 self.SendSizeEvent() # force repaint 487 511 return -
trunk/GSASIIpath.py
r1355 r1413 83 83 return version 84 84 85 def LoadConfigFile(filename): 86 '''Read a GSAS-II configuration file. 87 Comments (starting with "%") are removed, as are empty lines 88 89 :param str filename: base file name (such as 'file.dat'). Files with this name 90 are located from the path and the contents of each are concatenated. 91 :returns: a list containing each non-empty (after removal of comments) line 92 found in every matching config file. 93 ''' 94 info = [] 95 for path in sys.path: 96 fil = os.path.join(path,filename) 97 if not os.path.exists(fil): continue 98 try: 99 i = 0 100 fp = open(fil,'r') 101 for line in fp: 102 expr = line.split('#')[0].strip() 103 if expr: 104 info.append(expr) 105 i += 1 106 print(str(i)+' lines read from config file '+fil) 107 finally: 108 fp.close() 109 return info 110 111 85 112 # routines to interface with subversion 86 113 def whichsvn():
Note: See TracChangeset
for help on using the changeset viewer.