Changeset a7aa5c7 in sasview


Ignore:
Timestamp:
Jul 12, 2015 4:14:07 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:
a12c0a6
Parents:
d3d67f0
Message:

Final fixes (hopefully) to Batch Grid

1) Added back right click on label to allow insertion of columns
2) Added back left click on label to allow correct handling of set axix
for plots
3) Added override for sheet.CSheet.PaintBackground? which has not been
updated to account for the need to always have a dc object on a paint
event in wx.Python 3 — probably the main problem with sheet - edit was
working but generating a pile of errors behind the scenes.
4) Fixed the exception raised on insert column submenu due to removing
Edit menu. Needed to remove chunk of code or grab the wx.Menu handle.
Did later.
5) Added lots of doc strings but most are not rendering so need to
figure out why at some point - but not a release issue.

File:
1 edited

Legend:

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

    re54dbc3e ra7aa5c7  
    11""" 
    2 Implement grid used to store data 
     2Implement grid used to store results of a batch fit. 
     3 
     4This is in Guiframe rather than fitting which is probably where it should be. 
     5Actually could be a generic framework implemented in fit gui module.  At this 
     6point however there this grid behaves independently of the fitting panel and 
     7only knows about information sent to it but not about the fits or fit panel and 
     8thus cannot feed back to the fitting panel.  This could change in the future. 
     9 
     10The organization of the classes goes as: 
     11#      ------------------------------------------------------------ 
     12#      | --------------------------------------------------------  | 
     13#      | | ----------------------------------------------------  | | 
     14#      | | | ------------------------------------------------  | | | 
     15#      | | | | --------------------------------------------  | | | | 
     16#      | | | |                                               | | | | 
     17#      | | | |                                               | | | | 
     18#      | | | |     GridPage Class = the actual grid          | | | | 
     19#      | | | |       GridCellEditor: overides class of same  | | | | 
     20#      | | | |          name in the wx.CSheet module         | | | | 
     21#      | | | |       BatchCell:  class defines a cell within | | | | 
     22#      | | | |          within the grid                      | | | | 
     23#      | | | |                                               | | | | 
     24#      | | | |                                               | | | | 
     25#      | | | ------------------------------------------------- | | | 
     26#      | | |       Notebook class: contains all the GridPages  | | | 
     27#      | | -----              ---------------------------------| | | 
     28#      | |      |  Page 1     |                                  | | 
     29#      | |      ---------------                                  | | 
     30#      | |                                                       | | 
     31#      | |    ----------------------------------------------     | | 
     32#      | |                                                       | | 
     33#      | |    Plotting area = a standard gridsizer               | | 
     34#      | |     layout managed by the GridPanel class directly    | | 
     35#      | |                                                       | | 
     36#      | |    ----------------------------------------------     | | 
     37#      | |                                                       | | 
     38#      | |      GridPanel Class(SPanel(ScrolledPanel)            | | 
     39#      | |         contains the GridPage and the 'plotting area' | | 
     40#      | |         below it                                      | | 
     41#      | --------------------------------------------------------- | 
     42#      |                                                           | 
     43#      |            GridFrame class(wx.Frame)                      | 
     44#      ------------------------------------------------------------- 
     45 
    346""" 
    447import wx 
     
    2972    """ 
    3073    def __init__(self): 
     74        """ 
     75        Initialize attributes of class (label, value, col, row, object) 
     76         
     77        """ 
    3178        self.label = "" 
    3279        self.value = None 
     
    3986    """ 
    4087    Return a dictionary of column label and index or row selected 
    41     :param sentence: String to parse 
    42     :param list: list of columns label 
     88     
     89    @param sentence: String to parse 
     90    @param list: list of columns label 
     91     
    4392    """ 
     93 
    4494    p2 = re.compile(r'\d+') 
    4595    p = re.compile(r'[\+\-\*\%\/]') 
     
    81131 
    82132class SPanel(ScrolledPanel): 
     133    """ 
     134    ensure proper scrolling of GridPanel  
     135     
     136    Adds a SetupScrolling call to the normal ScrolledPanel init.     
     137    GridPanel then subclasses this class 
     138     
     139    """ 
    83140    def __init__(self, parent, *args, **kwds): 
     141        """ 
     142        initialize ScrolledPanel then force a call to SetupScrolling 
     143 
     144        """ 
    84145        ScrolledPanel.__init__(self, parent, *args, **kwds) 
    85146        self.SetupScrolling() 
     
    87148 
    88149class GridCellEditor(sheet.CCellEditor): 
    89     """ Custom cell editor """ 
     150    """  
     151    Custom cell editor 
     152     
     153    This subclasses the sheet.CCellEditor (itself a subclass of 
     154    grid.GridCellEditor) in order to override two of its methods: 
     155    PaintBackrgound and EndEdit. 
     156     
     157    This is necessary as the sheet module is broken in wx 3.0.2 and 
     158    improperly subclasses grid.GridCellEditor 
     159     
     160    """ 
    90161    def __init__(self, grid): 
     162        """ 
     163        Override of CCellEditor init. Runs the grid.GridCellEditor init code 
     164 
     165        """ 
    91166        super(GridCellEditor, self).__init__(grid) 
     167 
     168    def PaintBackground(self, dc, rect, attr): 
     169        """  
     170        Overrides wx.sheet.CCellEditor.PaintBackground which incorrectly calls 
     171        the base class method. 
     172         
     173        In wx3.0 all paint objects must explicitly 
     174        have a wxPaintDC (Device Context) object.  Thus the paint event which 
     175        generates a call to this method provides such a DC object and the 
     176        base class in grid expects to receive that object.  sheet was apparently 
     177        not updated to reflect this and hence fails.  This could thus 
     178        become obsolete in a future bug fix of wxPython. 
     179         
     180        Apart from adding a dc variable in the list of arguments in the def 
     181        and in the call to the base class the rest of this method is copied 
     182        as is from sheet.CCellEditor.PaintBackground 
     183         
     184        @param dc: the wxDC object for the paint 
     185        ------- 
     186        Draws the part of the cell not occupied by the edit control.  The 
     187        base class version just fills it with background colour from the 
     188        attribute. 
     189 
     190        NOTE: There is no need to override this if you don't need 
     191        to do something out of the ordinary. 
     192 
     193        """ 
     194        # Call base class method. 
     195        DC = dc 
     196        super(sheet.CCellEditor,self).PaintBackground(DC, rect, attr) 
    92197 
    93198    def EndEdit(self, row, col, grid, previous): 
    94199        """  
    95             Commit editing the current cell. Returns True if the value has changed. 
    96             @param previous: previous value in the cell 
     200        Commit editing the current cell. Returns True if the value has changed. 
     201         
     202        @param previous: previous value in the cell 
     203         
    97204        """ 
    98205        changed = False                             # Assume value not changed 
     
    108215class GridPage(sheet.CSheet): 
    109216    """ 
     217    Class that receives the results of a batch fit. 
     218     
     219    GridPage displays the received results in a wx.grid using sheet.  This is 
     220    then used by GridPanel and GridFrame to present the full GUI. 
     221     
    110222    """ 
    111223    def __init__(self, parent, panel=None): 
    112224        """ 
     225        Initialize 
     226         
     227        Initialize all the attributes of GridPage, and the events. include 
     228        the init stuff from sheet.CSheet as well. 
     229         
    113230        """ 
    114231        #sheet.CSheet.__init__(self, parent) 
     
    139256 
    140257        # Sink events 
     258        self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self.OnRangeSelect) 
     259        self.Bind(wx.grid.EVT_GRID_ROW_SIZE, self.OnRowSize) 
     260        self.Bind(wx.grid.EVT_GRID_COL_SIZE, self.OnColSize) 
     261        self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnGridSelectCell) 
     262        # NOTE: the following bind to standard sheet methods that are 
     263        # overriden in this subclassn - actually we have currently 
     264        # disabled the on_context_menu that would override the OnRightClick 
     265        self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange) 
    141266        self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftClick) 
    142267        self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightClick) 
    143268        #self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnLeftDoubleClick) 
    144         self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self.OnRangeSelect) 
    145         self.Bind(wx.grid.EVT_GRID_ROW_SIZE, self.OnRowSize) 
    146         self.Bind(wx.grid.EVT_GRID_COL_SIZE, self.OnColSize) 
    147         self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange) 
    148         self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnGridSelectCell) 
    149269        # This ends the __init__ section for CSheet. ########################## 
     270 
     271 
     272 
     273        # The following events must be bound even if CSheet is working  
     274        # properly and does not need the above re-implementation of the 
     275        # CSheet init method.  Basically these override any intrinsic binding 
     276        self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
     277        self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click)         
    150278 
    151279        self.AdjustScrollbars() 
     
    187315        if self.GetNumberCols() > 0: 
    188316            self.default_col_width = self.GetColSize(0) 
     317        # We have moved these to the top of the init section with the  
     318        # rest of the grid event bindings from the sheet init when  
     319        # appropriate 
    189320        #self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
    190321        #self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
     
    194325 
    195326    def OnLeftClick(self, event): 
     327        """ 
     328        Overrides sheet.CSheet.OnLefClick. 
     329         
     330        Processes when a cell is selected by left clicking on that cell. First 
     331        process the base Sheet method then the current class specific method 
     332          
     333        """ 
    196334        sheet.CSheet.OnLeftClick(self, event) 
    197335        self.on_selected_cell(event) 
    198336         
    199     def on_edit_cell(self, event): 
    200         """ 
     337 
     338    def OnCellChange(self, event): 
     339        """ 
     340        Overrides sheet.CSheet.OnCellChange.   
     341         
     342        Processes when a cell has been edited by a cell editor. Checks for the 
     343        edited row being outside the max row to use attribute and if so updates 
     344        the last row.  Then calls the base handler using skip.  
     345 
    201346        """ 
    202347        row, _ = event.GetRow(), event.GetCol() 
     
    209354    def on_selected_cell(self, event): 
    210355        """ 
    211         Handler catching cell selection 
    212         """ 
     356        Handler catching cell selection. 
     357         
     358        Called after calling base 'on left click' method. 
     359 
     360        """ 
     361 
    213362        flag = event.CmdDown() or event.ControlDown() 
    214363        flag_shift = event.ShiftDown() 
     
    280429    def on_left_click(self, event): 
    281430        """ 
    282         Catch the left click on label mouse event 
    283         """ 
     431        Is triggered when the left mouse button is clicked while the mouse 
     432        is hovering over the column 'label.'  
     433         
     434        This processes the information on the selected column: the column name 
     435        (in row 0 of column) and the range of cells with a valid value to be 
     436        used by the GridPanel set_axis methods. 
     437         
     438        """ 
     439         
    284440        flag = event.CmdDown() or event.ControlDown() 
    285441 
     
    324480    def on_right_click(self, event): 
    325481        """ 
    326         Catch the right click mouse 
    327         """ 
     482        Is triggered when the right mouse button is clicked while the mouse 
     483        is hovering over the column 'label.'  
     484         
     485        This brings up a context menu that allows the deletion of the column, 
     486        or the insertion of a new column either to the right or left of the  
     487        current column.  If inserting a new column can insert a blank column or 
     488        choose a number of hidden columns.  By default all the error parameters 
     489        are in hidden columns so as to save space on the grid.  Also any other 
     490        intrinsic variables stored with the data such as Temperature, pressure, 
     491        time etc can be used to populate this menu. 
     492         
     493        """ 
     494         
    328495        col = event.GetCol() 
    329496        row = event.GetRow() 
     
    360527    def insert_col_menu(self, menu, label, window): 
    361528        """ 
    362         """ 
     529        method called to populate the 'insert column before current column' 
     530        submenu. 
     531         
     532        """ 
     533         
    363534        if self.data is None: 
    364535            return 
     
    380551    def insert_after_col_menu(self, menu, label, window): 
    381552        """ 
    382         """ 
     553        Method called to populate the 'insert column after current column' 
     554        submenu 
     555         
     556        """ 
     557         
    383558        if self.data is None: 
    384559            return 
     
    401576    def on_remove_column(self, event=None): 
    402577        """ 
    403         """ 
     578        Called when user chooses remove from the column right click menu 
     579        Checks the columnn exists then calls the remove_column method 
     580         
     581        """ 
     582         
    404583        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    405584            col = self.selected_cols[0] 
     
    408587    def remove_column(self, col, numCols=1): 
    409588        """ 
    410         Remove column to the current grid 
    411         """ 
     589        Remove the col column from the current grid 
     590         
     591        """ 
     592         
    412593        # add data to the grid     
    413594        row = 0 
     
    429610    def on_insert_column(self, event): 
    430611        """ 
    431         """ 
     612        Called when user chooses insert 'column before' submenu 
     613        of the column context menu obtained when right clicking on a given 
     614        column header. 
     615         
     616        Sets up to insert column into the current grid before the current 
     617        highlighted column location and sets up what to populate that column 
     618        with.  Then calls insert_column method to actually do the insertion.  
     619         
     620        """ 
     621         
    432622        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    433623            col = self.selected_cols[0] 
     
    442632    def on_insert_after_column(self, event): 
    443633        """ 
    444         Insert the given column after the highlighted column 
    445         """ 
     634        Called when user chooses insert 'column after' submenu 
     635        of the column context menu obtained when right clicking on a given 
     636        column header.  
     637         
     638        Sets up to insert column into the current grid after the current 
     639        highlighted column location and sets up what to populate that column 
     640        with.  Then calls insert_column method to actually do the insertion.  
     641         
     642        """ 
     643         
    446644        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    447645            col = self.selected_cols[0] + 1 
     
    455653    def insert_column(self, col, col_name): 
    456654        """ 
    457         """ 
     655        Insert column at position col with data[col_name] into the current 
     656        grid. 
     657         
     658        """ 
     659         
    458660        row = 0 
    459661        self.InsertCols(pos=col, numCols=1, updateLabels=True) 
     
    477679    def on_set_x_axis(self, event): 
    478680        """ 
    479         """ 
     681        Just calls the panel version of the method 
     682         
     683        """ 
     684         
    480685        self.panel.set_xaxis(x=self.axis_value, label=self.axis_label) 
    481686 
    482687    def on_set_y_axis(self, event): 
    483688        """ 
     689        Just calls the panel version of the method 
     690         
    484691        """ 
    485692        self.panel.set_yaxis(y=self.axis_value, label=self.axis_label) 
     
    488695        """ 
    489696        Add data to the grid 
    490         :param data_inputs: data to use from the context menu of the grid 
    491         :param data_ouputs: default columns deplayed 
    492         """ 
     697         
     698        @param data_inputs: data to use from the context menu of the grid 
     699        @param data_ouputs: default columns deplayed 
     700         
     701        """ 
     702         
    493703        self.file_name = file_name 
    494704        self.details = details 
     
    526736        """ 
    527737        Set the values in grids 
    528         """ 
     738         
     739        """ 
     740         
    529741        # add data to the grid 
    530742        row = 0 
     
    561773        """ 
    562774        Return value contained in the grid 
    563         """ 
     775         
     776        """ 
     777         
    564778        grid_view = {} 
    565779        for col in xrange(self.GetNumberCols()): 
     
    579793        """ 
    580794        Return number of total rows 
     795         
    581796        """ 
    582797        return self._rows 
     
    584799    def onContextMenu(self, event): 
    585800        """ 
    586         Default context menu 
    587         """ 
     801        Method to handle cell right click context menu.  
     802         
     803        THIS METHOD IS NOT CURRENTLY USED.  It is designed to provide a 
     804        cell pop up context by right clicking on a cell and gives the 
     805        option to cut, paste, and clear. This will probably be removed in 
     806        future versions and is being superceded by more traditional cut and 
     807        paste options. 
     808         
     809        """ 
     810         
    588811        wx_id = wx.NewId() 
    589812        c_menu = wx.Menu() 
     
    620843    def on_copy(self, event): 
    621844        """ 
    622         On copy event from the contextmenu 
    623         """ 
     845        Called when copy is chosen from cell right click context menu 
     846 
     847        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
     848        context menu which is being removed. This will probably be removed in 
     849        future versions and is being superceded by more traditional cut and 
     850        paste options 
     851 
     852        """ 
     853 
    624854        self.Copy() 
    625855 
    626856    def on_paste(self, event): 
    627857        """ 
    628         On paste event from the contextmenu 
    629         """ 
     858        Called when paste is chosen from cell right click context menu 
     859         
     860        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
     861        context menu which is being removed. This will probably be removed in 
     862        future versions and is being superceded by more traditional cut and 
     863        paste options 
     864 
     865        """ 
     866 
    630867        if self.data == None: 
    631868            self.data = {} 
     
    636873    def on_clear(self, event): 
    637874        """ 
    638         Clear the cells selected 
    639         """ 
     875        Called when clear cell is chosen from cell right click context menu 
     876 
     877        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
     878        context menu which is being removed. This will probably be removed in 
     879        future versions and is being superceded by more traditional cut and 
     880        paste options 
     881 
     882        """ 
     883 
    640884        self.Clear() 
    641885 
     
    645889    window_name = "Fit panel" 
    646890    ## Title to appear on top of the window 
     891     
    647892    """ 
     893     
    648894    window_caption = "Notebook " 
    649895 
     
    682928    def enable_close_button(self): 
    683929        """ 
    684         display the close button on tab for more than 1 tabs else remove the 
    685         close button 
    686         """ 
     930        display the close button on the tab if more than 1 tab exits. 
     931        Otherwise remove the close button 
     932 
     933        """ 
     934 
    687935        if self.GetPageCount() <= 1: 
    688936            style = self.GetWindowStyleFlag() 
     
    700948    def on_edit_axis(self): 
    701949        """ 
    702         Return the select cell of a given selected column. Check that all cells 
    703         are from the same column 
    704         """ 
     950        Return the select cell range from a given selected column. Checks that 
     951        all cells are from the same column 
     952 
     953        """ 
     954 
    705955        pos = self.GetSelection() 
    706956        grid = self.GetPage(pos) 
     
    731981        """ 
    732982        Add highlight rows 
    733         """ 
     983 
     984        """ 
     985 
    734986        pos = self.GetSelection() 
    735987        grid = self.GetPage(pos) 
     
    7591011    def get_column_labels(self): 
    7601012        """ 
    761         return dictionary of columns labels of the current page 
    762         """ 
     1013        return dictionary of columns labels on the current page 
     1014 
     1015        """ 
     1016 
    7631017        pos = self.GetSelection() 
    7641018        grid = self.GetPage(pos) 
     
    7731027        """ 
    7741028        Receive a list of cells and  create a string presenting the selected 
    775         cells. 
    776         :param cell_list: list of tuple 
     1029        cells that can be used as data for one axis of a plot. 
     1030         
     1031        @param cell_list: list of tuple 
    7771032 
    7781033        """ 
     
    8521107        """ 
    8531108        close the page 
    854         """ 
     1109 
     1110        """ 
     1111 
    8551112        if self.GetPageCount() == 1: 
    8561113            event.Veto() 
     
    8581115 
    8591116    def set_data(self, data_inputs, data_outputs, details="", file_name=None): 
     1117        """ 
     1118        """ 
    8601119        if data_outputs is None or data_outputs == {}: 
    8611120            return 
     
    8801139    def get_odered_results(self, inputs, outputs=None): 
    8811140        """ 
    882         Get ordered the results 
    883         """ 
     1141        Order a list of 'inputs.' Used to sort rows and columns to present 
     1142        in batch results grid. 
     1143 
     1144        """ 
     1145 
    8841146        # Let's re-order the data from the keys in 'Data' name. 
    8851147        if outputs == None: 
     
    9131175        """ 
    9141176        Append a new column to the grid 
    915         """ 
     1177 
     1178        """ 
     1179 
     1180        # I Believe this is no longer used now that we have removed the  
     1181        # edit menu from the menubar - PDB July 12, 2015 
    9161182        pos = self.GetSelection() 
    9171183        grid = self.GetPage(pos) 
     
    9211187        """ 
    9221188        Remove the selected column from the grid 
    923         """ 
     1189 
     1190        """ 
     1191        # I Believe this is no longer used now that we have removed the  
     1192        # edit menu from the menubar - PDB July 12, 2015 
    9241193        pos = self.GetSelection() 
    9251194        grid = self.GetPage(pos) 
     
    9271196 
    9281197class GridPanel(SPanel): 
     1198    """ 
     1199    A ScrolledPanel class that contains the grid sheet as well as a number of 
     1200    widgets to create interesting plots and buttons for help etc.  
     1201 
     1202    """ 
     1203 
    9291204    def __init__(self, parent, data_inputs=None, 
    9301205                 data_outputs=None, *args, **kwds): 
     1206        """ 
     1207        Initialize the GridPanel 
     1208 
     1209        """ 
     1210 
    9311211        SPanel.__init__(self, parent, *args, **kwds) 
    9321212 
     
    9901270    def get_plot_axis(self, col, list): 
    9911271        """ 
    992  
    9931272        """ 
    9941273        axis = [] 
     
    10151294    def on_view(self, event): 
    10161295        """ 
    1017         Get object represented buy the given cell and plot them. 
    1018         """ 
     1296        Get object represented by the given cells and plot them.  Basically 
     1297        plot the colum in y vs the column in x. 
     1298 
     1299        """ 
     1300 
    10191301        pos = self.notebook.GetSelection() 
    10201302        grid = self.notebook.GetPage(pos) 
     
    10951377        """ 
    10961378        Evaluate the contains of textcrtl and plot result 
    1097         """ 
     1379 
     1380        """ 
     1381 
    10981382        pos = self.notebook.GetSelection() 
    10991383        grid = self.notebook.GetPage(pos) 
     
    12031487        running "file:///...." 
    12041488 
    1205     :param evt: Triggers on clicking the help button 
    1206     """ 
     1489        @param evt: Triggers on clicking the help button 
     1490 
     1491        """ 
     1492 
    12071493        #import documentation window here to avoid circular imports 
    12081494        #if put at top of file with rest of imports. 
     
    12171503        """ 
    12181504        Get sentence from dict 
    1219         """ 
     1505 
     1506        """ 
     1507 
    12201508        for tok, (col_name, list) in dict.iteritems(): 
    12211509            col = column_names[col_name] 
     
    12301518    def layout_grid(self): 
    12311519        """ 
    1232         Draw the area related to the grid 
    1233         """ 
     1520        Draw the area related to the grid by adding it as the first element 
     1521        in the panel's grid_sizer 
     1522 
     1523        """ 
     1524 
    12341525        self.notebook = Notebook(parent=self) 
    12351526        self.notebook.set_data(self._data_inputs, self._data_outputs) 
     
    12381529    def layout_plotting_area(self): 
    12391530        """ 
    1240         Draw area containing options to plot 
    1241         """ 
     1531        Add the area containing all the plot options, buttons etc to a plotting 
     1532        area sizer to later be added to the top level grid_sizer 
     1533 
     1534        """ 
     1535 
    12421536        view_description = wx.StaticBox(self, -1, 'Plot Fits/Residuals') 
    12431537        note = "To plot the fits (or residuals), click the 'View Fits' button" 
     
    13151609        """ 
    13161610        Get the selected column on  the visible grid and set values for axis 
    1317         """ 
     1611 
     1612        """ 
     1613 
    13181614        try: 
    13191615            cell_list = self.notebook.on_edit_axis() 
     
    13351631        Receive a list of cells and  create a string presenting the selected 
    13361632        cells. 
    1337         :param cell_list: list of tuple 
    1338  
    1339         """ 
     1633 
     1634        @param cell_list: list of tuple 
     1635 
     1636        """ 
     1637 
    13401638        if self.notebook is not None: 
    13411639            return self.notebook.create_axis_label(cell_list) 
     
    13441642        """ 
    13451643        get controls to modify 
    1346         """ 
     1644 
     1645        """ 
     1646 
    13471647        if label != None: 
    13481648            tcrtl_label.SetValue(str(label)) 
     
    13531653        """ 
    13541654        """ 
     1655        # I Believe this is no longer used now that we have removed the  
     1656        # edit menu from the menubar - PDB July 12, 2015 
    13551657        if self.notebook is not None: 
    13561658            self.notebook.add_column() 
     
    13591661        """ 
    13601662        """ 
     1663        # I Believe this is no longer used now that we have removed the  
     1664        # edit menu from the menubar - PDB July 12, 2015 
    13611665        if self.notebook is not None: 
    13621666            self.notebook.on_remove_column() 
     
    13641668 
    13651669class GridFrame(wx.Frame): 
     1670    """ 
     1671    The main wx.Frame for the batch results grid 
     1672 
     1673    """ 
     1674 
    13661675    def __init__(self, parent=None, data_inputs=None, data_outputs=None, id=-1, 
    1367                  title="Grid Window", size=(800, 500)): 
     1676                 title="Batch Fitting Results Panel", size=(800, 500)): 
     1677        """ 
     1678        Initialize the Frame 
     1679         
     1680        """ 
     1681 
    13681682        wx.Frame.__init__(self, parent=parent, id=id, title=title, size=size) 
    13691683        self.parent = parent 
     
    13891703        wx.EVT_MENU(self, self.save_menu.GetId(), self.on_save_page) 
    13901704 
    1391         # To add the edit menu, call add_edit_menu() here. 
    1392         self.edit = None 
     1705        # We need to grab a WxMenu handle here, otherwise the next one to grab 
     1706        # the handle will be treated as the Edit Menu handle when checking in 
     1707        # on_menu_open event handler and thus raise an exception when it hits an  
     1708        # unitialized object.  Alternative is to comment out that whole section 
     1709        # in on_menu_open, but that would make it more difficult to undo the 
     1710        # hidding of the menu.   PDB  July 12, 2015. 
     1711        # 
     1712        # To enable the Edit menubar comment out next line and uncomment the 
     1713        # following line. 
     1714        self.edit = wx.Menu() 
     1715        #self.add_edit_menu() 
     1716 
    13931717        self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open) 
    1394          
    13951718        self.Bind(wx.EVT_CLOSE, self.on_close) 
    13961719 
    13971720    def add_edit_menu(self, menubar): 
     1721        """ 
     1722        populates the edit menu on the menubar.  Not activated as of SasView 
     1723        3.1.0 
     1724 
     1725        """ 
    13981726        self.edit = wx.Menu() 
    13991727 
     
    14291757    def on_copy(self, event): 
    14301758        """ 
    1431         On Copy 
    1432         """ 
     1759        On Copy from the Edit menu item on the menubar   
     1760 
     1761        """ 
     1762        # I Believe this is no longer used now that we have removed the  
     1763        # edit menu from the menubar - PDB July 12, 2015 
    14331764        if event != None: 
    14341765            event.Skip() 
     
    14391770    def on_paste(self, event): 
    14401771        """ 
    1441         On Paste 
    1442         """ 
     1772        On Paste from the Edit menu item on the menubar 
     1773 
     1774        """ 
     1775        # I Believe this is no longer used now that we have removed the  
     1776        # edit menu from the menubar - PDB July 12, 2015 
    14431777        if event != None: 
    14441778            event.Skip() 
     
    14491783    def on_clear(self, event): 
    14501784        """ 
    1451         On Clear 
    1452         """ 
     1785        On Clear from the Edit menu item on the menubar 
     1786 
     1787        """ 
     1788        # I Believe this is no longer used now that we have removed the  
     1789        # edit menu from the menubar - PDB July 12, 2015 
    14531790        pos = self.panel.notebook.GetSelection() 
    14541791        grid = self.panel.notebook.GetPage(pos) 
     
    14581795        """ 
    14591796        Get Label Text 
     1797 
    14601798        """ 
    14611799        for item in self.insert_before_menu.GetMenuItems(): 
     
    14661804    def on_remove_column(self, event): 
    14671805        """ 
    1468         On remove column 
    1469         """ 
     1806        On remove column from the Edit menu Item on the menubar 
     1807 
     1808        """ 
     1809        # I Believe this is no longer used now that we have removed the  
     1810        # edit menu from the menubar - PDB July 12, 2015 
    14701811        pos = self.panel.notebook.GetSelection() 
    14711812        grid = self.panel.notebook.GetPage(pos) 
     
    14751816        """ 
    14761817        On menu open 
     1818 
    14771819        """ 
    14781820        if self.file == event.GetMenu(): 
     
    15351877    def on_save_page(self, event): 
    15361878        """ 
    1537         """ 
     1879        Saves data in grid to a csv file. 
     1880         
     1881        At this time only the columns displayed get saved.  Thus any error 
     1882        bars not inserted before saving will not be saved in the file 
     1883 
     1884        """ 
     1885 
    15381886        if self.parent is not None: 
    15391887            pos = self.panel.notebook.GetSelection() 
     
    15661914    def on_open(self, event): 
    15671915        """ 
    1568         Open file containg batch result 
    1569         """ 
     1916        Open file containing batch result 
     1917 
     1918        """ 
     1919 
    15701920        if self.parent is not None: 
    15711921            self.parent.on_read_batch_tofile(self) 
     
    15741924        """ 
    15751925        open excel and display batch result in Excel 
    1576         """ 
     1926 
     1927        """ 
     1928 
    15771929        if self.parent is not None: 
    15781930            pos = self.panel.notebook.GetSelection() 
     
    15991951        """ 
    16001952        Append a new column to the grid 
     1953 
    16011954        """ 
    16021955        self.panel.add_column() 
     
    16051958        """ 
    16061959        Set data 
     1960 
    16071961        """ 
    16081962        self.panel.notebook.set_data(data_inputs=data_inputs, 
     
    16141968        """ 
    16151969        Add a new table 
     1970 
    16161971        """ 
    16171972        # DO not event.Skip(): it will make 2 pages 
     
    16211976    """ 
    16221977    Allow to select where the result of batch will be displayed or stored 
     1978 
    16231979    """ 
    16241980    def __init__(self, parent, data_inputs, data_outputs, file_name="", 
    16251981                 details="", *args, **kwds): 
    16261982        """ 
    1627         :param parent: Window instantiating this dialog 
    1628         :param result: result to display in a grid or export to an external 
     1983        Initialize dialog 
     1984 
     1985        @param parent: Window instantiating this dialog 
     1986        @param result: result to display in a grid or export to an external 
    16291987                application. 
    1630         """ 
     1988 
     1989        """ 
     1990 
    16311991        #kwds['style'] = wx.CAPTION|wx.SYSTEM_MENU 
    16321992        wx.Frame.__init__(self, parent, *args, **kwds) 
     
    16502010        """ 
    16512011        Draw the content of the current dialog window 
    1652         """ 
     2012 
     2013        """ 
     2014 
    16532015        vbox = wx.BoxSizer(wx.VERTICAL) 
    16542016        box_description = wx.StaticBox(self.panel, -1, str("Batch Outputs")) 
     
    17032065        """ 
    17042066        Get the user selection and display output to the selected application 
    1705         """ 
     2067 
     2068        """ 
     2069 
    17062070        if self.flag == 1: 
    17072071            self.parent.open_with_localapp(data_inputs=self.data_inputs, 
     
    17142078        """ 
    17152079        close the Window 
    1716         """ 
     2080 
     2081        """ 
     2082 
    17172083        self.Close() 
    17182084 
Note: See TracChangeset for help on using the changeset viewer.