Ignore:
Timestamp:
Mar 4, 2015 3:28:39 PM (9 years ago)
Author:
Doucet, Mathieu <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:
2f732b0
Parents:
76aed53
Message:

Take care of white spaces (pylint)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/perspectives/calculator/sld_panel.py

    r33f551f r49ab5d7  
    1212from sas.guiframe.utils import format_number 
    1313from sas.guiframe.utils import check_float 
    14 from sas.guiframe.events import StatusEvent   
     14from sas.guiframe.events import StatusEvent 
    1515 
    1616# the calculator default value for wavelength is 6 
     
    2020from periodictable.xsf import xray_sld_from_atoms 
    2121from periodictable.nsf import neutron_scattering 
    22 from sas.perspectives.calculator import calculator_widgets as widget    
     22from sas.perspectives.calculator import calculator_widgets as widget 
    2323from sas.guiframe.documentation_window import DocumentationWindow 
    24         
     24 
    2525WAVELENGTH = 6.0 
    2626_BOX_WIDTH = 76 
     
    3737    PANEL_SIZE = 410 
    3838    FONT_VARIANT = 1 
    39      
     39 
    4040class SldPanel(wx.Panel, PanelBase): 
    4141    """ 
     
    4848    ## Flag to tell the AUI manager to put this panel in the center pane 
    4949    CENTER_PANE = True 
    50      
     50 
    5151    def __init__(self, parent, base=None, *args, **kwds): 
    5252        """ 
     
    7979        self.SetAutoLayout(True) 
    8080        self.Layout() 
    81         
     81 
    8282    def _do_layout(self): 
    8383        """ 
     
    9999        boxsizer1 = wx.StaticBoxSizer(inputbox, wx.VERTICAL) 
    100100        boxsizer1.SetMinSize((_STATICBOX_WIDTH, -1)) 
    101          
     101 
    102102        compound_txt = wx.StaticText(self, -1, 'Compound ') 
    103         self.compound_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH*2, -1)) 
     103        self.compound_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH * 2, -1)) 
    104104        density_txt = wx.StaticText(self, -1, 'Density ') 
    105105        self.density_ctl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 
     
    112112        ix = 0 
    113113        sizer_input.Add(compound_txt, (iy, ix), (1, 1), 
    114                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     114                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    115115        ix += 1 
    116116        sizer_input.Add(self.compound_ctl, (iy, ix), (1, 1), 
    117                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     117                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    118118        iy += 1 
    119119        ix = 0 
    120120        sizer_input.Add(density_txt, (iy, ix), (1, 1), 
    121                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     121                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    122122        ix += 1 
    123123        sizer_input.Add(self.density_ctl, (iy, ix), (1, 1), 
    124                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
    125         ix +=1 
    126         sizer_input.Add(unit_density_txt,(iy, ix), (1, 1), 
    127                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     124                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
     125        ix += 1 
     126        sizer_input.Add(unit_density_txt, (iy, ix), (1, 1), 
     127                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    128128        iy += 1 
    129129        ix = 0 
    130130        sizer_input.Add(wavelength_txt, (iy, ix), (1, 1), 
    131                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     131                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    132132        ix += 1 
    133133        sizer_input.Add(self.wavelength_ctl, (iy, ix), (1, 1), 
    134                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     134                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    135135        ix += 1 
    136136        sizer_input.Add(unit_a_txt, (iy, ix), (1, 1), 
    137                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     137                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    138138        boxsizer1.Add(sizer_input) 
    139139        sizer1.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10) 
     
    142142        boxsizer2 = wx.StaticBoxSizer(outputbox, wx.VERTICAL) 
    143143        boxsizer2.SetMinSize((_STATICBOX_WIDTH, -1)) 
    144          
     144 
    145145        i_complex = '- i' 
    146146        neutron_sld_txt = wx.StaticText(self, -1, 'Neutron SLD') 
     
    149149        self.neutron_sld_real_ctl.SetEditable(False) 
    150150        self.neutron_sld_real_ctl.SetToolTipString("Neutron SLD real.") 
    151         self.neutron_sld_im_ctl = wx.TextCtrl(self, -1,  
     151        self.neutron_sld_im_ctl = wx.TextCtrl(self, -1, 
    152152                                              size=(_BOX_WIDTH, -1)) 
    153153        self.neutron_sld_im_ctl.SetEditable(False) 
    154154        self.neutron_sld_im_ctl.SetToolTipString("Neutron SLD imaginary.") 
    155155        neutron_sld_units_txt = wx.StaticText(self, -1, unit_sld) 
    156          
     156 
    157157        cu_ka_sld_txt = wx.StaticText(self, -1, 'Cu Ka SLD') 
    158158        self.cu_ka_sld_real_ctl = wx.TextCtrl(self, -1, 
     
    160160        self.cu_ka_sld_real_ctl.SetEditable(False) 
    161161        self.cu_ka_sld_real_ctl.SetToolTipString("Cu Ka SLD real.") 
    162         self.cu_ka_sld_im_ctl = wx.TextCtrl(self, -1,  
     162        self.cu_ka_sld_im_ctl = wx.TextCtrl(self, -1, 
    163163                                            size=(_BOX_WIDTH, -1)) 
    164164        self.cu_ka_sld_im_ctl.SetEditable(False) 
    165165        self.cu_ka_sld_im_ctl.SetToolTipString("Cu Ka SLD imaginary.") 
    166166        cu_ka_sld_units_txt = wx.StaticText(self, -1, unit_sld) 
    167          
     167 
    168168        mo_ka_sld_txt = wx.StaticText(self, -1, 'Mo Ka SLD') 
    169169        self.mo_ka_sld_real_ctl = wx.TextCtrl(self, -1, 
     
    176176        self.mo_ka_sld_im_ctl.SetToolTipString("Mo Ka SLD imaginary.") 
    177177        mo_ka_sld_units_txt = wx.StaticText(self, -1, unit_sld) 
    178          
     178 
    179179        neutron_inc_txt = wx.StaticText(self, -1, 'Neutron Inc. Xs') 
    180180        self.neutron_inc_ctl = wx.TextCtrl(self, -1, 
     
    182182        self.neutron_inc_ctl.SetEditable(False) 
    183183        self.neutron_inc_ctl.SetToolTipString("Neutron Inc. Xs") 
    184         neutron_inc_units_txt = wx.StaticText(self, -1,  unit_cm1) 
    185         
    186         neutron_abs_txt = wx.StaticText(self, -1, 'Neutron Abs. Xs')      
    187         self.neutron_abs_ctl = wx.TextCtrl(self, -1,  
     184        neutron_inc_units_txt = wx.StaticText(self, -1, unit_cm1) 
     185 
     186        neutron_abs_txt = wx.StaticText(self, -1, 'Neutron Abs. Xs') 
     187        self.neutron_abs_ctl = wx.TextCtrl(self, -1, 
    188188                                           size=(_BOX_WIDTH, -1)) 
    189189        self.neutron_abs_ctl.SetEditable(False) 
    190190        self.neutron_abs_ctl.SetToolTipString("Neutron Abs. Xs") 
    191         neutron_abs_units_txt = wx.StaticText(self, -1,  unit_cm1) 
    192        
     191        neutron_abs_units_txt = wx.StaticText(self, -1, unit_cm1) 
     192 
    193193        neutron_length_txt = wx.StaticText(self, -1, 'Neutron 1/e length') 
    194194        self.neutron_length_ctl = wx.TextCtrl(self, -1, 
     
    196196        self.neutron_length_ctl.SetEditable(False) 
    197197        self.neutron_length_ctl.SetToolTipString("Neutron 1/e length") 
    198         neutron_length_units_txt = wx.StaticText(self, -1,  unit_cm) 
    199        
     198        neutron_length_units_txt = wx.StaticText(self, -1, unit_cm) 
     199 
    200200        iy = 0 
    201201        ix = 0 
    202202        sizer_output.Add(neutron_sld_txt, (iy, ix), (1, 1), 
    203                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     203                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    204204        ix += 1 
    205205        sizer_output.Add(self.neutron_sld_real_ctl, (iy, ix), (1, 1), 
    206                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     206                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    207207        ix += 1 
    208208        sizer_output.Add(wx.StaticText(self, -1, i_complex), 
    209                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     209                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    210210        ix += 1 
    211211        sizer_output.Add(self.neutron_sld_im_ctl, 
    212                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     212                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    213213        ix += 1 
    214214        sizer_output.Add(neutron_sld_units_txt, 
    215                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     215                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    216216        iy += 1 
    217217        ix = 0 
    218218        sizer_output.Add(cu_ka_sld_txt, (iy, ix), (1, 1), 
    219                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     219                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    220220        ix += 1 
    221221        sizer_output.Add(self.cu_ka_sld_real_ctl, (iy, ix), (1, 1), 
    222                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     222                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    223223        ix += 1 
    224224        sizer_output.Add(wx.StaticText(self, -1, i_complex), 
    225                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     225                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    226226        ix += 1 
    227227        sizer_output.Add(self.cu_ka_sld_im_ctl, 
    228                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)   
     228                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    229229        ix += 1 
    230230        sizer_output.Add(cu_ka_sld_units_txt, 
    231                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
    232         iy += 1 
    233         ix = 0 
    234         sizer_output.Add(mo_ka_sld_txt,(iy, ix), (1, 1), 
    235                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    236         ix += 1 
    237         sizer_output.Add(self.mo_ka_sld_real_ctl,(iy, ix), (1, 1), 
    238                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     231                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
     232        iy += 1 
     233        ix = 0 
     234        sizer_output.Add(mo_ka_sld_txt, (iy, ix), (1, 1), 
     235                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
     236        ix += 1 
     237        sizer_output.Add(self.mo_ka_sld_real_ctl, (iy, ix), (1, 1), 
     238                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    239239        ix += 1 
    240240        sizer_output.Add(wx.StaticText(self, -1, i_complex), 
    241                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     241                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    242242        ix += 1 
    243243        sizer_output.Add(self.mo_ka_sld_im_ctl, 
    244                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)   
     244                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    245245        ix += 1 
    246246        sizer_output.Add(mo_ka_sld_units_txt, 
    247                          (iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     247                         (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    248248        iy += 1 
    249249        ix = 0 
    250250        sizer_output.Add(neutron_inc_txt, (iy, ix), (1, 1), 
    251                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     251                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    252252        ix += 1 
    253253        sizer_output.Add(self.neutron_inc_ctl, (iy, ix), (1, 1), 
    254                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     254                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    255255        ix += 2 
    256         sizer_output.Add(neutron_inc_units_txt,(iy, ix), (1, 1), 
    257                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     256        sizer_output.Add(neutron_inc_units_txt, (iy, ix), (1, 1), 
     257                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    258258        iy += 1 
    259259        ix = 0 
    260260        sizer_output.Add(neutron_abs_txt, (iy, ix), (1, 1), 
    261                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     261                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    262262        ix += 1 
    263263        sizer_output.Add(self.neutron_abs_ctl, (iy, ix), (1, 1), 
    264                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     264                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    265265        ix += 2 
    266266        sizer_output.Add(neutron_abs_units_txt, (iy, ix), (1, 1), 
    267                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     267                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    268268        iy += 1 
    269269        ix = 0 
    270270        sizer_output.Add(neutron_length_txt, (iy, ix), (1, 1), 
    271                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     271                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 
    272272        ix += 1 
    273273        sizer_output.Add(self.neutron_length_ctl, (iy, ix), (1, 1), 
    274                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     274                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    275275        ix += 2 
    276276        sizer_output.Add(neutron_length_units_txt, (iy, ix), (1, 1), 
    277                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)   
     277                            wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
    278278        boxsizer2.Add(sizer_output) 
    279         sizer2.Add(boxsizer2, 0, wx.EXPAND|wx.ALL, 10) 
     279        sizer2.Add(boxsizer2, 0, wx.EXPAND | wx.ALL, 10) 
    280280        #-----Button  sizer------------ 
    281      
     281 
    282282        id = wx.NewId() 
    283283        self.button_calculate = wx.Button(self, id, "Calculate") 
    284284        self.button_calculate.SetToolTipString("Calculate SLD.") 
    285         self.Bind(wx.EVT_BUTTON, self.calculateSld, id=id)    
    286          
     285        self.Bind(wx.EVT_BUTTON, self.calculateSld, id=id) 
     286 
    287287        id = wx.NewId() 
    288288        self.button_help = wx.Button(self, id, "HELP") 
    289289        self.button_help.SetToolTipString("help on SLD calculator.") 
    290         self.Bind(wx.EVT_BUTTON, self.on_help, id=id)    
    291          
    292         sizer_button.Add((150, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    293         sizer_button.Add(self.button_calculate, 0, wx.RIGHT|wx.ADJUST_MINSIZE, 20) 
    294         sizer_button.Add(self.button_help, 0, wx.RIGHT|wx.ADJUST_MINSIZE, 20) 
     290        self.Bind(wx.EVT_BUTTON, self.on_help, id=id) 
     291 
     292        sizer_button.Add((150, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0) 
     293        sizer_button.Add(self.button_calculate, 0, wx.RIGHT | wx.ADJUST_MINSIZE, 20) 
     294        sizer_button.Add(self.button_help, 0, wx.RIGHT | wx.ADJUST_MINSIZE, 20) 
    295295        sizer3.Add(sizer_button) 
    296296        #---------layout---------------- 
    297         vbox  = wx.BoxSizer(wx.VERTICAL) 
     297        vbox = wx.BoxSizer(wx.VERTICAL) 
    298298        vbox.Add(sizer1) 
    299299        vbox.Add(sizer2) 
    300300        vbox.Add(sizer3) 
    301         vbox.Fit(self)  
     301        vbox.Fit(self) 
    302302        self.SetSizer(vbox) 
    303          
    304     def on_help(self, event):     
     303 
     304    def on_help(self, event): 
    305305        """ 
    306306        Bring up the SLD Documentation whenever 
    307         the HELP button is clicked.  
    308          
     307        the HELP button is clicked. 
     308 
    309309        Calls DocumentationWindow with the path of the location within the 
    310         documentation tree (after /doc/ ....".  Note that when using old  
    311         versions of Wx (before 2.9) and thus not the release version of  
    312         installers, the help comes up at the top level of the file as  
     310        documentation tree (after /doc/ ....".  Note that when using old 
     311        versions of Wx (before 2.9) and thus not the release version of 
     312        installers, the help comes up at the top level of the file as 
    313313        webbrowser does not pass anything past the # to the browser when it is 
    314314        running "file:///...." 
    315      
     315 
    316316    :param evt: Triggers on clicking the help button 
    317317    """ 
    318                  
     318 
    319319        _TreeLocation = "user/perspectives/calculator/sld_calculator_help.html" 
    320320        _doc_viewer = DocumentationWindow(self, -1, \ 
    321              _TreeLocation,"General Scattering Calculator Help") 
     321             _TreeLocation, "General Scattering Calculator Help") 
    322322 
    323323    def calculate_xray_sld(self, element): 
    324324        """ 
    325325        Get an element and compute the corresponding SLD for a given formula 
    326          
     326 
    327327        :param element:  elements a string of existing atom 
    328          
     328 
    329329        """ 
    330330        myformula = formula(str(element)) 
    331331        if len(myformula.atoms) != 1: 
    332             return  
    333         element = myformula.atoms.keys()[0]  
     332            return 
     333        element = myformula.atoms.keys()[0] 
    334334        energy = xray_energy(element.K_alpha) 
    335          
     335 
    336336        self.sld_formula = formula(str(self.compound), density=self.density) 
    337337        atom = self.sld_formula.atoms 
    338         return xray_sld_from_atoms(atom, density=self.density, energy= energy) 
    339      
     338        return xray_sld_from_atoms(atom, density=self.density, energy=energy) 
     339 
    340340    def check_inputs(self): 
    341341        """Check validity user inputs""" 
     
    347347            flag = False 
    348348            msg += "Error for Density value :expect float" 
    349      
     349 
    350350        self.wavelength = self.wavelength_ctl.GetValue() 
    351351        if str(self.wavelength).lstrip().rstrip() == "": 
     
    361361                flag = False 
    362362                msg += "Error for wavelength value :expect float" 
    363                  
     363 
    364364        self.compound = self.compound_ctl.GetValue().lstrip().rstrip() 
    365365        if self.compound != "": 
     
    379379            msg += "Enter a formula" 
    380380        return flag, msg 
    381          
     381 
    382382    def calculate_sld_helper(self, element, density, molecule_formula): 
    383383        """ 
    384384        Get an element and compute the corresponding SLD for a given formula 
    385          
     385 
    386386        :param element:  elements a string of existing atom 
    387          
     387 
    388388        """ 
    389389        element_formula = formula(str(element)) 
    390390        if len(element_formula.atoms) != 1: 
    391             return  
    392         element = element_formula.atoms.keys()[0]  
     391            return 
     392        element = element_formula.atoms.keys()[0] 
    393393        energy = xray_energy(element.K_alpha) 
    394394        atom = molecule_formula.atoms 
     
    408408                wx.PostEvent(self.base, StatusEvent(status=msg)) 
    409409            if not flag: 
    410                return  
     410               return 
    411411            #get ready to compute 
    412412            self.sld_formula = formula(self.compound, 
     
    414414            (sld_real, sld_im, _), (_, absorp, incoh), \ 
    415415                        length = neutron_scattering(compound=self.compound, 
    416                                    density=self.density,  
    417                                    wavelength=self.wavelength)  
     416                                   density=self.density, 
     417                                   wavelength=self.wavelength) 
    418418            cu_real, cu_im = self.calculate_sld_helper(element="Cu", 
    419419                                                 density=self.density, 
    420420                                        molecule_formula=self.sld_formula) 
    421             mo_real, mo_im = self.calculate_sld_helper(element="Mo",  
     421            mo_real, mo_im = self.calculate_sld_helper(element="Mo", 
    422422                                                       density=self.density, 
    423423                                     molecule_formula=self.sld_formula) 
     
    428428            self.neutron_sld_im_ctl.SetValue(val) 
    429429            # Compute the Cu SLD 
    430             self.cu_ka_sld_real_ctl.SetValue(format_number(cu_real *_SCALE)) 
    431             val = format_number(math.fabs(cu_im )* _SCALE) 
     430            self.cu_ka_sld_real_ctl.SetValue(format_number(cu_real * _SCALE)) 
     431            val = format_number(math.fabs(cu_im) * _SCALE) 
    432432            self.cu_ka_sld_im_ctl.SetValue(val) 
    433433            # Compute the Mo SLD 
    434             self.mo_ka_sld_real_ctl.SetValue(format_number(mo_real *_SCALE)) 
    435             val = format_number(math.fabs(mo_im)* _SCALE) 
     434            self.mo_ka_sld_real_ctl.SetValue(format_number(mo_real * _SCALE)) 
     435            val = format_number(math.fabs(mo_im) * _SCALE) 
    436436            self.mo_ka_sld_im_ctl.SetValue(val) 
    437437            # set incoherence and absorption 
     
    444444        except: 
    445445            if self.base is not None: 
    446                 msg = "SLD Calculator: %s"%(sys.exc_value) 
     446                msg = "SLD Calculator: %s" % (sys.exc_value) 
    447447                wx.PostEvent(self.base, StatusEvent(status=msg)) 
    448448        if event is not None: 
    449449            event.Skip() 
    450              
     450 
    451451    def clear_outputs(self): 
    452452        """ 
     
    462462        self.neutron_inc_ctl.SetValue("") 
    463463        self.neutron_length_ctl.SetValue("") 
    464          
    465          
     464 
     465 
    466466class SldWindow(widget.CHILD_FRAME): 
    467467    """ 
    468468    """ 
    469469    def __init__(self, parent=None, title="SLD Calculator", 
    470                   base=None, manager=None,  
     470                  base=None, manager=None, 
    471471                  size=(PANEL_SIZE, PANEL_SIZE), *args, **kwds): 
    472472        """ 
     
    484484        self.SetPosition((20, 10)) 
    485485        self.Show(True) 
    486      
     486 
    487487    def on_close(self, event): 
    488488        """ 
     
    492492            self.manager.sld_frame = None 
    493493        self.Destroy() 
    494          
    495          
     494 
     495 
    496496class ViewApp(wx.App): 
    497497    """ 
     
    501501        """ 
    502502        widget.CHILD_FRAME = wx.Frame 
    503         frame = SldWindow(None, title='SLD Calculator')     
     503        frame = SldWindow(None, title='SLD Calculator') 
    504504        frame.Show(True) 
    505505        self.SetTopWindow(frame) 
    506506        return True 
    507          
    508  
    509 if __name__ == "__main__":  
     507 
     508 
     509if __name__ == "__main__": 
    510510    app = ViewApp(0) 
    511     app.MainLoop()      
     511    app.MainLoop() 
Note: See TracChangeset for help on using the changeset viewer.