Changeset 26d2d88 in sasview


Ignore:
Timestamp:
Mar 2, 2015 1:04:44 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:
788d4c3
Parents:
460f5f2
Message:

Fix pylint complaints

File:
1 edited

Legend:

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

    r9654baf r26d2d88  
    22This software was developed by the University of Tennessee as part of the 
    33Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
    4 project funded by the US National Science Foundation.  
     4project funded by the US National Science Foundation. 
    55 
    66See the license text in license.txt 
     
    1313 
    1414from sas.guiframe.panel_base import PanelBase 
    15 from sas.calculator.kiessig_calculator import KiessigThicknessCalculator  
     15from sas.calculator.kiessig_calculator import KiessigThicknessCalculator 
    1616from calculator_widgets import OutputTextCtrl 
    1717from calculator_widgets import InputTextCtrl 
    18 from sas.perspectives.calculator import calculator_widgets as widget    
     18from sas.perspectives.calculator import calculator_widgets as widget 
    1919from sas.guiframe.documentation_window import DocumentationWindow 
    2020 
    2121_BOX_WIDTH = 77 
    22 #Slit length panel size  
     22#Slit length panel size 
    2323if sys.platform.count("win32") > 0: 
    2424    PANEL_WIDTH = 500 
     
    4040    ## Flag to tell the AUI manager to put this panel in the center pane 
    4141    CENTER_PANE = True 
    42      
     42 
    4343    def __init__(self, parent, *args, **kwds): 
    4444        wx.Panel.__init__(self, parent, *args, **kwds) 
    4545        PanelBase.__init__(self) 
    46         #Font size  
    47         self.SetWindowVariant(variant=FONT_VARIANT)   
     46        #Font size 
     47        self.SetWindowVariant(variant=FONT_VARIANT) 
    4848        # Object that receive status event 
    4949        self.parent = parent 
     
    5252        self.hint_sizer = None 
    5353        self._do_layout() 
    54         
     54 
    5555    def _define_structure(self): 
    5656        """ 
     
    6161                                str("Kiessig Thickness Calculator")) 
    6262        self.boxsizer_source = wx.StaticBoxSizer(self.box_source, 
    63                                                     wx.VERTICAL) 
     63                                                 wx.VERTICAL) 
    6464        self.dq_name_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    6565        self.thickness_size_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    6666        self.hint_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    6767        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    68         
     68 
    6969    def _layout_dq_name(self): 
    7070        """ 
     
    7474        dq_value = str(self.kiessig.get_deltaq()) 
    7575        dq_unit_txt = wx.StaticText(self, -1, '[1/A]') 
    76         dq_name_txt = wx.StaticText(self, -1,  
    77                                 'Kiessig Fringe Width (Delta Q): ') 
     76        dq_name_txt = wx.StaticText(self, -1, 
     77                                    'Kiessig Fringe Width (Delta Q): ') 
    7878        self.dq_name_tcl = InputTextCtrl(self, -1,  
    7979                                         size=(_BOX_WIDTH,-1)) 
     
    8989        self.dq_name_sizer.AddMany([(dq_name_txt, 0, wx.LEFT, 15), 
    9090                                    (self.dq_name_tcl, 0, wx.LEFT, 15), 
    91                                     (dq_unit_txt,0, wx.LEFT, 10), 
    92                                 (self.compute_button, 0, wx.LEFT, 30)]) 
     91                                    (dq_unit_txt, 0, wx.LEFT, 10), 
     92                                    (self.compute_button, 0, wx.LEFT, 30)]) 
     93 
    9394    def _layout_thickness_size(self): 
    9495        """ 
     
    9697        """ 
    9798        thick_unit = '['+self.kiessig.get_thickness_unit() +']' 
    98         thickness_size_txt = wx.StaticText(self, -1,  
     99        thickness_size_txt = wx.StaticText(self, -1, 
    99100                                           'Thickness (or Diameter): ') 
    100         self.thickness_size_tcl = OutputTextCtrl(self, -1,  
     101        self.thickness_size_tcl = OutputTextCtrl(self, -1, 
    101102                                                 size=(_BOX_WIDTH,-1)) 
    102103        thickness_size_hint = " Estimated Size in Real Space" 
    103104        self.thickness_size_tcl.SetToolTipString(thickness_size_hint) 
    104105        thickness_size_unit_txt = wx.StaticText(self, -1, thick_unit) 
    105          
     106 
    106107        self.thickness_size_sizer.AddMany([(thickness_size_txt, 0, wx.LEFT, 15), 
    107                                     (self.thickness_size_tcl, 0, wx.LEFT, 15), 
    108                                     (thickness_size_unit_txt, 0, wx.LEFT, 10)]) 
    109      
     108                                           (self.thickness_size_tcl, 0, wx.LEFT, 15), 
     109                                           (thickness_size_unit_txt, 0, wx.LEFT, 10)]) 
     110 
    110111    def _layout_hint(self): 
    111112        """ 
     
    119120        self.hint_txt = wx.StaticText(self, -1, hint_msg) 
    120121        self.hint_sizer.AddMany([(self.hint_txt, 0, wx.LEFT, 15)]) 
    121      
     122 
    122123    def _layout_button(self):   
    123124        """ 
     
    125126        """  
    126127        id = wx.NewId() 
    127         self.bt_help = wx.Button(self, id,'HELP') 
     128        self.bt_help = wx.Button(self, id, 'HELP') 
    128129        self.bt_help.Bind(wx.EVT_BUTTON, self.on_help) 
    129130        self.bt_help.SetToolTipString("Help using the Kiessig fringe calculator.") 
    130131 
    131         self.bt_close = wx.Button(self, wx.ID_CANCEL,'Close') 
     132        self.bt_close = wx.Button(self, wx.ID_CANCEL, 'Close') 
    132133        self.bt_close.Bind(wx.EVT_BUTTON, self.on_close) 
    133134        self.bt_close.SetToolTipString("Close this window.") 
    134135        self.button_sizer.AddMany([(self.bt_help, 0, wx.LEFT, 260), 
    135136                                   (self.bt_close, 0, wx.LEFT, 20)]) 
    136          
     137 
    137138    def _do_layout(self): 
    138139        """ 
     
    145146        self._layout_button() 
    146147        self.boxsizer_source.AddMany([(self.dq_name_sizer, 0, 
    147                                           wx.EXPAND|wx.TOP|wx.BOTTOM, 5), 
    148                                    (self.thickness_size_sizer, 0, 
    149                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5), 
    150                                      (self.hint_sizer, 0, 
    151                                      wx.EXPAND|wx.TOP|wx.BOTTOM, 5)]) 
     148                                       wx.EXPAND|wx.TOP|wx.BOTTOM, 5), 
     149                                      (self.thickness_size_sizer, 0, 
     150                                       wx.EXPAND|wx.TOP|wx.BOTTOM, 5), 
     151                                      (self.hint_sizer, 0, 
     152                                       wx.EXPAND|wx.TOP|wx.BOTTOM, 5)]) 
    152153        self.main_sizer.AddMany([(self.boxsizer_source, 0, wx.ALL, 10), 
    153                                   (self.button_sizer, 0, 
    154                                     wx.EXPAND|wx.TOP|wx.BOTTOM, 5)]) 
     154                                 (self.button_sizer, 0, 
     155                                  wx.EXPAND|wx.TOP|wx.BOTTOM, 5)]) 
    155156        self.SetSizer(self.main_sizer) 
    156157        self.SetAutoLayout(True) 
    157158 
    158     def on_help(self, event):     
     159    def on_help(self, event): 
    159160        """ 
    160161        Bring up the Kiessig fringe calculator Documentation whenever 
    161         the HELP button is clicked.  
    162          
     162        the HELP button is clicked. 
    163163        Calls DocumentationWindow with the path of the location within the 
    164         documentation tree (after /doc/ ....".  Note that when using old  
    165         versions of Wx (before 2.9) and thus not the release version of  
    166         installers, the help comes up at the top level of the file as  
     164        documentation tree (after /doc/ ....".  Note that when using old 
     165        versions of Wx (before 2.9) and thus not the release version of 
     166        installers, the help comes up at the top level of the file as 
    167167        webbrowser does not pass anything past the # to the browser when it is 
    168168        running "file:///...." 
    169      
     169 
    170170    :param evt: Triggers on clicking the help button 
    171171    """ 
    172                  
    173172        _TreeLocation = "user/perspectives/calculator/kiessig_calculator_help.html" 
    174         _doc_viewer = DocumentationWindow(self, -1, \ 
    175              _TreeLocation,"Density/Volume Calculator Help") 
     173        _doc_viewer = DocumentationWindow(self, -1, 
     174                                          _TreeLocation, 
     175                                          "Density/Volume Calculator Help") 
    176176 
    177177    def on_close(self, event): 
     
    182182        if event is not None: 
    183183            event.Skip() 
    184          
     184 
    185185    def on_compute(self, event): 
    186186        """ 
     
    197197        # set tcl 
    198198        self.thickness_size_tcl.SetValue(str(thickness)) 
    199          
     199 
    200200    def format_number(self, value=None): 
    201201        """ 
    202         Return a float in a standardized, human-readable formatted string  
    203         """ 
    204         try:  
     202        Return a float in a standardized, human-readable formatted string 
     203        """ 
     204        try: 
    205205            value = float(value) 
    206206        except: 
     
    209209 
    210210        output = "%-7.4g" % value 
    211         return output.lstrip().rstrip()    
     211        return output.lstrip().rstrip() 
    212212     
    213213    def _onparamEnter(self, event = None): 
     
    216216        """ 
    217217        self.on_compute(event) 
    218               
     218 
    219219class KiessigWindow(widget.CHILD_FRAME): 
    220220    def __init__(self, parent=None, manager=None,  
     
    239239        self.Destroy() 
    240240 
    241          
    242 if __name__ == "__main__":  
     241if __name__ == "__main__": 
    243242    app = wx.PySimpleApp() 
    244243    widget.CHILD_FRAME = wx.Frame 
    245     frame = KiessigWindow()     
     244    frame = KiessigWindow() 
    246245    frame.Show(True) 
    247     app.MainLoop()      
     246    app.MainLoop() 
Note: See TracChangeset for help on using the changeset viewer.