Changeset 2f732b0 in sasview


Ignore:
Timestamp:
Mar 4, 2015 1:37:14 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:
2f4b430
Parents:
49ab5d7
Message:

pylint fixes

File:
1 edited

Legend:

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

    r49ab5d7 r2f732b0  
    33import sys 
    44from copy import deepcopy 
    5 from sas.dataloader.loader import Loader 
    65from sas.guiframe.utils import check_float 
    76 
     
    3130        self._reset_aperture = deepcopy(aperture) 
    3231        self._notes = "" 
    33         #self_description = "Edit aperture" 
    3432 
    3533        #Attributes for panel 
     
    6765        self.main_sizer = wx.BoxSizer(wx.VERTICAL) 
    6866        self.box_aperture = wx.StaticBox(self, -1, str("Aperture")) 
    69         self.boxsizer_aperture = wx.StaticBoxSizer(self.box_aperture, 
    70                                                    wx.VERTICAL) 
    71  
     67        self.boxsizer_aperture = wx.StaticBoxSizer(self.box_aperture, wx.VERTICAL) 
    7268        self.name_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    7369        self.type_sizer = wx.BoxSizer(wx.HORIZONTAL) 
     
    8379        #Aperture name [string] 
    8480        aperture_name_txt = wx.StaticText(self, -1, 'Aperture Name : ') 
    85         self.aperture_name_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH * 5, 20), 
    86                                               style=0) 
     81        self.aperture_name_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH * 5, 20), style=0) 
    8782        self.name_sizer.AddMany([(aperture_name_txt, 0, wx.LEFT | wx.RIGHT, 10), 
    88                                        (self.aperture_name_tcl, 0, wx.EXPAND)]) 
     83                                 (self.aperture_name_tcl, 0, wx.EXPAND)]) 
    8984    def _layout_type(self): 
    9085        """ 
     
    9590        self.type_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
    9691        self.type_sizer.AddMany([(type_txt, 0, wx.LEFT | wx.RIGHT, 10), 
    97                                      (self.type_tcl, 0, wx.LEFT, 20)]) 
     92                                 (self.type_tcl, 0, wx.LEFT, 20)]) 
    9893 
    9994    def _layout_distance(self): 
     
    106101                                        style=0) 
    107102        distance_unit_txt = wx.StaticText(self, -1, 'Unit: ') 
    108         self.distance_unit_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    109                                              style=0) 
     103        self.distance_unit_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
    110104        self.distance_sizer.AddMany([(distance_txt, 0, wx.LEFT | wx.RIGHT, 10), 
    111105                                     (self.distance_tcl, 0, wx.LEFT, 10), 
    112                                 (distance_unit_txt, 0, wx.LEFT | wx.RIGHT, 10), 
     106                                     (distance_unit_txt, 0, wx.LEFT | wx.RIGHT, 10), 
    113107                                     (self.distance_unit_tcl, 0, wx.EXPAND)]) 
    114108    def _layout_size_name(self): 
     
    118112        # Size name [string] 
    119113        size_name_txt = wx.StaticText(self, -1, 'Size Name : ') 
    120         self.size_name_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH * 5, 20), 
    121                                           style=0) 
     114        self.size_name_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH * 5, 20), style=0) 
    122115        self.size_name_sizer.AddMany([(size_name_txt, 0, wx.LEFT | wx.RIGHT, 10), 
    123                                        (self.size_name_tcl, 0, wx.EXPAND)]) 
     116                                      (self.size_name_tcl, 0, wx.EXPAND)]) 
    124117 
    125118    def _layout_size(self): 
     
    130123        aperture_size_txt = wx.StaticText(self, -1, 'Size:') 
    131124        x_aperture_size_txt = wx.StaticText(self, -1, 'x = ') 
    132         self.x_aperture_size_tcl = wx.TextCtrl(self, -1, 
    133                                                size=(_BOX_WIDTH, 20), style=0) 
     125        self.x_aperture_size_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
    134126        y_aperture_size_txt = wx.StaticText(self, -1, 'y = ') 
    135         self.y_aperture_size_tcl = wx.TextCtrl(self, -1, 
    136                                                 size=(_BOX_WIDTH, 20), style=0) 
     127        self.y_aperture_size_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
    137128        z_aperture_size_txt = wx.StaticText(self, -1, 'z = ') 
    138         self.z_aperture_size_tcl = wx.TextCtrl(self, -1, 
    139                                                 size=(_BOX_WIDTH, 20), style=0) 
     129        self.z_aperture_size_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
    140130        aperture_size_unit_txt = wx.StaticText(self, -1, 'Unit: ') 
    141         self.aperture_size_unit_tcl = wx.TextCtrl(self, -1, 
    142                                                 size=(_BOX_WIDTH, 20), style=0) 
    143         self.aperture_size_sizer.AddMany([(aperture_size_txt, 
    144                                          0, wx.LEFT | wx.RIGHT, 10), 
    145                                      (x_aperture_size_txt, 0, wx.LEFT, 17), 
    146                                 (self.x_aperture_size_tcl, 0, wx.RIGHT, 10), 
    147                                      (y_aperture_size_txt, 0, wx.EXPAND), 
    148                                 (self.y_aperture_size_tcl, 0, wx.RIGHT, 10), 
    149                                      (z_aperture_size_txt, 0, wx.EXPAND), 
    150                                 (self.z_aperture_size_tcl, 0, wx.RIGHT, 10), 
    151                                      (aperture_size_unit_txt, 0, wx.EXPAND), 
    152                             (self.aperture_size_unit_tcl, 0, wx.RIGHT, 10)]) 
     131        self.aperture_size_unit_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
     132        self.aperture_size_sizer.AddMany([(aperture_size_txt, 0, wx.LEFT | wx.RIGHT, 10), 
     133                                          (x_aperture_size_txt, 0, wx.LEFT, 17), 
     134                                          (self.x_aperture_size_tcl, 0, wx.RIGHT, 10), 
     135                                          (y_aperture_size_txt, 0, wx.EXPAND), 
     136                                          (self.y_aperture_size_tcl, 0, wx.RIGHT, 10), 
     137                                          (z_aperture_size_txt, 0, wx.EXPAND), 
     138                                          (self.z_aperture_size_tcl, 0, wx.RIGHT, 10), 
     139                                          (aperture_size_unit_txt, 0, wx.EXPAND), 
     140                                          (self.aperture_size_unit_tcl, 0, wx.RIGHT, 10)]) 
    153141 
    154142    def _layout_button(self): 
     
    179167        self._layout_size() 
    180168        self._layout_button() 
    181         self.boxsizer_aperture.AddMany([(self.name_sizer, 0, 
    182                                           wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
    183                                    (self.type_sizer, 0, 
    184                                      wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
    185                                    (self.distance_sizer, 0, 
    186                                      wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
    187                                    (self.size_name_sizer, 0, 
    188                                     wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
    189                                    (self.aperture_size_sizer, 0, 
    190                                     wx.EXPAND | wx.TOP | wx.BOTTOM, 5)]) 
     169        self.boxsizer_aperture.AddMany([(self.name_sizer, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
     170                                        (self.type_sizer, 0, 
     171                                         wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
     172                                        (self.distance_sizer, 0, 
     173                                         wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
     174                                        (self.size_name_sizer, 0, 
     175                                         wx.EXPAND | wx.TOP | wx.BOTTOM, 5), 
     176                                        (self.aperture_size_sizer, 0, 
     177                                         wx.EXPAND | wx.TOP | wx.BOTTOM, 5)]) 
    191178        self.main_sizer.AddMany([(self.boxsizer_aperture, 0, wx.ALL, 10), 
    192                                   (self.button_sizer, 0, 
    193                                     wx.EXPAND | wx.TOP | wx.BOTTOM, 5)]) 
     179                                 (self.button_sizer, 0, 
     180                                  wx.EXPAND | wx.TOP | wx.BOTTOM, 5)]) 
    194181        self.SetSizer(self.main_sizer) 
    195182        self.SetAutoLayout(True) 
     
    229216        #distance unit 
    230217        self.distance_unit_tcl.SetValue(str(aperture.distance_unit)) 
    231         #Size name  
     218        #Size name 
    232219        self.size_name_tcl.SetValue(str(aperture.size_name)) 
    233220        #Aperture size as a vector 
     
    267254        Change aperture type 
    268255        """ 
    269         #Change type  
    270         type = self.type_tcl.GetValue().lstrip().rstrip() 
    271         self._aperture.type = type 
     256        #Change type 
     257        type_value = self.type_tcl.GetValue().lstrip().rstrip() 
     258        self._aperture.type = type_value 
    272259        self._notes += " Change type from" 
    273         self._notes += " %s to %s \n" % (self._aperture.type, type) 
     260        self._notes += " %s to %s \n" % (self._aperture.type, type_value) 
    274261 
    275262    def on_change_distance(self): 
     
    286273                if self._aperture.distance != float(distance): 
    287274                    self._notes += "Change distance from " 
    288                     self._notes += "%s to %s \n" % (self._aperture.distance, 
    289                                                   distance) 
     275                    self._notes += "%s to %s \n" % (self._aperture.distance, distance) 
    290276                    self._aperture.distance = float(distance) 
    291277            else: 
     
    319305        else: 
    320306            if check_float(self.x_aperture_size_tcl): 
    321                 if self._aperture.size.x != float(x_aperture_size) : 
     307                if self._aperture.size.x != float(x_aperture_size): 
    322308                    self._notes += "Change x of aperture size from " 
    323                     self._notes += "%s to %s \n" % (self._aperture.size.x, 
    324                                                    x_aperture_size) 
     309                    self._notes += "%s to %s \n" % (self._aperture.size.x, x_aperture_size) 
    325310                    self._aperture.aperture_size.x = float(x_aperture_size) 
    326311            else: 
     
    328313                self._notes += " float for the aperture size 's x " 
    329314                self._notes += "won't changes x aperture size from " 
    330                 self._notes += "%s to %s" % (self._aperture.size.x, 
    331                                            x_aperture_size) 
     315                self._notes += "%s to %s" % (self._aperture.size.x, x_aperture_size) 
    332316        #Change y coordinate 
    333317        y_aperture_size = self.y_aperture_size_tcl.GetValue().lstrip().rstrip() 
     
    339323                if self._aperture.size.y != float(y_aperture_size): 
    340324                    self._notes += "Change y of aperture size from " 
    341                     self._notes += "%s to %s \n" % (self._aperture.size.y, 
    342                                                    y_aperture_size) 
     325                    self._notes += "%s to %s \n" % (self._aperture.size.y, y_aperture_size) 
    343326                    self._aperture.size.y = float(y_aperture_size) 
    344327            else: 
     
    346329                self._notes += " aperture size's y " 
    347330                self._notes += "won't changes y aperture size from " 
    348                 self._notes += "%s to %s" % (self._aperture.size.y, 
    349                                             y_aperture_size) 
     331                self._notes += "%s to %s" % (self._aperture.size.y, y_aperture_size) 
    350332        #Change z coordinate 
    351333        z_aperture_size = self.z_aperture_size_tcl.GetValue().lstrip().rstrip() 
     
    357339                if self._aperture.size.z != float(z_aperture_size): 
    358340                    self._notes += "Change z of aperture size from " 
    359                     self._notes += "%s to %s \n" % (self._aperture.size.z, 
    360                                                    z_aperture_size) 
     341                    self._notes += "%s to %s \n" % (self._aperture.size.z, z_aperture_size) 
    361342                    self._aperture.size.z = float(z_aperture_size) 
    362343            else: 
    363344                self._notes += "Error: Expected a float for the offset 's x " 
    364345                self._notes += "won't changes z aperture size from " 
    365                 self._notes += "%s to %s" % (self._aperture.size.z, 
    366                                             z_aperture_size) 
     346                self._notes += "%s to %s" % (self._aperture.size.z, z_aperture_size) 
    367347        #change the aperture center unit 
    368348        unit = self.aperture_size_unit_tcl.GetValue().lstrip().rstrip() 
     
    394374        self.set_values() 
    395375        if self.manager is not None: 
    396              self.manager.set_aperture(self._aperture) 
     376            self.manager.set_aperture(self._aperture) 
    397377        if event is not None: 
    398378            event.Skip() 
    399  
    400 if __name__ == "__main__": 
    401  
    402     app = wx.App() 
    403     # Instantiate a loader  
    404     loader = Loader() 
    405     # Load data  
    406     from sas.dataloader.data_info import Aperture 
    407     ap = Aperture() 
    408     dlg = ApertureDialog(aperture=ap) 
    409     dlg.ShowModal() 
    410     app.MainLoop() 
Note: See TracChangeset for help on using the changeset viewer.