Changeset 38fc601 in sasview
- Timestamp:
- Jun 10, 2008 3:34:46 PM (17 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 660b1e6
- Parents:
- a55fac1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
r06290c8 r38fc601 152 152 self.canvas.mpl_connect('button_press_event',self.onLeftDown) 153 153 self.canvas.mpl_connect('button_release_event',self.onLeftUp) 154 #self.canvas.mpl_connect('key_press_event',self.onKeyPress)154 155 155 156 156 self.leftdown=False … … 180 180 self.xFinal=None 181 181 self.yFinal=None 182 182 183 183 def onLeftDown(self,event): 184 184 """ left button down and ready to drag""" 185 185 self.leftdown=True 186 #self.mousemotion=False 186 187 ax = event.inaxes 187 188 if ax !=None: 188 189 x,y = event.x,event.y 190 #print "these are x %f and y %f"%(x,y) 189 191 self.xInit,self.yInit=ax.transAxes.inverse_xy_tup((x,y)) 190 192 #print "this is xInit %f this is yInit %f"%(self.xInit, self.yInit) 191 193 def onLeftUp(self,event): 192 194 """ Dragging is done """ 193 195 self.leftdown=False 196 self.mousemotion=False 194 197 self.leftup=True 195 198 """ 196 199 if self.mousemotion==True: 197 200 ax = event.inaxes … … 200 203 self.xFinal,self.yFinal=ax.transAxes.inverse_xy_tup((x,y)) 201 204 202 #print "this is xFinal %f this is yFinal %f"%(self.xFinal, self.yFinal)203 #print "this is xInit %f this is yInit %f"%(self.xInit, self.yInit)204 #print "this is xdelta %f and ydelta %f"%(xdelta,ydelta)205 205 xdelta = self.xFinal -self.xInit 206 206 ydelta = self.yFinal -self.yInit 207 207 208 if self.xscale=='log': 208 #xdelta = math.log10(self.xFinal - self.xInit)209 209 xdelta = math.log10(self.xFinal) -math.log10(self.xInit) 210 210 if self.yscale=='log': 211 211 ydelta = math.log10(self.yFinal) -math.log10(self.yInit) 212 212 self.dragHelper(xdelta,ydelta) 213 print "this is xInit %f this is xFinal %f \n"%(self.xInit, self.xFinal) 214 print "this is yInit %f this is yFinal %f \n"%(self.yInit, self.yFinal) 215 print "this is xdelta %f and ydelta %f \n"%(xdelta,ydelta) 213 216 else: 214 217 self.dragHelper(0,0) 218 219 """ 215 220 def onMouseMotion(self,event): 216 if self.leftdown==True:217 self.mousemotion=True221 self.mousemotion=True 222 if self.leftdown==True and self.mousemotion==True: 218 223 224 ax = event.inaxes 225 if ax !=None: 226 x,y = event.x,event.y 227 self.xFinal,self.yFinal=ax.transAxes.inverse_xy_tup((x,y)) 228 229 xdelta = self.xFinal -self.xInit 230 ydelta = self.yFinal -self.yInit 231 232 if self.xscale=='log': 233 xdelta = math.log10(self.xFinal) -math.log10(self.xInit) 234 if self.yscale=='log': 235 ydelta = math.log10(self.yFinal) -math.log10(self.yInit) 236 self.dragHelper(xdelta,ydelta) 237 print "this is xInit %f this is xFinal %f \n"%(self.xInit, self.xFinal) 238 print "this is yInit %f this is yFinal %f \n"%(self.yInit, self.yFinal) 239 print "this is xdelta %f and ydelta %f \n"%(xdelta,ydelta) 240 else: 241 self.dragHelper(0,0) 219 242 def dragHelper(self,xdelta,ydelta): 220 243 """ dragging occurs here""" … … 234 257 else: 235 258 ax.set_xlim(newlo,newhi) 236 print "new lo %f and new hi %f"%(newlo,newhi)259 #print "new lo %f and new hi %f"%(newlo,newhi) 237 260 238 261 lo,hi= ax.get_ylim() 239 print "y lo %f and y hi %f"%(lo,hi)262 #print "y lo %f and y hi %f"%(lo,hi) 240 263 newlo,newhi= lo- ydelta, hi- ydelta 241 264 if self.yscale=='log': … … 244 267 if hi > 0: 245 268 newhi= math.log10(hi)-ydelta 246 print "new lo %f and new hi %f"%(newlo,newhi)269 #print "new lo %f and new hi %f"%(newlo,newhi) 247 270 if self.yscale=='log': 248 271 ax.set_ylim(math.pow(10,newlo),math.pow(10,newhi))
Note: See TracChangeset
for help on using the changeset viewer.