Changeset 1143 for trunk/GSASIIgrid.py
- Timestamp:
- Nov 10, 2013 8:32:26 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r1138 r1143 141 141 142 142 VERY_LIGHT_GREY = wx.Colour(235,235,235) 143 143 DefaultControls = { 144 'deriv type':'analytic Hessian', #default controls 145 'min dM/M':0.0001,'shift factor':1.,'max cyc':3,'F**2':True, 146 'minF/sig':0, 147 'Author':'no name', 148 'FreeVar1':'Sample humidity (%)', 149 'FreeVar2':'Sample voltage (V)', 150 'FreeVar3':'Applied load (MN)', 151 } 144 152 ################################################################################ 145 153 #### GSAS-II class definitions … … 314 322 else: 315 323 self.invalid = True 316 wx.TextCtrl.SetValue(self,str( val))324 wx.TextCtrl.SetValue(self,str(G2py3.FormatValue(val))) 317 325 else: 318 326 wx.TextCtrl.SetValue(self,str(val)) … … 397 405 if not self.evaluated: return # true when an expression is evaluated 398 406 if self.result is not None: # retrieve the stored result 399 val = self.result[self.key] 400 self.SetValue(G2py3.FormatValue(val)) 407 self.SetValue(self.result[self.key]) 401 408 self.evaluated = False # expression has been recast as value, reset flag 402 409 … … 716 723 self.dct[self.item] = self.values[0] # unknown 717 724 725 ################################################################################ 726 class G2CheckBox(wx.CheckBox): 727 '''A customized version of a CheckBox that automatically initializes 728 the control to match a supplied 729 730 :param wx.Panel parent: name of panel or frame that will be 731 the parent to the TextCtrl. Can be None. 732 :param str label: text to put on check button 733 :param dict/list loc: the dict or list with the initial value to be 734 placed in the CheckBox. 735 :param int/str key: the dict key or the list index for the value to be 736 edited by the CheckBox. The ``loc[key]`` element must exist. 737 The CheckBox will be initialized from this value. 738 If the value is anything other that True (or 1), it will be taken as 739 False. 740 ''' 741 def __init__(self,parent,label,loc,key): 742 wx.CheckBox.__init__(self,parent,id=wx.ID_ANY,label=label) 743 self.loc = loc 744 self.key = key 745 self.SetValue(self.loc[self.key]==True) 746 self.Bind(wx.EVT_CHECKBOX, self._OnCheckBox) 747 def _OnCheckBox(self,event): 748 self.loc[self.key] = self.GetValue() 718 749 ################################################################################ 719 750 def CallScrolledMultiEditor(parent,dictlst,elemlst,prelbl=[],postlbl=[], … … 2881 2912 if 'Author' not in data: 2882 2913 data['Author'] = 'no name' 2914 if 'FreePrm1' not in data: 2915 data['FreePrm1'] = 'Sample humidity (%)' 2916 if 'FreePrm2' not in data: 2917 data['FreePrm2'] = 'Sample voltage (V)' 2918 if 'FreePrm3' not in data: 2919 data['FreePrm3'] = 'Applied load (MN)' 2883 2920 #end patch 2884 2921 … … 3085 3122 3086 3123 def GetSampleParms(): 3087 sampleParmDict = {'Temperature':[],'Pressure':[],'Humidity':[],'Voltage':[],'Force':[],} 3124 sampleParmDict = {'Temperature':300.,'Pressure':1., 3125 'FreePrm1':0.,'FreePrm2':0.,'FreePrm3':0.,} 3088 3126 sampleParm = {} 3089 3127 for name in histNames: … … 3513 3551 data = G2frame.PatternTree.GetItemPyData(item) 3514 3552 if not data: #fill in defaults 3515 data = { 3516 #least squares controls 3517 'deriv type':'analytic Hessian','min dM/M':0.0001,'shift factor':1.0,'max cyc':3} 3553 data = copy.copy(DefaultControls) #least squares controls 3518 3554 G2frame.PatternTree.SetItemPyData(item,data) 3519 3555 for i in G2frame.Refine: i.Enable(True) … … 3668 3704 if 'Temperature' not in data: #temp fix for old gpx files 3669 3705 data = {'Scale':[1.0,True],'Type':'Debye-Scherrer','Absorption':[0.0,False],'DisplaceX':[0.0,False], 3670 'DisplaceY':[0.0,False],'Diffuse':[],'Temperature':300.,'Pressure':1.0,'Humidity':0.0,'Voltage':0.0, 3671 'Force':0.0,'Gonio. radius':200.0} 3706 'DisplaceY':[0.0,False],'Diffuse':[],'Temperature':300.,'Pressure':1.0, 3707 'FreePrm1':0.,'FreePrm2':0.,'FreePrm3':0., 3708 'Gonio. radius':200.0} 3672 3709 G2frame.PatternTree.SetItemPyData(item,data) 3673 3710
Note: See TracChangeset
for help on using the changeset viewer.