Changeset 44d20af in sasview for src/sas/guiframe/data_processor.py


Ignore:
Timestamp:
Jul 26, 2015 4:40:18 PM (9 years ago)
Author:
butler
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:
c95a1a5
Parents:
1d115ef
Message:

fix sphinx documentation compile errors (and pylint white spaces)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/guiframe/data_processor.py

    ra12c0a6 r44d20af  
    99 
    1010The organization of the classes goes as: 
    11 .. image::  media/BatchGridClassLayout.png 
     11 
     12.. image::  ../../user/guiframe/BatchGridClassLayout.png 
    1213   :align:   center 
    1314 
     
    3738    """ 
    3839    Object describing a cell in  the grid. 
    39  
    4040    """ 
    4141    def __init__(self): 
    4242        """ 
    4343        Initialize attributes of class (label, value, col, row, object) 
    44          
    4544        """ 
    4645        self.label = "" 
     
    5453    """ 
    5554    Return a dictionary of column label and index or row selected 
    56      
     55 
    5756    :param sentence: String to parse 
    5857    :param list: list of columns label 
    59      
     58    :returns: col_dict 
    6059    """ 
    6160 
     
    116115 
    117116class GridCellEditor(sheet.CCellEditor): 
    118     """  
     117    """ 
    119118    Custom cell editor 
    120      
     119 
    121120    This subclasses the sheet.CCellEditor (itself a subclass of 
    122121    grid.GridCellEditor) in order to override two of its methods: 
     
    125124    This is necessary as the sheet module is broken in wx 3.0.2 and 
    126125    improperly subclasses grid.GridCellEditor 
    127      
    128126    """ 
    129127    def __init__(self, grid): 
    130128        """ 
    131129        Override of CCellEditor init. Runs the grid.GridCellEditor init code 
    132  
    133130        """ 
    134131        super(GridCellEditor, self).__init__(grid) 
    135132 
    136133    def PaintBackground(self, dc, rect, attr): 
    137         """  
     134        """ 
    138135        Overrides wx.sheet.CCellEditor.PaintBackground which incorrectly calls 
    139136        the base class method. 
    140          
     137 
    141138        In wx3.0 all paint objects must explicitly 
    142139        have a wxPaintDC (Device Context) object.  Thus the paint event which 
     
    145142        not updated to reflect this and hence fails.  This could thus 
    146143        become obsolete in a future bug fix of wxPython. 
    147          
     144 
    148145        Apart from adding a dc variable in the list of arguments in the def 
    149146        and in the call to the base class the rest of this method is copied 
    150147        as is from sheet.CCellEditor.PaintBackground 
    151          
    152         :param dc: the wxDC object for the paint 
    153         ------- 
     148 
     149        **From original GridCellEditor docs:** 
     150 
    154151        Draws the part of the cell not occupied by the edit control.  The 
    155152        base class version just fills it with background colour from the 
     
    159156        to do something out of the ordinary. 
    160157 
     158        :param dc: the wxDC object for the paint 
    161159        """ 
    162160        # Call base class method. 
     
    165163 
    166164    def EndEdit(self, row, col, grid, previous): 
    167         """  
     165        """ 
    168166        Commit editing the current cell. Returns True if the value has changed. 
    169          
     167 
    170168        :param previous: previous value in the cell 
    171          
    172169        """ 
    173170        changed = False                             # Assume value not changed 
     
    184181    """ 
    185182    Class that receives the results of a batch fit. 
    186      
     183 
    187184    GridPage displays the received results in a wx.grid using sheet.  This is 
    188185    then used by GridPanel and GridFrame to present the full GUI. 
    189      
    190186    """ 
    191187    def __init__(self, parent, panel=None): 
    192188        """ 
    193189        Initialize 
    194          
     190 
    195191        Initialize all the attributes of GridPage, and the events. include 
    196192        the init stuff from sheet.CSheet as well. 
    197          
    198193        """ 
    199194        #sheet.CSheet.__init__(self, parent) 
    200          
     195 
    201196        # The following is the __init__ from CSheet. ########################## 
    202197        # We re-write it here because the class is broken in wx 3.0, 
     
    243238        # CSheet init method.  Basically these override any intrinsic binding 
    244239        self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
    245         self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click)         
     240        self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
    246241 
    247242        self.AdjustScrollbars() 
     
    283278        if self.GetNumberCols() > 0: 
    284279            self.default_col_width = self.GetColSize(0) 
    285         # We have moved these to the top of the init section with the  
    286         # rest of the grid event bindings from the sheet init when  
     280        # We have moved these to the top of the init section with the 
     281        # rest of the grid event bindings from the sheet init when 
    287282        # appropriate 
    288283        #self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
     
    295290        """ 
    296291        Overrides sheet.CSheet.OnLefClick. 
    297          
     292 
    298293        Processes when a cell is selected by left clicking on that cell. First 
    299294        process the base Sheet method then the current class specific method 
    300           
    301295        """ 
    302296        sheet.CSheet.OnLeftClick(self, event) 
    303297        self.on_selected_cell(event) 
    304          
     298 
    305299 
    306300    def OnCellChange(self, event): 
    307301        """ 
    308302        Overrides sheet.CSheet.OnCellChange.   
    309          
     303 
    310304        Processes when a cell has been edited by a cell editor. Checks for the 
    311305        edited row being outside the max row to use attribute and if so updates 
    312         the last row.  Then calls the base handler using skip.  
    313  
     306        the last row.  Then calls the base handler using skip. 
    314307        """ 
    315308        row, _ = event.GetRow(), event.GetCol() 
     
    323316        """ 
    324317        Handler catching cell selection. 
    325          
     318 
    326319        Called after calling base 'on left click' method. 
    327  
    328320        """ 
    329321 
     
    398390        """ 
    399391        Is triggered when the left mouse button is clicked while the mouse 
    400         is hovering over the column 'label.'  
    401          
     392        is hovering over the column 'label.' 
     393 
    402394        This processes the information on the selected column: the column name 
    403395        (in row 0 of column) and the range of cells with a valid value to be 
    404396        used by the GridPanel set_axis methods. 
    405          
    406         """ 
    407          
     397        """ 
     398 
    408399        flag = event.CmdDown() or event.ControlDown() 
    409400 
     
    449440        """ 
    450441        Is triggered when the right mouse button is clicked while the mouse 
    451         is hovering over the column 'label.'  
    452          
     442        is hovering over the column 'label.' 
     443 
    453444        This brings up a context menu that allows the deletion of the column, 
    454         or the insertion of a new column either to the right or left of the  
     445        or the insertion of a new column either to the right or left of the 
    455446        current column.  If inserting a new column can insert a blank column or 
    456447        choose a number of hidden columns.  By default all the error parameters 
     
    458449        intrinsic variables stored with the data such as Temperature, pressure, 
    459450        time etc can be used to populate this menu. 
    460          
    461         """ 
    462          
     451        """ 
     452 
    463453        col = event.GetCol() 
    464454        row = event.GetRow() 
     
    497487        method called to populate the 'insert column before current column' 
    498488        submenu. 
    499          
    500         """ 
    501          
     489        """ 
     490 
    502491        if self.data is None: 
    503492            return 
     
    521510        Method called to populate the 'insert column after current column' 
    522511        submenu 
    523          
    524         """ 
    525          
     512        """ 
     513 
    526514        if self.data is None: 
    527515            return 
     
    546534        Called when user chooses remove from the column right click menu 
    547535        Checks the columnn exists then calls the remove_column method 
    548          
    549         """ 
    550          
     536        """ 
     537 
    551538        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    552539            col = self.selected_cols[0] 
     
    556543        """ 
    557544        Remove the col column from the current grid 
    558          
    559         """ 
    560          
     545        """ 
     546 
    561547        # add data to the grid     
    562548        row = 0 
     
    581567        of the column context menu obtained when right clicking on a given 
    582568        column header. 
    583          
     569 
    584570        Sets up to insert column into the current grid before the current 
    585571        highlighted column location and sets up what to populate that column 
    586572        with.  Then calls insert_column method to actually do the insertion.  
    587          
    588         """ 
    589          
     573        """ 
     574 
    590575        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    591576            col = self.selected_cols[0] 
     
    602587        Called when user chooses insert 'column after' submenu 
    603588        of the column context menu obtained when right clicking on a given 
    604         column header.  
    605          
     589        column header. 
     590 
    606591        Sets up to insert column into the current grid after the current 
    607592        highlighted column location and sets up what to populate that column 
    608593        with.  Then calls insert_column method to actually do the insertion.  
    609          
    610         """ 
    611          
     594        """ 
     595 
    612596        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    613597            col = self.selected_cols[0] + 1 
     
    623607        Insert column at position col with data[col_name] into the current 
    624608        grid. 
    625          
    626         """ 
    627          
     609        """ 
     610 
    628611        row = 0 
    629612        self.InsertCols(pos=col, numCols=1, updateLabels=True) 
     
    648631        """ 
    649632        Just calls the panel version of the method 
    650          
    651         """ 
    652          
     633        """ 
     634 
    653635        self.panel.set_xaxis(x=self.axis_value, label=self.axis_label) 
    654636 
     
    656638        """ 
    657639        Just calls the panel version of the method 
    658          
    659         """ 
     640        """ 
     641 
    660642        self.panel.set_yaxis(y=self.axis_value, label=self.axis_label) 
    661643 
     
    663645        """ 
    664646        Add data to the grid 
    665          
     647 
    666648        :param data_inputs: data to use from the context menu of the grid 
    667         :param data_ouputs: default columns deplayed 
    668          
    669         """ 
    670          
     649        :param data_ouputs: default columns displayed 
     650        """ 
     651 
    671652        self.file_name = file_name 
    672653        self.details = details 
     
    704685        """ 
    705686        Set the values in grids 
    706          
    707         """ 
    708          
     687        """ 
     688 
    709689        # add data to the grid 
    710690        row = 0 
     
    741721        """ 
    742722        Return value contained in the grid 
    743          
    744         """ 
    745          
     723        """ 
     724 
    746725        grid_view = {} 
    747726        for col in xrange(self.GetNumberCols()): 
     
    761740        """ 
    762741        Return number of total rows 
    763          
    764742        """ 
    765743        return self._rows 
     
    768746        """ 
    769747        Method to handle cell right click context menu.  
    770          
     748 
    771749        THIS METHOD IS NOT CURRENTLY USED.  It is designed to provide a 
    772750        cell pop up context by right clicking on a cell and gives the 
     
    774752        future versions and is being superceded by more traditional cut and 
    775753        paste options. 
    776          
    777         """ 
    778          
     754        """ 
     755 
    779756        wx_id = wx.NewId() 
    780757        c_menu = wx.Menu() 
     
    817794        future versions and is being superceded by more traditional cut and 
    818795        paste options 
    819  
    820796        """ 
    821797 
     
    825801        """ 
    826802        Called when paste is chosen from cell right click context menu 
    827          
     803 
    828804        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
    829805        context menu which is being removed. This will probably be removed in 
    830806        future versions and is being superceded by more traditional cut and 
    831807        paste options 
    832  
    833808        """ 
    834809 
     
    847822        future versions and is being superceded by more traditional cut and 
    848823        paste options 
    849  
    850824        """ 
    851825 
     
    857831    window_name = "Fit panel" 
    858832    ## Title to appear on top of the window 
    859      
    860833    """ 
    861      
     834 
    862835    window_caption = "Notebook " 
    863836 
     
    898871        display the close button on the tab if more than 1 tab exits. 
    899872        Otherwise remove the close button 
    900  
    901873        """ 
    902874 
     
    918890        Return the select cell range from a given selected column. Checks that 
    919891        all cells are from the same column 
    920  
    921892        """ 
    922893 
     
    949920        """ 
    950921        Add highlight rows 
    951  
    952922        """ 
    953923 
     
    980950        """ 
    981951        return dictionary of columns labels on the current page 
    982  
    983952        """ 
    984953 
     
    996965        Receive a list of cells and  create a string presenting the selected 
    997966        cells that can be used as data for one axis of a plot. 
    998          
     967 
    999968        :param cell_list: list of tuple 
    1000  
    1001969        """ 
    1002970        pos = self.GetSelection() 
     
    10751043        """ 
    10761044        close the page 
    1077  
    10781045        """ 
    10791046 
     
    11091076        Order a list of 'inputs.' Used to sort rows and columns to present 
    11101077        in batch results grid. 
    1111  
    11121078        """ 
    11131079 
     
    11431109        """ 
    11441110        Append a new column to the grid 
    1145  
    11461111        """ 
    11471112 
     
    11551120        """ 
    11561121        Remove the selected column from the grid 
    1157  
    11581122        """ 
    11591123        # I Believe this is no longer used now that we have removed the  
     
    11661130    """ 
    11671131    A ScrolledPanel class that contains the grid sheet as well as a number of 
    1168     widgets to create interesting plots and buttons for help etc.  
    1169  
     1132    widgets to create interesting plots and buttons for help etc. 
    11701133    """ 
    11711134 
     
    11741137        """ 
    11751138        Initialize the GridPanel 
    1176  
    11771139        """ 
    11781140 
     
    12641226        Get object represented by the given cells and plot them.  Basically 
    12651227        plot the colum in y vs the column in x. 
    1266  
    12671228        """ 
    12681229 
     
    13451306        """ 
    13461307        Evaluate the contains of textcrtl and plot result 
    1347  
    13481308        """ 
    13491309 
     
    14561416 
    14571417        :param evt: Triggers on clicking the help button 
    1458  
    14591418        """ 
    14601419 
     
    14711430        """ 
    14721431        Get sentence from dict 
    1473  
    14741432        """ 
    14751433 
     
    14881446        Draw the area related to the grid by adding it as the first element 
    14891447        in the panel's grid_sizer 
    1490  
    14911448        """ 
    14921449 
     
    14991456        Add the area containing all the plot options, buttons etc to a plotting 
    15001457        area sizer to later be added to the top level grid_sizer 
    1501  
    15021458        """ 
    15031459 
     
    15431499                                   (self.plot_button, 0, 
    15441500                                    wx.LEFT | wx.TOP | wx.BOTTOM, 12), 
    1545                                    (self.help_button,0,  
     1501                                   (self.help_button,0, 
    15461502                                    wx.LEFT | wx.TOP | wx.BOTTOM, 12)]) 
    15471503 
     
    15771533        """ 
    15781534        Get the selected column on  the visible grid and set values for axis 
    1579  
    15801535        """ 
    15811536 
     
    16011556 
    16021557        :param cell_list: list of tuple 
    1603  
    16041558        """ 
    16051559 
     
    16101564        """ 
    16111565        get controls to modify 
    1612  
    16131566        """ 
    16141567 
     
    16211574        """ 
    16221575        """ 
    1623         # I Believe this is no longer used now that we have removed the  
     1576        # I Believe this is no longer used now that we have removed the 
    16241577        # edit menu from the menubar - PDB July 12, 2015 
    16251578        if self.notebook is not None: 
     
    16291582        """ 
    16301583        """ 
    1631         # I Believe this is no longer used now that we have removed the  
     1584        # I Believe this is no longer used now that we have removed the 
    16321585        # edit menu from the menubar - PDB July 12, 2015 
    16331586        if self.notebook is not None: 
     
    16381591    """ 
    16391592    The main wx.Frame for the batch results grid 
    1640  
    16411593    """ 
    16421594 
     
    16451597        """ 
    16461598        Initialize the Frame 
    1647          
    16481599        """ 
    16491600 
     
    16901641        populates the edit menu on the menubar.  Not activated as of SasView 
    16911642        3.1.0 
    1692  
    16931643        """ 
    16941644        self.edit = wx.Menu() 
     
    17251675    def on_copy(self, event): 
    17261676        """ 
    1727         On Copy from the Edit menu item on the menubar   
    1728  
     1677        On Copy from the Edit menu item on the menubar 
    17291678        """ 
    17301679        # I Believe this is no longer used now that we have removed the  
     
    17391688        """ 
    17401689        On Paste from the Edit menu item on the menubar 
    1741  
    17421690        """ 
    17431691        # I Believe this is no longer used now that we have removed the  
     
    17521700        """ 
    17531701        On Clear from the Edit menu item on the menubar 
    1754  
    17551702        """ 
    17561703        # I Believe this is no longer used now that we have removed the  
     
    17631710        """ 
    17641711        Get Label Text 
    1765  
    17661712        """ 
    17671713        for item in self.insert_before_menu.GetMenuItems(): 
     
    17731719        """ 
    17741720        On remove column from the Edit menu Item on the menubar 
    1775  
    17761721        """ 
    17771722        # I Believe this is no longer used now that we have removed the  
     
    17841729        """ 
    17851730        On menu open 
    1786  
    17871731        """ 
    17881732        if self.file == event.GetMenu(): 
     
    18461790        """ 
    18471791        Saves data in grid to a csv file. 
    1848          
     1792 
    18491793        At this time only the columns displayed get saved.  Thus any error 
    18501794        bars not inserted before saving will not be saved in the file 
    1851  
    18521795        """ 
    18531796 
     
    18831826        """ 
    18841827        Open file containing batch result 
    1885  
    18861828        """ 
    18871829 
     
    18921834        """ 
    18931835        open excel and display batch result in Excel 
    1894  
    18951836        """ 
    18961837 
     
    19191860        """ 
    19201861        Append a new column to the grid 
    1921  
    19221862        """ 
    19231863        self.panel.add_column() 
     
    19261866        """ 
    19271867        Set data 
    1928  
    19291868        """ 
    19301869        self.panel.notebook.set_data(data_inputs=data_inputs, 
     
    19361875        """ 
    19371876        Add a new table 
    1938  
    19391877        """ 
    19401878        # DO not event.Skip(): it will make 2 pages 
     
    19441882    """ 
    19451883    Allow to select where the result of batch will be displayed or stored 
    1946  
    19471884    """ 
    19481885    def __init__(self, parent, data_inputs, data_outputs, file_name="", 
     
    19521889 
    19531890        :param parent: Window instantiating this dialog 
    1954         :param result: result to display in a grid or export to an external 
     1891        :param result: result to display in a grid or export to an external\ 
    19551892                application. 
    1956  
    19571893        """ 
    19581894 
     
    19781914        """ 
    19791915        Draw the content of the current dialog window 
    1980  
    19811916        """ 
    19821917 
     
    20331968        """ 
    20341969        Get the user selection and display output to the selected application 
    2035  
    20361970        """ 
    20371971 
     
    20461980        """ 
    20471981        close the Window 
    2048  
    20491982        """ 
    20501983 
     
    20551988        Receive event and display data into third party application 
    20561989        or save data to file. 
    2057  
    20581990        """ 
    20591991        if self.save_to_file.GetValue(): 
Note: See TracChangeset for help on using the changeset viewer.