Changeset 225aca8 in sasview for src/sas/guiframe


Ignore:
Timestamp:
Jul 28, 2015 12:14:38 PM (9 years ago)
Author:
mathieu
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:
a910c788
Parents:
ae2a197 (diff), d06c34c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge pull request #3 from SasView?/standalone_cleanup

Standalone cleanup

Location:
src/sas/guiframe
Files:
2 added
11 edited

Legend:

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

    r957af0d r225aca8  
    235235        Initialize the Frame object 
    236236        """ 
    237  
    238237        PARENT_FRAME.__init__(self, parent=parent, title=title, pos=pos, size=size) 
    239238        # title 
     
    364363                    frame.SetIcon(icon) 
    365364                except: 
    366                     pass 
     365                    logging.error("ViewerFrame.put_icon: could not set icon") 
    367366 
    368367    def get_client_size(self): 
     
    752751            self._toolbar.Realize() 
    753752 
    754  
    755753    def build_gui(self): 
    756754        """ 
     
    778776        # Append item from plugin under menu file if necessary 
    779777        self._populate_file_menu() 
    780  
    781778 
    782779        if not wx.VERSION_STRING >= '3.0.0.0': 
     
    822819        # Load panels 
    823820        self._load_panels() 
    824         self.set_default_perspective() 
    825821 
    826822    def SetStatusText(self, *args, **kwds): 
     
    931927                        if hasattr(module, "PLUGIN_ID"): 
    932928                            try: 
    933                                 plug = module.Plugin() 
    934                                 if plug.set_default_perspective(): 
    935                                     self._current_perspective = plug 
    936                                 plugins.append(plug) 
    937  
     929                                plugins.append(module.Plugin()) 
    938930                                msg = "Found plug-in: %s" % module.PLUGIN_ID 
    939931                                logging.info(msg) 
     
    15111503                for item in plugin.populate_file_menu(): 
    15121504                    m_name, m_hint, m_handler = item 
    1513                     id = wx.NewId() 
    1514                     self._file_menu.Append(id, m_name, m_hint) 
    1515                     wx.EVT_MENU(self, id, m_handler) 
     1505                    wx_id = wx.NewId() 
     1506                    self._file_menu.Append(wx_id, m_name, m_hint) 
     1507                    wx.EVT_MENU(self, wx_id, m_handler) 
    15161508                self._file_menu.AppendSeparator() 
    15171509 
    15181510        style1 = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 
    15191511        if OPEN_SAVE_MENU: 
    1520             id = wx.NewId() 
     1512            wx_id = wx.NewId() 
    15211513            hint_load_file = "read all analysis states saved previously" 
    1522             self._save_appl_menu = self._file_menu.Append(id, '&Open Project', hint_load_file) 
    1523             wx.EVT_MENU(self, id, self._on_open_state_project) 
     1514            self._save_appl_menu = self._file_menu.Append(wx_id, '&Open Project', hint_load_file) 
     1515            wx.EVT_MENU(self, wx_id, self._on_open_state_project) 
    15241516 
    15251517        if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
     
    15271519            hint_load_file = "Read a status files and load" 
    15281520            hint_load_file += " them into the analysis" 
    1529             id = wx.NewId() 
    1530             self._save_appl_menu = self._file_menu.Append(id, 
     1521            wx_id = wx.NewId() 
     1522            self._save_appl_menu = self._file_menu.Append(wx_id, 
    15311523                                                          '&Open Analysis', hint_load_file) 
    1532             wx.EVT_MENU(self, id, self._on_open_state_application) 
     1524            wx.EVT_MENU(self, wx_id, self._on_open_state_application) 
    15331525        if OPEN_SAVE_MENU: 
    15341526            self._file_menu.AppendSeparator() 
    1535             id = wx.NewId() 
    1536             self._file_menu.Append(id, '&Save Project', 
     1527            wx_id = wx.NewId() 
     1528            self._file_menu.Append(wx_id, '&Save Project', 
    15371529                                   'Save the state of the whole analysis') 
    1538             wx.EVT_MENU(self, id, self._on_save_project) 
     1530            wx.EVT_MENU(self, wx_id, self._on_save_project) 
    15391531        if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
    1540             id = wx.NewId() 
    1541             self._save_appl_menu = self._file_menu.Append(id, \ 
     1532            wx_id = wx.NewId() 
     1533            self._save_appl_menu = self._file_menu.Append(wx_id, \ 
    15421534                '&Save Analysis', 'Save state of the current active analysis panel') 
    1543             wx.EVT_MENU(self, id, self._on_save_application) 
     1535            wx.EVT_MENU(self, wx_id, self._on_save_application) 
    15441536        if not sys.platform == 'darwin': 
    15451537            self._file_menu.AppendSeparator() 
    1546             id = wx.NewId() 
    1547             self._file_menu.Append(id, '&Quit', 'Exit') 
    1548             wx.EVT_MENU(self, id, self.Close) 
     1538            wx_id = wx.NewId() 
     1539            self._file_menu.Append(wx_id, '&Quit', 'Exit') 
     1540            wx.EVT_MENU(self, wx_id, self.Close) 
    15491541 
    15501542    def _add_menu_file(self): 
     
    17171709        """ 
    17181710        """ 
    1719         message = "" 
    17201711        log_msg = '' 
    1721         output = [] 
    1722         error_message = "" 
    17231712        basename = os.path.basename(path) 
    1724         root, extension = os.path.splitext(basename) 
     1713        _, extension = os.path.splitext(basename) 
    17251714        if extension.lower() not in EXTENSIONS: 
    17261715            log_msg = "File Loader cannot " 
     
    22242213            if hasattr(item, "post_init"): 
    22252214                item.post_init() 
    2226  
    2227     def set_default_perspective(self): 
    2228         """ 
    2229         Choose among the plugin the first plug-in that has 
    2230         "set_default_perspective" method and its return value is True will be 
    2231         as a default perspective when the welcome page is closed 
    2232         """ 
    2233         for item in self.plugins: 
    2234             if hasattr(item, "set_default_perspective"): 
    2235                 if item.set_default_perspective(): 
    2236                     item.on_perspective(event=None) 
    2237                     return 
    22382215 
    22392216    def set_perspective(self, panels): 
     
    24142391            total_plot_list.append(theory_data) 
    24152392        for new_plot in total_plot_list: 
    2416             id = new_plot.id 
    24172393            for group_id in new_plot.list_group_id: 
    2418                 wx.PostEvent(self, NewPlotEvent(id=id, 
     2394                wx.PostEvent(self, NewPlotEvent(id=new_plot.id, 
    24192395                                                group_id=group_id, 
    24202396                                                action='remove')) 
    24212397                #remove res plot: Todo: improve 
    2422                 wx.CallAfter(self._remove_res_plot, id) 
     2398                wx.CallAfter(self._remove_res_plot, new_plot.id) 
    24232399        self._data_manager.delete_data(data_id=data_id, 
    24242400                                       theory_id=theory_id) 
     
    24552431            ext_num = dlg.GetFilterIndex() 
    24562432            if ext_num == 0: 
    2457                 format = '.txt' 
     2433                ext_format = '.txt' 
    24582434            else: 
    2459                 format = '.xml' 
    2460             path = os.path.splitext(path)[0] + format 
     2435                ext_format = '.xml' 
     2436            path = os.path.splitext(path)[0] + ext_format 
    24612437            mypath = os.path.basename(path) 
    24622438 
    24632439            #Instantiate a loader 
    24642440            loader = Loader() 
    2465             format = ".txt" 
    2466             if os.path.splitext(mypath)[1].lower() == format: 
     2441            ext_format = ".txt" 
     2442            if os.path.splitext(mypath)[1].lower() == ext_format: 
    24672443                # Make sure the ext included in the file name 
    24682444                # especially on MAC 
    2469                 fName = os.path.splitext(path)[0] + format 
     2445                fName = os.path.splitext(path)[0] + ext_format 
    24702446                self._onsaveTXT(data, fName) 
    2471             format = ".xml" 
    2472             if os.path.splitext(mypath)[1].lower() == format: 
     2447            ext_format = ".xml" 
     2448            if os.path.splitext(mypath)[1].lower() == ext_format: 
    24732449                # Make sure the ext included in the file name 
    24742450                # especially on MAC 
    2475                 fName = os.path.splitext(path)[0] + format 
    2476                 loader.save(fName, data, format) 
     2451                fName = os.path.splitext(path)[0] + ext_format 
     2452                loader.save(fName, data, ext_format) 
    24772453            try: 
    24782454                self._default_save_location = os.path.dirname(path) 
     
    25982574            ext_num = dlg.GetFilterIndex() 
    25992575            if ext_num == 0: 
    2600                 format = '.dat' 
     2576                ext_format = '.dat' 
    26012577            else: 
    2602                 format = '' 
    2603             path = os.path.splitext(path)[0] + format 
     2578                ext_format = '' 
     2579            path = os.path.splitext(path)[0] + ext_format 
    26042580            mypath = os.path.basename(path) 
    26052581 
     
    26072583            loader = Loader() 
    26082584 
    2609             format = ".dat" 
    2610             if os.path.splitext(mypath)[1].lower() == format: 
     2585            ext_format = ".dat" 
     2586            if os.path.splitext(mypath)[1].lower() == ext_format: 
    26112587                # Make sure the ext included in the file name 
    26122588                # especially on MAC 
    2613                 fileName = os.path.splitext(path)[0] + format 
    2614                 loader.save(fileName, data, format) 
     2589                fileName = os.path.splitext(path)[0] + ext_format 
     2590                loader.save(fileName, data, ext_format) 
    26152591            try: 
    26162592                self._default_save_location = os.path.dirname(path) 
     
    32063182 
    32073183 
    3208 class ViewApp(wx.App): 
     3184class SasViewApp(wx.App): 
    32093185    """ 
    3210     Toy application to test this Frame 
     3186    SasView application 
    32113187    """ 
    32123188    def OnInit(self): 
     
    32943270            if len(os.listdir(model_folder)) > 0: 
    32953271                try: 
    3296                     for file in os.listdir(model_folder): 
    3297                         file_path = os.path.join(model_folder, file) 
     3272                    for filename in os.listdir(model_folder): 
     3273                        file_path = os.path.join(model_folder, filename) 
    32983274                        if os.path.isfile(file_path): 
    32993275                            os.remove(file_path) 
     
    33143290        """ 
    33153291        #try to load file at the start 
    3316         try: 
    3317             self.open_file() 
    3318         except: 
    3319             raise 
     3292        self.open_file() 
    33203293        self.frame.build_gui() 
    33213294 
  • src/sas/guiframe/local_perspectives/data_loader/data_loader.py

    rf76bf17 rf21d496  
    4141class Plugin(PluginBase): 
    4242 
    43     def __init__(self, standalone=False): 
    44         PluginBase.__init__(self, name="DataLoader", standalone=standalone) 
     43    def __init__(self): 
     44        PluginBase.__init__(self, name="DataLoader") 
    4545        # Default location 
    4646        self._default_save_location = DEFAULT_OPEN_FOLDER 
  • src/sas/guiframe/local_perspectives/plotting/plotting.py

    rc039589 rf21d496  
    3636    """ 
    3737 
    38     def __init__(self, standalone=False): 
    39         PluginBase.__init__(self, name="Plotting", standalone=standalone) 
     38    def __init__(self): 
     39        PluginBase.__init__(self, name="Plotting") 
    4040 
    4141        ## Plot panels 
  • src/sas/guiframe/plugin_base.py

    r373d4ee rf21d496  
    3434    """ 
    3535 
    36     def __init__(self, name="Test_plugin", standalone=True): 
     36    def __init__(self, name="Test_plugin"): 
    3737        """ 
    3838        Abstract class for gui_manager Plugins. 
     
    4242        ## Plug-in name. It will appear on the application menu. 
    4343        self.sub_menu = name 
    44         #standalone flag 
    45         self.standalone = standalone 
    4644        ## Reference to the parent window. Filled by get_panels() below. 
    4745        self.parent = None 
     
    263261        pass 
    264262 
    265     def set_default_perspective(self): 
    266         """ 
    267        Call back method that True to notify the parent that the current plug-in 
    268        can be set as default  perspective. 
    269        when returning False, the plug-in is not candidate for an automatic 
    270        default perspective setting 
    271         """ 
    272         if self.standalone: 
    273             return True 
    274         return False 
    275  
    276263    def set_state(self, state=None, datainfo=None):     
    277264        """ 
  • src/sas/guiframe/config.py

    r5846bb5 r9989a6a  
    1010__build__ = '1' 
    1111__download_page__ = 'https://github.com/SasView/sasview/releases' 
    12 __update_URL__ = ['raw.githubusercontent.com', 
    13                   '/SasView/sasview/master/sasview.latestversion'] 
     12__update_URL__ = 'http://www.sasview.org/latestversion.json' 
    1413 
    1514 
  • src/sas/guiframe/data_processor.py

    re54dbc3e r44d20af  
    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.. image::  ../../user/guiframe/BatchGridClassLayout.png 
     13   :align:   center 
     14 
    315""" 
    416import wx 
     
    2638    """ 
    2739    Object describing a cell in  the grid. 
    28  
    2940    """ 
    3041    def __init__(self): 
     42        """ 
     43        Initialize attributes of class (label, value, col, row, object) 
     44        """ 
    3145        self.label = "" 
    3246        self.value = None 
     
    3953    """ 
    4054    Return a dictionary of column label and index or row selected 
     55 
    4156    :param sentence: String to parse 
    4257    :param list: list of columns label 
     58    :returns: col_dict 
    4359    """ 
     60 
    4461    p2 = re.compile(r'\d+') 
    4562    p = re.compile(r'[\+\-\*\%\/]') 
     
    8198 
    8299class SPanel(ScrolledPanel): 
     100    """ 
     101    ensure proper scrolling of GridPanel  
     102     
     103    Adds a SetupScrolling call to the normal ScrolledPanel init.     
     104    GridPanel then subclasses this class 
     105     
     106    """ 
    83107    def __init__(self, parent, *args, **kwds): 
     108        """ 
     109        initialize ScrolledPanel then force a call to SetupScrolling 
     110 
     111        """ 
    84112        ScrolledPanel.__init__(self, parent, *args, **kwds) 
    85113        self.SetupScrolling() 
     
    87115 
    88116class GridCellEditor(sheet.CCellEditor): 
    89     """ Custom cell editor """ 
     117    """ 
     118    Custom cell editor 
     119 
     120    This subclasses the sheet.CCellEditor (itself a subclass of 
     121    grid.GridCellEditor) in order to override two of its methods: 
     122    PaintBackrgound and EndEdit. 
     123     
     124    This is necessary as the sheet module is broken in wx 3.0.2 and 
     125    improperly subclasses grid.GridCellEditor 
     126    """ 
    90127    def __init__(self, grid): 
     128        """ 
     129        Override of CCellEditor init. Runs the grid.GridCellEditor init code 
     130        """ 
    91131        super(GridCellEditor, self).__init__(grid) 
    92132 
     133    def PaintBackground(self, dc, rect, attr): 
     134        """ 
     135        Overrides wx.sheet.CCellEditor.PaintBackground which incorrectly calls 
     136        the base class method. 
     137 
     138        In wx3.0 all paint objects must explicitly 
     139        have a wxPaintDC (Device Context) object.  Thus the paint event which 
     140        generates a call to this method provides such a DC object and the 
     141        base class in grid expects to receive that object.  sheet was apparently 
     142        not updated to reflect this and hence fails.  This could thus 
     143        become obsolete in a future bug fix of wxPython. 
     144 
     145        Apart from adding a dc variable in the list of arguments in the def 
     146        and in the call to the base class the rest of this method is copied 
     147        as is from sheet.CCellEditor.PaintBackground 
     148 
     149        **From original GridCellEditor docs:** 
     150 
     151        Draws the part of the cell not occupied by the edit control.  The 
     152        base class version just fills it with background colour from the 
     153        attribute. 
     154 
     155        NOTE: There is no need to override this if you don't need 
     156        to do something out of the ordinary. 
     157 
     158        :param dc: the wxDC object for the paint 
     159        """ 
     160        # Call base class method. 
     161        DC = dc 
     162        super(sheet.CCellEditor,self).PaintBackground(DC, rect, attr) 
     163 
    93164    def EndEdit(self, row, col, grid, previous): 
    94         """  
    95             Commit editing the current cell. Returns True if the value has changed. 
    96             @param previous: previous value in the cell 
     165        """ 
     166        Commit editing the current cell. Returns True if the value has changed. 
     167 
     168        :param previous: previous value in the cell 
    97169        """ 
    98170        changed = False                             # Assume value not changed 
     
    108180class GridPage(sheet.CSheet): 
    109181    """ 
     182    Class that receives the results of a batch fit. 
     183 
     184    GridPage displays the received results in a wx.grid using sheet.  This is 
     185    then used by GridPanel and GridFrame to present the full GUI. 
    110186    """ 
    111187    def __init__(self, parent, panel=None): 
    112188        """ 
     189        Initialize 
     190 
     191        Initialize all the attributes of GridPage, and the events. include 
     192        the init stuff from sheet.CSheet as well. 
    113193        """ 
    114194        #sheet.CSheet.__init__(self, parent) 
    115          
     195 
    116196        # The following is the __init__ from CSheet. ########################## 
    117197        # We re-write it here because the class is broken in wx 3.0, 
     
    139219 
    140220        # Sink events 
     221        self.Bind(wx.grid.EVT_GRID_RANGE_SELECT, self.OnRangeSelect) 
     222        self.Bind(wx.grid.EVT_GRID_ROW_SIZE, self.OnRowSize) 
     223        self.Bind(wx.grid.EVT_GRID_COL_SIZE, self.OnColSize) 
     224        self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnGridSelectCell) 
     225        # NOTE: the following bind to standard sheet methods that are 
     226        # overriden in this subclassn - actually we have currently 
     227        # disabled the on_context_menu that would override the OnRightClick 
     228        self.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnCellChange) 
    141229        self.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftClick) 
    142230        self.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightClick) 
    143231        #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) 
    149232        # This ends the __init__ section for CSheet. ########################## 
     233 
     234 
     235 
     236        # The following events must be bound even if CSheet is working  
     237        # properly and does not need the above re-implementation of the 
     238        # CSheet init method.  Basically these override any intrinsic binding 
     239        self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
     240        self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
    150241 
    151242        self.AdjustScrollbars() 
     
    187278        if self.GetNumberCols() > 0: 
    188279            self.default_col_width = self.GetColSize(0) 
     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 
     282        # appropriate 
    189283        #self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
    190284        #self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 
     
    194288 
    195289    def OnLeftClick(self, event): 
     290        """ 
     291        Overrides sheet.CSheet.OnLefClick. 
     292 
     293        Processes when a cell is selected by left clicking on that cell. First 
     294        process the base Sheet method then the current class specific method 
     295        """ 
    196296        sheet.CSheet.OnLeftClick(self, event) 
    197297        self.on_selected_cell(event) 
    198          
    199     def on_edit_cell(self, event): 
    200         """ 
     298 
     299 
     300    def OnCellChange(self, event): 
     301        """ 
     302        Overrides sheet.CSheet.OnCellChange.   
     303 
     304        Processes when a cell has been edited by a cell editor. Checks for the 
     305        edited row being outside the max row to use attribute and if so updates 
     306        the last row.  Then calls the base handler using skip. 
    201307        """ 
    202308        row, _ = event.GetRow(), event.GetCol() 
     
    209315    def on_selected_cell(self, event): 
    210316        """ 
    211         Handler catching cell selection 
    212         """ 
     317        Handler catching cell selection. 
     318 
     319        Called after calling base 'on left click' method. 
     320        """ 
     321 
    213322        flag = event.CmdDown() or event.ControlDown() 
    214323        flag_shift = event.ShiftDown() 
     
    280389    def on_left_click(self, event): 
    281390        """ 
    282         Catch the left click on label mouse event 
    283         """ 
     391        Is triggered when the left mouse button is clicked while the mouse 
     392        is hovering over the column 'label.' 
     393 
     394        This processes the information on the selected column: the column name 
     395        (in row 0 of column) and the range of cells with a valid value to be 
     396        used by the GridPanel set_axis methods. 
     397        """ 
     398 
    284399        flag = event.CmdDown() or event.ControlDown() 
    285400 
     
    324439    def on_right_click(self, event): 
    325440        """ 
    326         Catch the right click mouse 
    327         """ 
     441        Is triggered when the right mouse button is clicked while the mouse 
     442        is hovering over the column 'label.' 
     443 
     444        This brings up a context menu that allows the deletion of the column, 
     445        or the insertion of a new column either to the right or left of the 
     446        current column.  If inserting a new column can insert a blank column or 
     447        choose a number of hidden columns.  By default all the error parameters 
     448        are in hidden columns so as to save space on the grid.  Also any other 
     449        intrinsic variables stored with the data such as Temperature, pressure, 
     450        time etc can be used to populate this menu. 
     451        """ 
     452 
    328453        col = event.GetCol() 
    329454        row = event.GetRow() 
     
    360485    def insert_col_menu(self, menu, label, window): 
    361486        """ 
    362         """ 
     487        method called to populate the 'insert column before current column' 
     488        submenu. 
     489        """ 
     490 
    363491        if self.data is None: 
    364492            return 
     
    380508    def insert_after_col_menu(self, menu, label, window): 
    381509        """ 
    382         """ 
     510        Method called to populate the 'insert column after current column' 
     511        submenu 
     512        """ 
     513 
    383514        if self.data is None: 
    384515            return 
     
    401532    def on_remove_column(self, event=None): 
    402533        """ 
    403         """ 
     534        Called when user chooses remove from the column right click menu 
     535        Checks the columnn exists then calls the remove_column method 
     536        """ 
     537 
    404538        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    405539            col = self.selected_cols[0] 
     
    408542    def remove_column(self, col, numCols=1): 
    409543        """ 
    410         Remove column to the current grid 
    411         """ 
     544        Remove the col column from the current grid 
     545        """ 
     546 
    412547        # add data to the grid     
    413548        row = 0 
     
    429564    def on_insert_column(self, event): 
    430565        """ 
    431         """ 
     566        Called when user chooses insert 'column before' submenu 
     567        of the column context menu obtained when right clicking on a given 
     568        column header. 
     569 
     570        Sets up to insert column into the current grid before the current 
     571        highlighted column location and sets up what to populate that column 
     572        with.  Then calls insert_column method to actually do the insertion.  
     573        """ 
     574 
    432575        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    433576            col = self.selected_cols[0] 
     
    442585    def on_insert_after_column(self, event): 
    443586        """ 
    444         Insert the given column after the highlighted column 
    445         """ 
     587        Called when user chooses insert 'column after' submenu 
     588        of the column context menu obtained when right clicking on a given 
     589        column header. 
     590 
     591        Sets up to insert column into the current grid after the current 
     592        highlighted column location and sets up what to populate that column 
     593        with.  Then calls insert_column method to actually do the insertion.  
     594        """ 
     595 
    446596        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    447597            col = self.selected_cols[0] + 1 
     
    455605    def insert_column(self, col, col_name): 
    456606        """ 
    457         """ 
     607        Insert column at position col with data[col_name] into the current 
     608        grid. 
     609        """ 
     610 
    458611        row = 0 
    459612        self.InsertCols(pos=col, numCols=1, updateLabels=True) 
     
    477630    def on_set_x_axis(self, event): 
    478631        """ 
    479         """ 
     632        Just calls the panel version of the method 
     633        """ 
     634 
    480635        self.panel.set_xaxis(x=self.axis_value, label=self.axis_label) 
    481636 
    482637    def on_set_y_axis(self, event): 
    483638        """ 
    484         """ 
     639        Just calls the panel version of the method 
     640        """ 
     641 
    485642        self.panel.set_yaxis(y=self.axis_value, label=self.axis_label) 
    486643 
     
    488645        """ 
    489646        Add data to the grid 
     647 
    490648        :param data_inputs: data to use from the context menu of the grid 
    491         :param data_ouputs: default columns deplayed 
    492         """ 
     649        :param data_ouputs: default columns displayed 
     650        """ 
     651 
    493652        self.file_name = file_name 
    494653        self.details = details 
     
    527686        Set the values in grids 
    528687        """ 
     688 
    529689        # add data to the grid 
    530690        row = 0 
     
    562722        Return value contained in the grid 
    563723        """ 
     724 
    564725        grid_view = {} 
    565726        for col in xrange(self.GetNumberCols()): 
     
    584745    def onContextMenu(self, event): 
    585746        """ 
    586         Default context menu 
    587         """ 
     747        Method to handle cell right click context menu.  
     748 
     749        THIS METHOD IS NOT CURRENTLY USED.  It is designed to provide a 
     750        cell pop up context by right clicking on a cell and gives the 
     751        option to cut, paste, and clear. This will probably be removed in 
     752        future versions and is being superceded by more traditional cut and 
     753        paste options. 
     754        """ 
     755 
    588756        wx_id = wx.NewId() 
    589757        c_menu = wx.Menu() 
     
    620788    def on_copy(self, event): 
    621789        """ 
    622         On copy event from the contextmenu 
    623         """ 
     790        Called when copy is chosen from cell right click context menu 
     791 
     792        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
     793        context menu which is being removed. This will probably be removed in 
     794        future versions and is being superceded by more traditional cut and 
     795        paste options 
     796        """ 
     797 
    624798        self.Copy() 
    625799 
    626800    def on_paste(self, event): 
    627801        """ 
    628         On paste event from the contextmenu 
    629         """ 
     802        Called when paste is chosen from cell right click context menu 
     803 
     804        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
     805        context menu which is being removed. This will probably be removed in 
     806        future versions and is being superceded by more traditional cut and 
     807        paste options 
     808        """ 
     809 
    630810        if self.data == None: 
    631811            self.data = {} 
     
    636816    def on_clear(self, event): 
    637817        """ 
    638         Clear the cells selected 
    639         """ 
     818        Called when clear cell is chosen from cell right click context menu 
     819 
     820        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
     821        context menu which is being removed. This will probably be removed in 
     822        future versions and is being superceded by more traditional cut and 
     823        paste options 
     824        """ 
     825 
    640826        self.Clear() 
    641827 
     
    646832    ## Title to appear on top of the window 
    647833    """ 
     834 
    648835    window_caption = "Notebook " 
    649836 
     
    682869    def enable_close_button(self): 
    683870        """ 
    684         display the close button on tab for more than 1 tabs else remove the 
    685         close button 
    686         """ 
     871        display the close button on the tab if more than 1 tab exits. 
     872        Otherwise remove the close button 
     873        """ 
     874 
    687875        if self.GetPageCount() <= 1: 
    688876            style = self.GetWindowStyleFlag() 
     
    700888    def on_edit_axis(self): 
    701889        """ 
    702         Return the select cell of a given selected column. Check that all cells 
    703         are from the same column 
    704         """ 
     890        Return the select cell range from a given selected column. Checks that 
     891        all cells are from the same column 
     892        """ 
     893 
    705894        pos = self.GetSelection() 
    706895        grid = self.GetPage(pos) 
     
    732921        Add highlight rows 
    733922        """ 
     923 
    734924        pos = self.GetSelection() 
    735925        grid = self.GetPage(pos) 
     
    759949    def get_column_labels(self): 
    760950        """ 
    761         return dictionary of columns labels of the current page 
    762         """ 
     951        return dictionary of columns labels on the current page 
     952        """ 
     953 
    763954        pos = self.GetSelection() 
    764955        grid = self.GetPage(pos) 
     
    773964        """ 
    774965        Receive a list of cells and  create a string presenting the selected 
    775         cells. 
     966        cells that can be used as data for one axis of a plot. 
     967 
    776968        :param cell_list: list of tuple 
    777  
    778969        """ 
    779970        pos = self.GetSelection() 
     
    8531044        close the page 
    8541045        """ 
     1046 
    8551047        if self.GetPageCount() == 1: 
    8561048            event.Veto() 
     
    8581050 
    8591051    def set_data(self, data_inputs, data_outputs, details="", file_name=None): 
     1052        """ 
     1053        """ 
    8601054        if data_outputs is None or data_outputs == {}: 
    8611055            return 
     
    8801074    def get_odered_results(self, inputs, outputs=None): 
    8811075        """ 
    882         Get ordered the results 
    883         """ 
     1076        Order a list of 'inputs.' Used to sort rows and columns to present 
     1077        in batch results grid. 
     1078        """ 
     1079 
    8841080        # Let's re-order the data from the keys in 'Data' name. 
    8851081        if outputs == None: 
     
    9141110        Append a new column to the grid 
    9151111        """ 
     1112 
     1113        # I Believe this is no longer used now that we have removed the  
     1114        # edit menu from the menubar - PDB July 12, 2015 
    9161115        pos = self.GetSelection() 
    9171116        grid = self.GetPage(pos) 
     
    9221121        Remove the selected column from the grid 
    9231122        """ 
     1123        # I Believe this is no longer used now that we have removed the  
     1124        # edit menu from the menubar - PDB July 12, 2015 
    9241125        pos = self.GetSelection() 
    9251126        grid = self.GetPage(pos) 
     
    9271128 
    9281129class GridPanel(SPanel): 
     1130    """ 
     1131    A ScrolledPanel class that contains the grid sheet as well as a number of 
     1132    widgets to create interesting plots and buttons for help etc. 
     1133    """ 
     1134 
    9291135    def __init__(self, parent, data_inputs=None, 
    9301136                 data_outputs=None, *args, **kwds): 
     1137        """ 
     1138        Initialize the GridPanel 
     1139        """ 
     1140 
    9311141        SPanel.__init__(self, parent, *args, **kwds) 
    9321142 
     
    9901200    def get_plot_axis(self, col, list): 
    9911201        """ 
    992  
    9931202        """ 
    9941203        axis = [] 
     
    10151224    def on_view(self, event): 
    10161225        """ 
    1017         Get object represented buy the given cell and plot them. 
    1018         """ 
     1226        Get object represented by the given cells and plot them.  Basically 
     1227        plot the colum in y vs the column in x. 
     1228        """ 
     1229 
    10191230        pos = self.notebook.GetSelection() 
    10201231        grid = self.notebook.GetPage(pos) 
     
    10961307        Evaluate the contains of textcrtl and plot result 
    10971308        """ 
     1309 
    10981310        pos = self.notebook.GetSelection() 
    10991311        grid = self.notebook.GetPage(pos) 
     
    12031415        running "file:///...." 
    12041416 
    1205     :param evt: Triggers on clicking the help button 
    1206     """ 
     1417        :param evt: Triggers on clicking the help button 
     1418        """ 
     1419 
    12071420        #import documentation window here to avoid circular imports 
    12081421        #if put at top of file with rest of imports. 
     
    12181431        Get sentence from dict 
    12191432        """ 
     1433 
    12201434        for tok, (col_name, list) in dict.iteritems(): 
    12211435            col = column_names[col_name] 
     
    12301444    def layout_grid(self): 
    12311445        """ 
    1232         Draw the area related to the grid 
    1233         """ 
     1446        Draw the area related to the grid by adding it as the first element 
     1447        in the panel's grid_sizer 
     1448        """ 
     1449 
    12341450        self.notebook = Notebook(parent=self) 
    12351451        self.notebook.set_data(self._data_inputs, self._data_outputs) 
     
    12381454    def layout_plotting_area(self): 
    12391455        """ 
    1240         Draw area containing options to plot 
    1241         """ 
     1456        Add the area containing all the plot options, buttons etc to a plotting 
     1457        area sizer to later be added to the top level grid_sizer 
     1458        """ 
     1459 
    12421460        view_description = wx.StaticBox(self, -1, 'Plot Fits/Residuals') 
    12431461        note = "To plot the fits (or residuals), click the 'View Fits' button" 
     
    12811499                                   (self.plot_button, 0, 
    12821500                                    wx.LEFT | wx.TOP | wx.BOTTOM, 12), 
    1283                                    (self.help_button,0,  
     1501                                   (self.help_button,0, 
    12841502                                    wx.LEFT | wx.TOP | wx.BOTTOM, 12)]) 
    12851503 
     
    13161534        Get the selected column on  the visible grid and set values for axis 
    13171535        """ 
     1536 
    13181537        try: 
    13191538            cell_list = self.notebook.on_edit_axis() 
     
    13351554        Receive a list of cells and  create a string presenting the selected 
    13361555        cells. 
     1556 
    13371557        :param cell_list: list of tuple 
    1338  
    1339         """ 
     1558        """ 
     1559 
    13401560        if self.notebook is not None: 
    13411561            return self.notebook.create_axis_label(cell_list) 
     
    13451565        get controls to modify 
    13461566        """ 
     1567 
    13471568        if label != None: 
    13481569            tcrtl_label.SetValue(str(label)) 
     
    13531574        """ 
    13541575        """ 
     1576        # I Believe this is no longer used now that we have removed the 
     1577        # edit menu from the menubar - PDB July 12, 2015 
    13551578        if self.notebook is not None: 
    13561579            self.notebook.add_column() 
     
    13591582        """ 
    13601583        """ 
     1584        # I Believe this is no longer used now that we have removed the 
     1585        # edit menu from the menubar - PDB July 12, 2015 
    13611586        if self.notebook is not None: 
    13621587            self.notebook.on_remove_column() 
     
    13641589 
    13651590class GridFrame(wx.Frame): 
     1591    """ 
     1592    The main wx.Frame for the batch results grid 
     1593    """ 
     1594 
    13661595    def __init__(self, parent=None, data_inputs=None, data_outputs=None, id=-1, 
    1367                  title="Grid Window", size=(800, 500)): 
     1596                 title="Batch Fitting Results Panel", size=(800, 500)): 
     1597        """ 
     1598        Initialize the Frame 
     1599        """ 
     1600 
    13681601        wx.Frame.__init__(self, parent=parent, id=id, title=title, size=size) 
    13691602        self.parent = parent 
     
    13891622        wx.EVT_MENU(self, self.save_menu.GetId(), self.on_save_page) 
    13901623 
    1391         # To add the edit menu, call add_edit_menu() here. 
    1392         self.edit = None 
     1624        # We need to grab a WxMenu handle here, otherwise the next one to grab 
     1625        # the handle will be treated as the Edit Menu handle when checking in 
     1626        # on_menu_open event handler and thus raise an exception when it hits an  
     1627        # unitialized object.  Alternative is to comment out that whole section 
     1628        # in on_menu_open, but that would make it more difficult to undo the 
     1629        # hidding of the menu.   PDB  July 12, 2015. 
     1630        # 
     1631        # To enable the Edit menubar comment out next line and uncomment the 
     1632        # following line. 
     1633        self.edit = wx.Menu() 
     1634        #self.add_edit_menu() 
     1635 
    13931636        self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open) 
    1394          
    13951637        self.Bind(wx.EVT_CLOSE, self.on_close) 
    13961638 
    13971639    def add_edit_menu(self, menubar): 
     1640        """ 
     1641        populates the edit menu on the menubar.  Not activated as of SasView 
     1642        3.1.0 
     1643        """ 
    13981644        self.edit = wx.Menu() 
    13991645 
     
    14291675    def on_copy(self, event): 
    14301676        """ 
    1431         On Copy 
    1432         """ 
     1677        On Copy from the Edit menu item on the menubar 
     1678        """ 
     1679        # I Believe this is no longer used now that we have removed the  
     1680        # edit menu from the menubar - PDB July 12, 2015 
    14331681        if event != None: 
    14341682            event.Skip() 
     
    14391687    def on_paste(self, event): 
    14401688        """ 
    1441         On Paste 
    1442         """ 
     1689        On Paste from the Edit menu item on the menubar 
     1690        """ 
     1691        # I Believe this is no longer used now that we have removed the  
     1692        # edit menu from the menubar - PDB July 12, 2015 
    14431693        if event != None: 
    14441694            event.Skip() 
     
    14491699    def on_clear(self, event): 
    14501700        """ 
    1451         On Clear 
    1452         """ 
     1701        On Clear from the Edit menu item on the menubar 
     1702        """ 
     1703        # I Believe this is no longer used now that we have removed the  
     1704        # edit menu from the menubar - PDB July 12, 2015 
    14531705        pos = self.panel.notebook.GetSelection() 
    14541706        grid = self.panel.notebook.GetPage(pos) 
     
    14661718    def on_remove_column(self, event): 
    14671719        """ 
    1468         On remove column 
    1469         """ 
     1720        On remove column from the Edit menu Item on the menubar 
     1721        """ 
     1722        # I Believe this is no longer used now that we have removed the  
     1723        # edit menu from the menubar - PDB July 12, 2015 
    14701724        pos = self.panel.notebook.GetSelection() 
    14711725        grid = self.panel.notebook.GetPage(pos) 
     
    15351789    def on_save_page(self, event): 
    15361790        """ 
    1537         """ 
     1791        Saves data in grid to a csv file. 
     1792 
     1793        At this time only the columns displayed get saved.  Thus any error 
     1794        bars not inserted before saving will not be saved in the file 
     1795        """ 
     1796 
    15381797        if self.parent is not None: 
    15391798            pos = self.panel.notebook.GetSelection() 
     
    15661825    def on_open(self, event): 
    15671826        """ 
    1568         Open file containg batch result 
    1569         """ 
     1827        Open file containing batch result 
     1828        """ 
     1829 
    15701830        if self.parent is not None: 
    15711831            self.parent.on_read_batch_tofile(self) 
     
    15751835        open excel and display batch result in Excel 
    15761836        """ 
     1837 
    15771838        if self.parent is not None: 
    15781839            pos = self.panel.notebook.GetSelection() 
     
    16251886                 details="", *args, **kwds): 
    16261887        """ 
     1888        Initialize dialog 
     1889 
    16271890        :param parent: Window instantiating this dialog 
    1628         :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\ 
    16291892                application. 
    16301893        """ 
     1894 
    16311895        #kwds['style'] = wx.CAPTION|wx.SYSTEM_MENU 
    16321896        wx.Frame.__init__(self, parent, *args, **kwds) 
     
    16511915        Draw the content of the current dialog window 
    16521916        """ 
     1917 
    16531918        vbox = wx.BoxSizer(wx.VERTICAL) 
    16541919        box_description = wx.StaticBox(self.panel, -1, str("Batch Outputs")) 
     
    17041969        Get the user selection and display output to the selected application 
    17051970        """ 
     1971 
    17061972        if self.flag == 1: 
    17071973            self.parent.open_with_localapp(data_inputs=self.data_inputs, 
     
    17151981        close the Window 
    17161982        """ 
     1983 
    17171984        self.Close() 
    17181985 
     
    17211988        Receive event and display data into third party application 
    17221989        or save data to file. 
    1723  
    17241990        """ 
    17251991        if self.save_to_file.GetValue(): 
  • src/sas/guiframe/documentation_window.py

    r7a508b6 rfb3f9af  
    4343    (self, parent, dummy_id, path, url_instruction, title, size=(850, 540)) 
    4444 
    45     :param path: path to html file beginning AFTER /doc/ and ending in the 
    46     file.html 
    47     :param url_instructions: anchor string or other query e.g. '#MyAnchor 
    48     :param title - text to place in the title bar of the help panel 
     45    :param path: path to html file beginning AFTER /doc/ and ending in the\ 
     46    file.html. 
     47    :param url_instructions: anchor string or other query e.g. '#MyAnchor' 
     48    :param title: text to place in the title bar of the help panel 
    4949    """ 
    5050    def __init__(self, parent, dummy_id, path, url_instruction, title, size=(850, 540)): 
  • src/sas/guiframe/local_perspectives/plotting/Plotter1D.py

    rb99a4552 r098f3d2  
    564564            self._slicerpop.Append(wx_id, '&Print Image', 'Print image ') 
    565565            wx.EVT_MENU(self, wx_id, self.onPrint) 
    566             wx_id = wx.NewId() 
    567             self._slicerpop.Append(wx_id, '&Print Preview', 'Print preview') 
    568             wx.EVT_MENU(self, wx_id, self.onPrinterPreview) 
    569566 
    570567            wx_id = wx.NewId() 
  • src/sas/guiframe/local_perspectives/plotting/Plotter2D.py

    rc039589 r098f3d2  
    300300 
    301301        wx_id = wx.NewId() 
    302         slicerpop.Append(wx_id, '&Print Preview', 'Print preview') 
    303         wx.EVT_MENU(self, wx_id, self.onPrinterPreview) 
    304  
    305         wx_id = wx.NewId() 
    306302        slicerpop.Append(wx_id, '&Copy to Clipboard', 'Copy to the clipboard') 
    307303        wx.EVT_MENU(self, wx_id, self.OnCopyFigureMenu) 
  • src/sas/guiframe/local_perspectives/plotting/SimplePlot.py

    rb40ad40 r098f3d2  
    5858        slicerpop.Append(wx_id, '&Print Image', 'Print image') 
    5959        wx.EVT_MENU(self, wx_id, self.onPrint) 
    60  
    61         wx_id = wx.NewId() 
    62         slicerpop.Append(wx_id, '&Print Preview', 'Print preview') 
    63         wx.EVT_MENU(self, wx_id, self.onPrinterPreview) 
    6460 
    6561        wx_id = wx.NewId() 
     
    234230        wx.EVT_MENU(self, id, self.on_print_image) 
    235231 
    236         id = wx.NewId() 
    237         item = wx.MenuItem(menu, id, "&Print Preview") 
    238         item.SetBitmap(preview_bmp) 
    239         menu.AppendItem(item) 
    240         wx.EVT_MENU(self, id, self.on_print_preview) 
    241  
    242232        menu.AppendSeparator() 
    243233        id = wx.NewId() 
  • src/sas/guiframe/report_dialog.py

    re8bb5b6 r098f3d2  
    6666        hbox.Add(button_close) 
    6767        button_close.SetFocus() 
    68  
    69         button_preview = wx.Button(self, wx.NewId(), "Preview") 
    70         button_preview.SetToolTipString("Print preview this report.") 
    71         button_preview.Bind(wx.EVT_BUTTON, self.onPreview, 
    72                             id=button_preview.GetId())  
    73         hbox.Add(button_preview) 
    7468 
    7569        button_print = wx.Button(self, wx.NewId(), "Print") 
Note: See TracChangeset for help on using the changeset viewer.