Ignore:
Timestamp:
Mar 5, 2015 4:53:03 PM (9 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
c4f6851
Parents:
c039589
Message:

pylint fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/guiframe/local_perspectives/plotting/slicerpanel.py

    r27ab091 rb40ad40  
    1  
    2  
    31import wx 
    42import wx.lib.newevent 
     
    1311class SlicerPanel(wx.Panel, PanelBase): 
    1412    """ 
    15     Panel class to show the slicer parameters  
     13    Panel class to show the slicer parameters 
    1614    """ 
    1715    #TODO: show units 
     
    2220    window_caption = "Slicer Panel" 
    2321    CENTER_PANE = False 
    24      
     22 
    2523    def __init__(self, parent, id=-1, type=None, base=None, 
    26                 params=None, *args, **kwargs): 
     24                 params=None, *args, **kwargs): 
    2725        wx.Panel.__init__(self, parent, id, *args, **kwargs) 
    2826        PanelBase.__init__(self) 
    29         ##  Initialization of the class      
     27        ##  Initialization of the class 
    3028        self.base = base 
    3129        if params is None: 
     
    3937        self.bck = wx.GridBagSizer(5, 5) 
    4038        self.SetSizer(self.bck) 
    41         if type == None and params == None:   
    42             label = "Right-click on 2D plot for slicer options"   
     39        if type == None and params == None: 
     40            label = "Right-click on 2D plot for slicer options" 
    4341            title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 
    44             self.bck.Add(title, (0, 0), (1, 2),  
    45                          flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 
     42            self.bck.Add(title, (0, 0), (1, 2), 
     43                         flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
    4644        else: 
    4745            self.set_slicer(type, params) 
     
    5452        Process EVT_SLICER events 
    5553        When the slicer changes, update the panel 
    56          
     54 
    5755        :param event: EVT_SLICER event 
    58          
     56 
    5957        """ 
    6058        event.Skip() 
    6159        if event.obj_class == None: 
    62             self.set_slicer(None, None)  
     60            self.set_slicer(None, None) 
    6361        else: 
    6462            self.set_slicer(event.type, event.params) 
    65          
     63 
    6664    def set_slicer(self, type, params): 
    6765        """ 
    6866        Rebuild the panel 
    6967        """ 
    70         self.bck.Clear(True)   
    71         self.type = type   
     68        self.bck.Clear(True) 
     69        self.type = type 
    7270        if type == None: 
    7371            label = "Right-click on 2D plot for slicer options" 
    7472            title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 
    75             self.bck.Add(title, (0, 0), (1, 2),  
    76                          flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 
     73            self.bck.Add(title, (0, 0), (1, 2), 
     74                         flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
    7775        else: 
    7876            title_text = str(type) + "Parameters" 
    79             title = wx.StaticText(self, -1, title_text,  
     77            title = wx.StaticText(self, -1, title_text, 
    8078                                  style=wx.ALIGN_LEFT) 
    81             self.bck.Add(title, (0, 0), (1, 2),  
    82                          flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 
     79            self.bck.Add(title, (0, 0), (1, 2), 
     80                         flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
    8381            n = 1 
    8482            self.parameters = [] 
     
    8684            keys.sort() 
    8785            for item in keys: 
    88                 if not item.lower() in ["num_points", "avg", "avg_error", "sum", 
    89                                          "sum_error"]: 
     86                if not item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 
    9087                    n += 1 
    9188                    text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 
    92                     self.bck.Add(text, (n-1, 0),  
    93                             flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 
    94                     ctl = wx.TextCtrl(self, -1, size=(80, 20),  
     89                    self.bck.Add(text, (n - 1, 0), 
     90                                 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
     91                    ctl = wx.TextCtrl(self, -1, size=(80, 20), 
    9592                                      style=wx.TE_PROCESS_ENTER) 
    9693                    hint_msg = "Modify the value of %s to change " % item 
     
    10299                    ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 
    103100                    self.parameters.append([item, ctl]) 
    104                     self.bck.Add(ctl, (n-1, 1), flag=wx.TOP|wx.BOTTOM, border=0) 
     101                    self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 
    105102            for item in keys: 
    106                 if  item.lower() in ["num_points", "avg", "avg_error", "sum", 
    107                                       "sum_error"]: 
     103                if  item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 
    108104                    n += 1 
    109                     text = wx.StaticText(self, -1, item + ": ",  
    110                                          style=wx.ALIGN_LEFT) 
    111                     self.bck.Add(text, (n-1, 0),  
    112                                  flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL,  
     105                    text = wx.StaticText(self, -1, item + ": ", style=wx.ALIGN_LEFT) 
     106                    self.bck.Add(text, (n - 1, 0), flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 
    113107                                 border=15) 
    114                     ctl = wx.StaticText(self, -1,  
     108                    ctl = wx.StaticText(self, -1, 
    115109                                        str(format_number(params[item])), 
    116110                                        style=wx.ALIGN_LEFT) 
    117111                    ctl.SetToolTipString("Result %s" % item) 
    118                     self.bck.Add(ctl, (n-1, 1), flag=wx.TOP|wx.BOTTOM, border=0)        
     112                    self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 
    119113        self.bck.Layout() 
    120         #self.bck.Fit(self) 
    121114        self.Layout() 
    122115        psizer = self.parent.GetSizer() 
    123116        if psizer != None: 
    124117            psizer.Layout() 
    125          
     118 
    126119    def onSetFocus(self, evt): 
    127120        """ 
     
    134127        wx.CallAfter(widget.SetSelection, -1, -1) 
    135128        return 
    136      
     129 
    137130    def onParamChange(self, evt): 
    138131        """ 
    139132        Receive and event and reset the text field contained in self.parameters 
    140              
     133 
    141134        """ 
    142135        evt.Skip() 
    143         for item in self.parameters:               
     136        for item in self.parameters: 
    144137            if item[0] in evt.params: 
    145138                item[1].SetValue(format_number(evt.params[item[0]])) 
    146139                item[1].Refresh() 
    147     
    148     def onTextEnter(self, evt):  
     140 
     141    def onTextEnter(self, evt): 
    149142        """ 
    150143        Parameters have changed 
     
    156149            try: 
    157150                params[item[0]] = float(item[1].GetValue()) 
    158                 item[1].SetBackgroundColour( 
    159                         wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) 
     151                item[1].SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) 
    160152                item[1].Refresh() 
    161153            except: 
     
    163155                item[1].SetBackgroundColour("pink") 
    164156                item[1].Refresh() 
    165              
     157 
    166158        if has_error == False: 
    167159            # Post parameter event 
     
    175167        """ 
    176168        ID = self.uid 
    177         self.parent.delete_panel(ID)             
     169        self.parent.delete_panel(ID) 
    178170        self.frame.Destroy() 
Note: See TracChangeset for help on using the changeset viewer.