Changeset 1583 for trunk/GSASIIplot.py
- Timestamp:
- Nov 25, 2014 1:36:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.