Changeset 38fc601 in sasview


Ignore:
Timestamp:
Jun 10, 2008 1:34:46 PM (16 years ago)
Author:
Gervaise Alina <gervyh@…>
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
Message:

more changes on the dragging .the user can see the picture move more slowly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guitools/PlotPanel.py

    r06290c8 r38fc601  
    152152        self.canvas.mpl_connect('button_press_event',self.onLeftDown) 
    153153        self.canvas.mpl_connect('button_release_event',self.onLeftUp) 
    154         #self.canvas.mpl_connect('key_press_event',self.onKeyPress) 
     154         
    155155        
    156156        self.leftdown=False 
     
    180180        self.xFinal=None 
    181181        self.yFinal=None 
    182     
     182   
    183183    def onLeftDown(self,event):  
    184184        """ left button down and ready to drag""" 
    185185        self.leftdown=True 
     186        #self.mousemotion=False 
    186187        ax = event.inaxes 
    187188        if ax !=None: 
    188189            x,y = event.x,event.y 
     190            #print "these are x %f and y %f"%(x,y) 
    189191            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) 
    191193    def onLeftUp(self,event):  
    192194        """ Dragging is done """ 
    193          
     195        self.leftdown=False 
     196        self.mousemotion=False  
    194197        self.leftup=True 
    195          
     198        """ 
    196199        if self.mousemotion==True: 
    197200            ax = event.inaxes 
     
    200203                self.xFinal,self.yFinal=ax.transAxes.inverse_xy_tup((x,y)) 
    201204                 
    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) 
    205205                xdelta = self.xFinal -self.xInit 
    206206                ydelta = self.yFinal -self.yInit 
     207                 
    207208                if self.xscale=='log': 
    208                     #xdelta = math.log10(self.xFinal - self.xInit) 
    209209                    xdelta = math.log10(self.xFinal) -math.log10(self.xInit) 
    210210                if self.yscale=='log': 
    211211                    ydelta = math.log10(self.yFinal) -math.log10(self.yInit) 
    212212                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) 
    213216            else: 
    214217                self.dragHelper(0,0) 
     218                 
     219               """ 
    215220    def onMouseMotion(self,event):  
    216         if self.leftdown==True: 
    217             self.mousemotion=True  
     221        self.mousemotion=True  
     222        if self.leftdown==True and self.mousemotion==True: 
    218223             
     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) 
    219242    def dragHelper(self,xdelta,ydelta): 
    220243        """ dragging occurs here""" 
     
    234257            else: 
    235258                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) 
    237260             
    238261            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) 
    240263            newlo,newhi= lo- ydelta, hi- ydelta 
    241264            if self.yscale=='log': 
     
    244267                if hi > 0: 
    245268                    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) 
    247270            if  self.yscale=='log': 
    248271                ax.set_ylim(math.pow(10,newlo),math.pow(10,newhi)) 
Note: See TracChangeset for help on using the changeset viewer.