Ignore:
Timestamp:
Nov 23, 2010 11:21:20 AM (14 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:
a54e4be
Parents:
4a2b054
Message:

working on pylint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/local_perspectives/plotting/SectorSlicer.py

    rd955bf19 r32c0841  
    22import math 
    33import wx 
    4 from copy import deepcopy 
    5  
     4#from copy import deepcopy 
    65from BaseInteractor import _BaseInteractor 
    7 from sans.guicomm.events import NewPlotEvent, StatusEvent 
    8 from sans.guicomm.events import SlicerParameterEvent,EVT_SLICER_PARS 
    9  
     6from sans.guicomm.events import NewPlotEvent 
     7from sans.guicomm.events import StatusEvent 
     8from sans.guicomm.events import SlicerParameterEvent 
     9from sans.guicomm.events import EVT_SLICER_PARS 
    1010from sans.guiframe.dataFitting import Data1D 
     11 
    1112 
    1213class SectorInteractor(_BaseInteractor): 
     
    1415    Draw a sector slicer.Allow to performQ averaging on data 2D 
    1516    """ 
    16     def __init__(self,base,axes,color='black', zorder=3): 
     17    def __init__(self, base, axes, color='black', zorder=3): 
    1718         
    1819        _BaseInteractor.__init__(self, base, axes, color=color) 
     
    2425         
    2526        ## compute qmax limit to reset the graph      
    26         x = math.pow(max(self.base.data2D.xmax,math.fabs(self.base.data2D.xmin)),2) 
    27         y = math.pow(max(self.base.data2D.ymax,math.fabs(self.base.data2D.ymin)),2) 
    28         self.qmax= math.sqrt(x + y) 
     27        x = math.pow(max(self.base.data2D.xmax,  
     28                         math.fabs(self.base.data2D.xmin)), 2) 
     29        y = math.pow(max(self.base.data2D.ymax,  
     30                         math.fabs(self.base.data2D.ymin)), 2) 
     31        self.qmax = math.sqrt(x + y) 
    2932        ## Number of points on the plot 
    3033        self.nbins = 20 
    3134        ## Angle of the middle line 
    32         self.theta2= math.pi/3 
     35        self.theta2 = math.pi/3 
    3336        ## Absolute value of the Angle between the middle line and any side line 
    34         self.phi=math.pi/12 
    35          
     37        self.phi = math.pi/12 
    3638        ## Middle line 
    37         self.main_line = LineInteractor(self, self.base.subplot,color='blue', zorder=zorder, r=self.qmax, 
     39        self.main_line = LineInteractor(self, self.base.subplot, color='blue',  
     40                                        zorder=zorder, r=self.qmax, 
    3841                                           theta= self.theta2) 
    3942        self.main_line.qmax = self.qmax 
    4043        ## Right Side line 
    41         self.right_line= SideInteractor(self, self.base.subplot,color='black', zorder=zorder, 
    42                                      r=self.qmax, 
    43                                            phi= -1*self.phi, 
    44                                            theta2=self.theta2) 
     44        self.right_line = SideInteractor(self, self.base.subplot, color='black', 
     45                                          zorder=zorder, r=self.qmax, 
     46                                          phi=-1*self.phi, theta2=self.theta2) 
    4547        self.right_line.qmax = self.qmax 
    4648        ## Left Side line  
    47         self.left_line= SideInteractor(self, self.base.subplot,color='black', zorder=zorder, 
    48                                      r=self.qmax, 
    49                                            phi= self.phi, 
    50                                            theta2=self.theta2) 
     49        self.left_line = SideInteractor(self, self.base.subplot, color='black', 
     50                                        zorder=zorder, r=self.qmax, 
     51                                           phi=self.phi, theta2=self.theta2) 
    5152        self.left_line.qmax = self.qmax 
    5253        ## draw the sector                
    5354        self.update() 
    5455        self._post_data() 
    55  
    5656        ## Bind to slice parameter events 
    5757        self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 
    5858 
    59  
    6059    def _onEVT_SLICER_PARS(self, event): 
    6160        """ 
     
    6665         
    6766        """ 
    68         wx.PostEvent(self.base.parent, StatusEvent(status="SectorSlicer._onEVT_SLICER_PARS")) 
     67        wx.PostEvent(self.base.parent, 
     68                     StatusEvent(status="SectorSlicer._onEVT_SLICER_PARS")) 
    6969        event.Skip() 
    7070        if event.type == self.__class__.__name__: 
     
    9999        """ 
    100100        # Update locations   
    101         ## Check if the middle line was dragged and update the picture accordingly      
     101        ## Check if the middle line was dragged and  
     102        #update the picture accordingly      
    102103        if self.main_line.has_move: 
    103104            self.main_line.update() 
    104             self.right_line.update( delta= -self.left_line.phi/2, 
    105                                     mline= self.main_line.theta ) 
    106             self.left_line.update( delta = self.left_line.phi/2, 
    107                                    mline= self.main_line.theta ) 
     105            self.right_line.update(delta=-self.left_line.phi/2, 
     106                                    mline=self.main_line.theta) 
     107            self.left_line.update(delta=self.left_line.phi/2, 
     108                                   mline=self.main_line.theta) 
    108109        ## Check if the left side has moved and update the slicer accordingly   
    109110        if self.left_line.has_move: 
    110111            self.main_line.update() 
    111             self.left_line.update( phi=None, delta=None, mline=self.main_line , 
    112                                   side=True, left=True ) 
    113             self.right_line.update( phi= self.left_line.phi, delta= None, 
    114                                      mline= self.main_line, side= True, 
    115                                      left=False, right= True ) 
    116         ## Check if the right side line has moved and update the slicer accordingly 
     112            self.left_line.update(phi=None, delta=None, mline=self.main_line, 
     113                                  side=True, left=True) 
     114            self.right_line.update(phi=self.left_line.phi, delta=None, 
     115                                     mline=self.main_line, side=True, 
     116                                     left=False, right=True) 
     117        ## Check if the right side line has moved and  
     118        #update the slicer accordingly 
    117119        if self.right_line.has_move: 
    118120            self.main_line.update() 
    119             self.right_line.update( phi=None, delta=None, mline=self.main_line, 
    120                                    side=True, left=False, right=True ) 
    121             self.left_line.update( phi=self.right_line.phi, delta=None, 
    122                                     mline=self.main_line, side=True, left=False ) 
     121            self.right_line.update(phi=None, delta=None, mline=self.main_line, 
     122                                   side=True, left=False, right=True) 
     123            self.left_line.update(phi=self.right_line.phi, delta=None, 
     124                                    mline=self.main_line, side=True, left=False) 
    123125             
    124126    def save(self, ev): 
     
    148150        phimin =  -self.left_line.phi + self.main_line.theta 
    149151        phimax = self.left_line.phi + self.main_line.theta 
    150         
    151         if nbins==None: 
     152        if nbins == None: 
    152153            nbins = 20 
    153         sect = SectorQ(r_min= 0.0, r_max= radius , 
    154                         phi_min= phimin + math.pi, 
    155                         phi_max= phimax + math.pi, nbins=nbins) 
     154        sect = SectorQ(r_min=0.0, r_max=radius, 
     155                        phi_min=phimin + math.pi, 
     156                        phi_max=phimax + math.pi, nbins=nbins) 
    156157      
    157158        sector = sect(self.base.data2D) 
    158159        ##Create 1D data resulting from average 
    159160        
    160         if hasattr(sector,"dxl"): 
    161             dxl= sector.dxl 
     161        if hasattr(sector, "dxl"): 
     162            dxl = sector.dxl 
    162163        else: 
    163             dxl= None 
    164         if hasattr(sector,"dxw"): 
    165             dxw= sector.dxw 
     164            dxl = None 
     165        if hasattr(sector, "dxw"): 
     166            dxw = sector.dxw 
    166167        else: 
    167             dxw= None 
    168         
    169         new_plot = Data1D(x=sector.x,y=sector.y,dy=sector.dy) 
     168            dxw = None 
     169        new_plot = Data1D(x=sector.x, y=sector.y, dy=sector.dy) 
    170170        new_plot.dxl = dxl 
    171171        new_plot.dxw = dxw 
    172         new_plot.name = "SectorQ" +"("+ self.base.data2D.name+")" 
    173          
    174         new_plot.source=self.base.data2D.source 
     172        new_plot.name = "SectorQ" + "(" + self.base.data2D.name + ")" 
     173        new_plot.source = self.base.data2D.source 
    175174        #new_plot.info=self.base.data2D.info 
    176175        new_plot.interactive = True 
    177         new_plot.detector =self.base.data2D.detector 
     176        new_plot.detector = self.base.data2D.detector 
    178177        # If the data file does not tell us what the axes are, just assume... 
    179178        new_plot.xaxis("\\rm{Q}", 'A^{-1}') 
    180         new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 
    181         new_plot.group_id = "SectorQ"+self.base.data2D.name 
    182         new_plot.id = "SectorQ"+self.base.data2D.name 
    183         new_plot.is_data= True 
     179        new_plot.yaxis("\\rm{Intensity} ", "cm^{-1}") 
     180        new_plot.group_id = "SectorQ" + self.base.data2D.name 
     181        new_plot.id = "SectorQ" + self.base.data2D.name 
     182        new_plot.is_data = True 
    184183        wx.PostEvent(self.base.parent, NewPlotEvent(plot=new_plot, 
    185                                     title="SectorQ"+self.base.data2D.name )) 
     184                                    title="SectorQ" + self.base.data2D.name)) 
    186185         
    187186    def moveend(self, ev): 
     
    227226        ## angle of the middle line 
    228227        if math.fabs(self.left_line.phi) != math.fabs(self.right_line.phi): 
    229             raise ValueError,"Phi left and phi right are different %f, %f"%(self.left_line.phi, self.right_line.phi) 
    230          
     228            msg = "Phi left and phi right are different" 
     229            msg += " %f, %f" % (self.left_line.phi, self.right_line.phi) 
     230            raise ValueError, msg 
    231231        params["Phi"] = self.main_line.theta 
    232232        params["Delta_Phi"] = math.fabs(self.left_line.phi) 
     
    243243        """ 
    244244        main = params["Phi"]  
    245         phi = math.fabs(params["Delta_Phi"] ) 
     245        phi = math.fabs(params["Delta_Phi"]) 
    246246        self.nbins = int(params["nbins"]) 
    247         self.main_line.theta= main 
     247        self.main_line.theta = main 
    248248        ## Reset the slicer parameters 
    249249        self.main_line.update() 
    250         self.right_line.update( phi=phi,delta=None, mline=self.main_line, 
    251                                side=True, right=True ) 
    252         self.left_line.update( phi=phi, delta=None, mline=self.main_line, side=True ) 
     250        self.right_line.update(phi=phi, delta=None, mline=self.main_line, 
     251                               side=True, right=True) 
     252        self.left_line.update(phi=phi, delta=None,  
     253                              mline=self.main_line, side=True) 
    253254        ## post the new corresponding data 
    254255        self._post_data(nbins=self.nbins) 
     
    278279     
    279280    """ 
    280     def __init__(self,base,axes,color='black', zorder=5, r=1.0,phi=math.pi/4, theta2= math.pi/3): 
    281          
     281    def __init__(self, base, axes, color='black', zorder=5, r=1.0, 
     282                 phi=math.pi/4, theta2= math.pi/3): 
     283        """ 
     284        """ 
    282285        _BaseInteractor.__init__(self, base, axes, color=color) 
    283286        ## Initialize the class 
     
    287290        ## the x-axis   
    288291        self.save_theta = theta2 + phi 
    289         self.theta= theta2 + phi 
     292        self.theta = theta2 + phi 
    290293        ## the value of the middle line angle with respect to the x-axis 
    291294        self.theta2 = theta2 
     
    294297        ## phi is the phase between the current line and the middle line 
    295298        self.phi = phi 
    296          
    297299        ## End points polar coordinates 
    298         x1= self.radius*math.cos(self.theta) 
    299         y1= self.radius*math.sin(self.theta) 
    300         x2= -1*self.radius*math.cos(self.theta) 
    301         y2= -1*self.radius*math.sin(self.theta) 
     300        x1 = self.radius * math.cos(self.theta) 
     301        y1 = self.radius * math.sin(self.theta) 
     302        x2 = -1 * self.radius * math.cos(self.theta) 
     303        y2 = -1 * self.radius * math.sin(self.theta) 
    302304        ## defining a new marker  
    303305        try: 
    304             self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
     306            self.inner_marker = self.axes.plot([x1/2.5], [y1/2.5], linestyle='', 
    305307                                          marker='s', markersize=10, 
    306308                                          color=self.color, alpha=0.6, 
    307309                                          pickradius=5, label="pick",  
    308                                           zorder=zorder, # Prefer this to other lines 
    309                                           visible=True)[0] 
     310                                          # Prefer this to other lines 
     311                                          zorder=zorder, visible=True)[0] 
    310312        except: 
    311313            self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
    312314                                          marker='s', markersize=10, 
    313315                                          color=self.color, alpha=0.6, 
    314                                           label="pick",  
    315                                           visible=True)[0] 
    316             message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n" 
    317             message += "Get the SVN version that is at least as recent as June 1, 2007" 
    318             owner=self.base.base.parent 
    319             wx.PostEvent(owner, StatusEvent(status="sectorSlicer: %s"%message)) 
     316                                          label="pick", visible=True)[0] 
     317            message  = "\nTHIS PROTOTYPE NEEDS THE LATEST" 
     318            message += " VERSION OF MATPLOTLIB\n Get the SVN version that" 
     319            message += " is at least as recent as June 1, 2007" 
     320            owner = self.base.base.parent 
     321            wx.PostEvent(owner,  
     322                         StatusEvent(status="sectorSlicer: %s" % message)) 
    320323         
    321324        ## Defining the current line 
    322         self.line = self.axes.plot([x1,x2],[y1,y2], 
     325        self.line = self.axes.plot([x1, x2], [y1, y2], 
    323326                                      linestyle='-', marker='', 
    324                                       color=self.color, 
    325                                       visible=True)[0] 
     327                                      color=self.color, visible=True)[0] 
    326328        ## Flag to differentiate the left line from the right line motion 
    327         self.left_moving=False 
     329        self.left_moving = False 
    328330        ## Flag to define a motion 
    329         self.has_move=False 
     331        self.has_move = False 
    330332        ## connecting markers and draw the picture 
    331333        self.connect_markers([self.inner_marker, self.line]) 
     
    364366        """ 
    365367        #print "update left or right ", self.has_move 
    366         self.left_moving=left 
    367         theta3=0 
    368         if phi !=None: 
    369             self.phi= phi 
    370         if delta==None: 
     368        self.left_moving = left 
     369        theta3 = 0 
     370        if phi != None: 
     371            self.phi = phi 
     372        if delta == None: 
    371373            delta = 0 
    372374        if  right: 
    373             self.phi = -1*math.fabs(self.phi) 
     375            self.phi = -1 * math.fabs(self.phi) 
    374376            #delta=-delta 
    375377        else: 
    376             self.phi =math.fabs(self.phi) 
     378            self.phi = math.fabs(self.phi) 
    377379        if side: 
    378             self.theta= mline.theta + self.phi 
     380            self.theta = mline.theta + self.phi 
    379381                     
    380         if mline!=None : 
    381             if delta!=0: 
    382                 self.theta2 = mline+delta 
     382        if mline != None : 
     383            if delta != 0: 
     384                self.theta2 = mline + delta 
    383385            else: 
    384386                self.theta2 = mline.theta 
    385         if delta==0: 
    386             theta3=self.theta+delta 
     387        if delta == 0: 
     388            theta3 = self.theta + delta 
    387389        else: 
    388             theta3=self.theta2+delta 
    389          
    390         x1= self.radius*math.cos(theta3) 
    391         y1= self.radius*math.sin(theta3) 
    392         x2= -1*self.radius*math.cos(theta3) 
    393         y2= -1*self.radius*math.sin(theta3) 
    394         
    395         self.inner_marker.set(xdata=[x1/2.5],ydata=[y1/2.5]) 
    396         self.line.set(xdata=[x1,x2], ydata=[y1,y2])   
     390            theta3 = self.theta2 + delta 
     391        x1 = self.radius * math.cos(theta3) 
     392        y1 = self.radius * math.sin(theta3) 
     393        x2 = -1 * self.radius * math.cos(theta3) 
     394        y2 = -1 * self.radius * math.sin(theta3) 
     395        self.inner_marker.set(xdata=[x1/2.5], ydata=[y1/2.5]) 
     396        self.line.set(xdata=[x1, x2], ydata=[y1, y2])   
    397397         
    398398    def save(self, ev): 
     
    401401        can restore on Esc. 
    402402        """ 
    403         self.save_theta= self.theta 
     403        self.save_theta = self.theta 
    404404        self.base.freeze_axes() 
    405405 
     
    407407        """ 
    408408        """ 
    409         self.has_move=False 
     409        self.has_move = False 
    410410        self.base.moveend(ev) 
    411411             
     
    420420        Process move to a new position, making sure that the move is allowed. 
    421421        """ 
    422         self.theta= math.atan2(y,x) 
    423         self.has_move=True 
     422        self.theta = math.atan2(y, x) 
     423        self.has_move = True 
    424424        #ToDo: Simplify below 
    425425        if not self.left_moving: 
    426             if  self.theta2-self.theta <= 0 and self.theta2>0:#>= self.theta2: 
     426            if  self.theta2 - self.theta <= 0 and self.theta2 > 0: 
     427                self.restore() 
     428                return  
     429            elif self.theta2 < 0 and self.theta < 0 and \ 
     430                self.theta-self.theta2 >= 0: 
     431                self.restore() 
     432                return                              
     433            elif  self.theta2 < 0 and self.theta > 0 and \ 
     434                (self.theta2 + 2 * math.pi - self.theta) >= math.pi/2: 
    427435                #print "my theta", self.theta 
    428436                self.restore() 
    429437                return  
    430             elif self.theta2 < 0 and self.theta < 0 and self.theta-self.theta2 >= 0: 
    431                 self.restore() 
    432                 return                              
    433             elif  self.theta2 < 0 and self.theta > 0 and self.theta2+2*math.pi-self.theta >=math.pi/2: 
     438            elif  self.theta2 < 0 and self.theta < 0 and \ 
     439                (self.theta2 - self.theta) >= math.pi/2: 
    434440                #print "my theta", self.theta 
    435441                self.restore() 
    436442                return  
    437             elif  self.theta2 < 0 and self.theta < 0 and self.theta2-self.theta >=math.pi/2: 
    438                 #print "my theta", self.theta 
    439                 self.restore() 
    440                 return  
    441             elif self.theta2>0 and (self.theta2-self.theta >= math.pi/2 or (self.theta2-self.theta >= math.pi/2)):#<= self.theta2 -math.pi/2: 
     443            elif self.theta2 > 0 and (self.theta2-self.theta >= math.pi/2 or \ 
     444                (self.theta2-self.theta >= math.pi/2)): 
    442445                #print "self theta encore" 
    443446                self.restore() 
     
    445448        else: 
    446449            #print "left move" 
    447             if  self.theta < 0 and self.theta+math.pi*2-self.theta2 <= 0: 
     450            if  self.theta < 0 and (self.theta + math.pi*2-self.theta2) <= 0: 
    448451                self.restore() 
    449452                return  
    450             elif self.theta2 < 0 and self.theta-self.theta2 <= 0: 
     453            elif self.theta2 < 0 and (self.theta-self.theta2) <= 0: 
    451454                self.restore() 
    452455                return                              
    453             elif  self.theta > 0 and self.theta-self.theta2 <=0: 
     456            elif  self.theta > 0 and self.theta-self.theta2 <= 0: 
    454457                #print "my theta", self.theta 
    455458                self.restore() 
    456459                return  
    457             elif self.theta-self.theta2 >= math.pi/2 or  (self.theta+math.pi*2-self.theta2 >= math.pi/2 and self.theta<0 and self.theta2>0): 
     460            elif self.theta-self.theta2 >= math.pi/2 or  \ 
     461                ((self.theta + math.pi * 2 - self.theta2) >= math.pi/2 and \ 
     462                 self.theta < 0 and self.theta2 > 0): 
    458463                #print "self theta encore" 
    459464                self.restore() 
    460465                return  
    461466             
    462         self.phi= math.fabs(self.theta2 - self.theta) 
    463         if self.phi>math.pi: 
    464             self.phi= 2*math.pi-math.fabs(self.theta2 - self.theta) 
    465  
     467        self.phi = math.fabs(self.theta2 - self.theta) 
     468        if self.phi > math.pi: 
     469            self.phi = 2 * math.pi - math.fabs(self.theta2 - self.theta) 
    466470        self.base.base.update() 
    467471         
     
    491495    Select an annulus through a 2D plot 
    492496    """ 
    493     def __init__(self,base,axes,color='black', zorder=5, r=1.0,theta=math.pi/4): 
     497    def __init__(self, base, axes, color='black', 
     498                 zorder=5, r=1.0, theta=math.pi/4): 
    494499        """ 
    495500        """ 
     
    503508        self.scale = 10.0 
    504509        # Inner circle 
    505         x1= self.radius*math.cos(self.theta) 
    506         y1= self.radius*math.sin(self.theta) 
    507         x2= -1*self.radius*math.cos(self.theta) 
    508         y2= -1*self.radius*math.sin(self.theta) 
     510        x1 = self.radius * math.cos(self.theta) 
     511        y1 = self.radius * math.sin(self.theta) 
     512        x2 = -1*self.radius * math.cos(self.theta) 
     513        y2 = -1*self.radius * math.sin(self.theta) 
    509514        try: 
    510515            # Inner circle marker 
    511             self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
     516            self.inner_marker = self.axes.plot([x1/2.5], [y1/2.5], linestyle='', 
    512517                                          marker='s', markersize=10, 
    513518                                          color=self.color, alpha=0.6, 
    514519                                          pickradius=5, label="pick",  
    515                                           zorder=zorder, # Prefer this to other lines 
     520                                          # Prefer this to other lines 
     521                                          zorder=zorder,  
    516522                                          visible=True)[0] 
    517523        except: 
    518             self.inner_marker = self.axes.plot([x1/2.5],[y1/2.5], linestyle='', 
     524            self.inner_marker = self.axes.plot([x1/2.5], [y1/2.5], linestyle='', 
    519525                                          marker='s', markersize=10, 
    520526                                          color=self.color, alpha=0.6, 
    521527                                          label="pick",  
    522528                                          visible=True)[0] 
    523             message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n" 
    524             message += "Get the SVN version that is at least as recent as June 1, 2007" 
    525              
    526         self.line = self.axes.plot([x1,x2],[y1,y2], 
     529            message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION" 
     530            message += " OF MATPLOTLIB\n Get the SVN version that is at" 
     531            message += " least as recent as June 1, 2007" 
     532        self.line = self.axes.plot([x1, x2], [y1, y2], 
    527533                                      linestyle='-', marker='', 
    528                                       color=self.color, 
    529                                       visible=True)[0] 
     534                                      color=self.color, visible=True)[0] 
    530535        self.npts = 20 
    531         self.has_move=False 
     536        self.has_move = False 
    532537        self.connect_markers([self.inner_marker, self.line]) 
    533538        self.update() 
     
    556561        """ 
    557562        
    558         if theta !=None: 
    559             self.theta= theta 
    560         x1= self.radius*math.cos(self.theta) 
    561         y1= self.radius*math.sin(self.theta) 
    562         x2= -1*self.radius*math.cos(self.theta) 
    563         y2= -1*self.radius*math.sin(self.theta) 
    564          
    565         self.inner_marker.set(xdata=[x1/2.5],ydata=[y1/2.5]) 
    566         self.line.set(xdata=[x1,x2], ydata=[y1,y2])   
     563        if theta != None: 
     564            self.theta = theta 
     565        x1 = self.radius * math.cos(self.theta) 
     566        y1 = self.radius * math.sin(self.theta) 
     567        x2 = -1 * self.radius * math.cos(self.theta) 
     568        y2 = -1 * self.radius * math.sin(self.theta) 
     569         
     570        self.inner_marker.set(xdata=[x1/2.5], ydata=[y1/2.5]) 
     571        self.line.set(xdata=[x1, x2], ydata=[y1, y2])   
    567572     
    568573    def save(self, ev): 
     
    577582        """ 
    578583        """ 
    579         self.has_move=False 
     584        self.has_move = False 
    580585        self.base.moveend(ev) 
    581586             
     
    590595        Process move to a new position, making sure that the move is allowed. 
    591596        """ 
    592         self.theta= math.atan2(y,x) 
    593         self.has_move=True 
     597        self.theta = math.atan2(y, x) 
     598        self.has_move = True 
    594599        self.base.base.update() 
    595600         
Note: See TracChangeset for help on using the changeset viewer.