Changeset 1580
- Timestamp:
- Nov 21, 2014 4:12:53 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r1571 r1580 101 101 ] = [wx.NewId() for item in range(8)] 102 102 103 [ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD, wxID_NEWMASKSPOT,wxID_NEWMASKARC,wxID_NEWMASKRING,104 wxID_NEWMASKFRAME, wxID_NEWMASKPOLY, 105 ] = [wx.NewId() for item in range( 8)]103 [ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD, wxID_NEWMASKSPOT,wxID_NEWMASKARC,wxID_NEWMASKRING, 104 wxID_NEWMASKFRAME, wxID_NEWMASKPOLY, wxID_MASKLOADNOT, 105 ] = [wx.NewId() for item in range(9)] 106 106 107 107 [ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_STRSTSAMPLE, … … 261 261 wx.TreeCtrl.Bind(self,eventtype,handler,*args,**kwargs) 262 262 263 # def GetItemPyData(self,*args,**kwargs): 264 # '''Override the standard method to wrap the contents 265 # so that the source can be tracked 266 # ''' 267 # data = super(self.__class__,self).GetItemPyData(*args,**kwargs) 268 # textlist = self._getTreeItemsList(args[0]) 269 # if type(data) is dict: 270 # return log.dictLogged(data,textlist) 271 # if type(data) is list: 272 # return log.listLogged(data,textlist) 273 # if type(data) is tuple: #N.B. tuples get converted to lists 274 # return log.listLogged(list(data),textlist) 275 # return data 263 # commented out, disables Logging 264 # def GetItemPyData(self,*args,**kwargs): 265 # '''Override the standard method to wrap the contents 266 # so that the source can be logged when changed 267 # ''' 268 # data = super(self.__class__,self).GetItemPyData(*args,**kwargs) 269 # textlist = self._getTreeItemsList(args[0]) 270 # if type(data) is dict: 271 # return log.dictLogged(data,textlist) 272 # if type(data) is list: 273 # return log.listLogged(data,textlist) 274 # if type(data) is tuple: #N.B. tuples get converted to lists 275 # return log.listLogged(list(data),textlist) 276 # return data 276 277 277 278 def GetRelativeHistNum(self,histname): … … 358 359 in the object, and are looked up rather than directly set with a bind. 359 360 An index to these buttons is saved as log.ButtonBindingLookup 361 :param wx.Panel parent: parent widget 362 :param int id: Id for button 363 :param str label: label for button 364 :param str locationcode: a label used internally to uniquely indentify the button 365 :param function handler: a routine to call when the button is pressed 360 366 ''' 361 def __init__(self,parent,id,label,locationcode,handler,*args,**kwargs): 367 def __init__(self,parent,id=wx.ID_ANY,label='',locationcode='', 368 handler=None,*args,**kwargs): 362 369 super(self.__class__,self).__init__(parent,id,label,*args,**kwargs) 363 370 self.label = label … … 3488 3495 self.MaskEdit.Append(help='Load mask from file', 3489 3496 id=wxID_MASKLOAD, kind=wx.ITEM_NORMAL,text='Load mask') 3497 self.MaskEdit.Append(help='Load mask from file; ignore threshold', 3498 id=wxID_MASKLOADNOT, kind=wx.ITEM_NORMAL,text='Load mask w/o threshold') 3490 3499 submenu.Append(help='Create an arc mask with mouse input', 3491 3500 id=wxID_NEWMASKARC, kind=wx.ITEM_NORMAL,text='Arc mask') … … 4042 4051 def GetTypeName(self, row, col): 4043 4052 try: 4053 if self.data[row][col] is None: return None 4044 4054 return self.dataTypes[col] 4045 4055 except TypeError: … … 4048 4058 def GetValue(self, row, col): 4049 4059 try: 4060 if self.data[row][col] is None: return "" 4050 4061 return self.data[row][col] 4051 4062 except IndexError: … … 4557 4568 SeqFile.write(line+'\n') 4558 4569 4570 # start of OnSaveSelSeq code 4559 4571 cols = sorted(G2frame.dataDisplay.GetSelectedCols()) # ignore selection order 4560 4572 nrows = G2frame.SeqTable.GetNumberRows() … … 5046 5058 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree() 5047 5059 Controls = G2frame.PatternTree.GetItemPyData(GetPatternTreeItemId(G2frame,G2frame.root,'Controls')) 5048 # create a place to store Pseudo Vars & Parametric Fit functions, if n eeded5060 # create a place to store Pseudo Vars & Parametric Fit functions, if not present 5049 5061 if 'SeqPseudoVars' not in Controls: Controls['SeqPseudoVars'] = {} 5050 5062 if 'SeqParFitEqList' not in Controls: Controls['SeqParFitEqList'] = [] … … 5126 5138 EnableParFitEqMenus() 5127 5139 5140 VaryListChanges = [] 5141 prevVaryList = [] 5142 combinedVaryList = [] 5143 firstValueList = [] 5144 for i,name in enumerate(histNames): 5145 if i == 0 or prevVaryList != sorted(data[name]['varyList']): 5146 if GSASIIpath.GetConfigValue('debug'): 5147 print 'VaryList changes at',name 5148 print data[name]['varyList'] 5149 print data[name]['variables'] 5150 # add variables to list as they appear 5151 for j,var in enumerate(data[name]['varyList']): 5152 if var in combinedVaryList: continue 5153 combinedVaryList.append(data[name]['varyList'][j]) 5154 firstValueList.append(data[name]['variables'][j]) 5155 prevVaryList = sorted(data[name]['varyList']) 5156 VaryListChanges += [name] 5128 5157 #----------------------------------------------------------------------------------- 5129 5158 # build up the data table by columns ----------------------------------------------- … … 5155 5184 for i,name in enumerate(histNames): 5156 5185 sampleDict[name] = dict(zip(sampleParms.keys(),[sampleParms[key][i] for key in sampleParms.keys()])) 5157 # add unique cell parameters 5186 # add unique cell parameters TODO: review this where the cell symmetry changes (when possible) 5158 5187 if Controls.get('ShowCell',False): 5159 5188 for pId in sorted(RecpCellTerms): … … 5189 5218 colSigs += zip(*cellESDs) 5190 5219 # add the variables that were refined; change from rows to columns 5191 colList += zip(*[data[name]['variables'] for name in histNames]) 5192 colLabels += data[histNames[0]]['varyList'] 5193 Types += len(data[histNames[0]]['varyList'])*[wg.GRID_VALUE_FLOAT] 5194 colSigs += zip(*[data[name]['sig'] for name in histNames]) 5195 5220 #colList += zip(*[data[name]['variables'] for name in histNames]) 5221 #colLabels += data[histNames[0]]['varyList'] 5222 #Types += len(data[histNames[0]]['varyList'])*[wg.GRID_VALUE_FLOAT] 5223 #colSigs += zip(*[data[name]['sig'] for name in histNames]) 5224 for var in combinedVaryList: 5225 colLabels += [var] 5226 Types += [wg.GRID_VALUE_FLOAT] 5227 vals = [] 5228 sigs = [] 5229 for name in histNames: 5230 try: 5231 i = data[name]['varyList'].index(var) 5232 vals.append(data[name]['variables'][i]) 5233 sigs.append(data[name]['sig'][i]) 5234 except ValueError: # var not in list 5235 vals.append(None) 5236 sigs.append(None) 5237 colList += [vals] 5238 colSigs += [sigs] 5239 5196 5240 # tabulate constrained variables, removing histogram numbers if needed 5197 5241 # from parameter label -
trunk/GSASIIimgGUI.py
r1579 r1580 1032 1032 1033 1033 def Replot(*args,**kwargs): 1034 print 'Replot'1035 1034 G2plt.PlotExposedImage(G2frame) 1036 1035 … … 1102 1101 1103 1102 def OnLoadMask(event): 1103 if event.Id == G2gd.wxID_MASKLOADNOT: 1104 ignoreThreshold = True 1105 else: 1106 ignoreThreshold = False 1104 1107 dlg = wx.FileDialog(G2frame, 'Choose image mask file', '.', '', 1105 1108 'image mask files (*.immask)|*.immask',wx.OPEN|wx.CHANGE_DIR) … … 1117 1120 [key,val] = S[:-1].split(':') 1118 1121 if key in ['Points','Rings','Arcs','Polygons','Frames','Thresholds']: 1122 if ignoreThreshold and key == 'Thresholds': continue 1119 1123 save[key] = eval(val) 1120 1124 if key == 'Thresholds': … … 1161 1165 G2frame.dataFrame.Bind(wx.EVT_MENU, OnCopyMask, id=G2gd.wxID_MASKCOPY) 1162 1166 G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadMask, id=G2gd.wxID_MASKLOAD) 1167 G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadMask, id=G2gd.wxID_MASKLOADNOT) 1163 1168 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveMask, id=G2gd.wxID_MASKSAVE) 1164 1169 G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewSpotMask, id=G2gd.wxID_NEWMASKSPOT)
Note: See TracChangeset
for help on using the changeset viewer.