Changeset 1583
- Timestamp:
- Nov 25, 2014 1:36:57 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r1580 r1583 5359 5359 G2frame.dataDisplay.SetCellStyle(row,deltaChiCol,color=wx.Colour(255,255,0)) 5360 5360 G2frame.dataDisplay.InstallGridToolTip(GridSetToolTip,GridColLblToolTip) 5361 G2frame.dataDisplay.SendSizeEvent() # resize needed on mac 5362 G2frame.dataDisplay.Refresh() # shows colored text on mac 5361 5363 5362 5364 ################################################################################ -
trunk/GSASIIimgGUI.py
r1580 r1583 118 118 def OnRecalibrate(event): 119 119 G2img.ImageRecalibrate(G2frame,data,masks) 120 UpdateImageControls(G2frame,data,masks)120 wx.CallAfter(UpdateImageControls,G2frame,data,masks) 121 121 122 122 def OnClearCalib(event): … … 128 128 129 129 def OnIntegrate(event): 130 CleanupMasks(masks) 130 131 blkSize = 128 #this seems to be optimal; will break in polymask if >1024 131 132 Nx,Ny = data['size'] … … 220 221 G2frame.PatternTree.SetItemPyData( 221 222 G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Masks'),Masks) 223 CleanupMasks(Masks) 222 224 if len(backImage): 223 225 G2frame.Integrate = G2img.ImageIntegrate(image+backImage,Data,Masks,blkSize,dlgp) … … 338 340 data.update(save) 339 341 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Image Controls'),copy.deepcopy(data)) 340 UpdateImageControls(G2frame,data,masks)342 wx.CallAfter(UpdateImageControls,G2frame,data,masks) 341 343 G2plt.PlotExposedImage(G2frame,event=event) 342 344 … … 627 629 data['fullIntegrate'] = True 628 630 data['LRazimuth'] = [Lazm,Lazm+360] 629 UpdateImageControls(G2frame,data,masks)631 wx.CallAfter(UpdateImageControls,G2frame,data,masks) 630 632 G2plt.PlotExposedImage(G2frame,event=event) 631 633 … … 1022 1024 ##### Masks 1023 1025 ################################################################################ 1026 def CleanupMasks(data): 1027 '''If a mask creation is not completed, an empty mask entry is created in the 1028 masks array. This cleans them out. It is called when the masks page is first loaded 1029 and before saving them or after reading them in. This should also probably be done 1030 before they are used for integration. 1031 ''' 1032 for key in ['Points','Rings','Arcs','Polygons']: 1033 data[key] = data.get(key,[]) 1034 l1 = len(data[key]) 1035 data[key] = [i for i in data[key] if i] 1036 l2 = len(data[key]) 1037 if GSASIIpath.GetConfigValue('debug') and l1 != l2: 1038 print 'Mask Cleanup:',key,'was',l1,'entries','now',l2 1024 1039 1025 1040 def UpdateMasks(G2frame,data): … … 1086 1101 1087 1102 def OnSaveMask(event): 1103 CleanupMasks(data) 1088 1104 dlg = wx.FileDialog(G2frame, 'Choose image mask file', '.', '', 1089 1105 'image mask files (*.immask)|*.immask',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT|wx.CHANGE_DIR) … … 1126 1142 save[key][1][1] = min(oldThreshold[1],save[key][1][1]) 1127 1143 S = File.readline() 1144 File.close() 1128 1145 data.update(save) 1146 CleanupMasks(data) 1129 1147 wx.CallAfter(UpdateMasks,G2frame,data) 1130 1148 G2plt.PlotExposedImage(G2frame,event=event) 1131 File.close()1132 1149 finally: 1133 1150 dlg.Destroy() … … 1162 1179 startScroll = G2frame.dataDisplay.GetScrollPos(wx.VERTICAL) # save scroll position 1163 1180 G2frame.dataDisplay.Destroy() 1181 else: 1182 CleanupMasks(data) # posting page for 1st time; clean out anything unfinished 1164 1183 G2gd.SetDataMenuBar(G2frame,G2frame.dataFrame.MaskMenu) 1165 1184 G2frame.dataFrame.Bind(wx.EVT_MENU, OnCopyMask, id=G2gd.wxID_MASKCOPY) -
trunk/GSASIIplot.py
r1582 r1583 210 210 211 211 class GSASIItoolbar(Toolbar): 212 ' needs a doc string'212 'Override the matplotlib toolbar so we can add more icons' 213 213 ON_MPL_HELP = wx.NewId() 214 214 ON_MPL_KEY = wx.NewId() 215 arrows = {} 216 for direc in ('left','right','up','down','Expand X', 217 'Expand Y','Shrink X','Shrink Y'): 218 arrows[direc] = wx.NewId() 215 219 def __init__(self,plotCanvas): 220 '''Adds additional icons to toolbar''' 216 221 Toolbar.__init__(self,plotCanvas) 217 POSITION_OF_CONFIGURE_SUBPLOTS_BTN = 6 222 self.plotCanvas = plotCanvas 223 POSITION_OF_CONFIGURE_SUBPLOTS_BTN = 6 # remove one button 218 224 self.DeleteToolByPos(POSITION_OF_CONFIGURE_SUBPLOTS_BTN) 219 225 parent = self.GetParent() … … 224 230 self.AddSimpleTool(self.ON_MPL_HELP,_load_bitmap(help),'Help on','Show help on') 225 231 wx.EVT_TOOL(self,self.ON_MPL_HELP,self.OnHelp) 232 # add arrow keys to control zooming 233 for direc in ('left','right','up','down'): 234 wx.EVT_TOOL(self,self.arrows[direc],self.OnArrow) 235 icon = os.path.join(os.path.split(__file__)[0],direc[0]+'arrow.ico') 236 self.AddSimpleTool(self.arrows[direc],_load_bitmap(icon), 237 'Shift '+direc,'Shift plot '+direc) 238 for direc in ('Expand X','Expand Y','Shrink X','Shrink Y'): 239 fil = ''.join([i[0].lower() for i in direc.split()]+['arrow.ico']) 240 wx.EVT_TOOL(self,self.arrows[direc],self.OnArrow) 241 icon = os.path.join(os.path.split(__file__)[0],fil) 242 self.AddSimpleTool(self.arrows[direc],_load_bitmap(icon), 243 direc,'Zoom: '+direc) 244 def OnArrow(self,event): 245 'reposition limits to scan or zoom by button press' 246 ax = self.plotCanvas.figure.get_axes()[0] 247 xmin,xmax,ymin,ymax = ax.axis() 248 #print xmin,xmax,ymin,ymax 249 if event.Id == self.arrows['right']: 250 delta = (xmax-xmin)/10. 251 xmin -= delta 252 xmax -= delta 253 elif event.Id == self.arrows['left']: 254 delta = (xmax-xmin)/10. 255 xmin += delta 256 xmax += delta 257 elif event.Id == self.arrows['up']: 258 delta = (ymax-ymin)/10. 259 ymin -= delta 260 ymax -= delta 261 elif event.Id == self.arrows['down']: 262 delta = (ymax-ymin)/10. 263 ymin += delta 264 ymax += delta 265 elif event.Id == self.arrows['Expand X']: 266 delta = (xmax-xmin)/10. 267 #xmin += delta 268 xmax -= delta 269 elif event.Id == self.arrows['Expand Y']: 270 delta = (ymax-ymin)/10. 271 #ymin += delta 272 ymax -= delta 273 elif event.Id == self.arrows['Shrink X']: 274 delta = (xmax-xmin)/10. 275 #xmin -= delta 276 xmax += delta 277 elif event.Id == self.arrows['Shrink Y']: 278 delta = (ymax-ymin)/10. 279 #ymin -= delta 280 ymax += delta 281 else: 282 # should not happen! 283 GSASIIpath.IPyBreak() 284 ax.axis((xmin,xmax,ymin,ymax)) 285 #print xmin,xmax,ymin,ymax 286 self.plotCanvas.figure.canvas.draw() 287 226 288 def OnHelp(self,event): 227 ' needs a doc string'289 'Respond to press of help button on plot toolbar' 228 290 Page = self.GetParent().GetParent() 229 291 pageNo = Page.GetSelection() … … 232 294 G2gd.ShowHelp(bookmark,self.TopLevelParent) 233 295 def OnKey(self,event): 234 'needs a doc string' 296 '''Provide user with list of keystrokes defined for plot as well as an 297 alternate way to access the same functionality 298 ''' 235 299 parent = self.GetParent() 236 300 if parent.Choice: … … 945 1009 G2frame.Interpolate = 'nearest' 946 1010 dlg.Destroy() 947 1011 else: 1012 print 'no binding for key',event.key 1013 #GSASIIpath.IPyBreak() 1014 return 948 1015 wx.CallAfter(PlotPatterns,G2frame,newPlot=newPlot,plotType=plottype) 949 1016
Note: See TracChangeset
for help on using the changeset viewer.