Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fitpanel.py

    ra95ae9a r05228b0  
    1313from sas.sasgui.guiframe.events import StatusEvent 
    1414from sas.sasgui.guiframe.dataFitting import check_data_validity 
    15 from sas.sasgui.perspectives.fitting.simfitpage import SimultaneousFitPage 
    1615 
    1716import basepage 
     
    1918_BOX_WIDTH = 80 
    2019 
    21  
    2220class FitPanel(nb, PanelBase): 
    2321    """ 
     
    2826 
    2927    """ 
    30     # Internal name for the AUI manager 
     28    ## Internal name for the AUI manager 
    3129    window_name = "Fit panel" 
    32     # Title to appear on top of the window 
     30    ## Title to appear on top of the window 
    3331    window_caption = "Fit Panel " 
    3432    CENTER_PANE = True 
     
    4240                    wx.CLIP_CHILDREN) 
    4341        PanelBase.__init__(self, parent) 
    44         # self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS) 
     42        #self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS) 
    4543        self._manager = manager 
    4644        self.parent = parent 
    4745        self.event_owner = None 
    48         # dictionary of miodel {model class name, model class} 
     46        #dictionary of miodel {model class name, model class} 
    4947        self.menu_mng = models.ModelManager() 
    5048        self.model_list_box = self.menu_mng.get_model_list() 
    51         # pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 
     49        #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 
    5250        self.model_dictionary = self.menu_mng.get_model_dictionary() 
    5351        self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE 
    5452 
    5553        self.Bind(self.pageClosedEvent, self.on_close_page) 
    56         # save the title of the last page tab added 
     54        ## save the title of the last page tab added 
    5755        self.fit_page_name = {} 
    58         # list of existing fit page 
     56        ## list of existing fit page 
    5957        self.opened_pages = {} 
    60         # index of fit page 
     58        #index of fit page 
    6159        self.fit_page_index = 0 
    62         # index of batch page 
     60        #index of batch page 
    6361        self.batch_page_index = 0 
    64         # page of simultaneous fit 
     62        #page of simultaneous fit 
    6563        self.sim_page = None 
    6664        self.batch_page = None 
    67         # get the state of a page 
     65        ## get the state of a page 
    6866        self.Bind(basepage.EVT_PAGE_INFO, self._onGetstate) 
    6967        self.Bind(basepage.EVT_PREVIOUS_STATE, self._onUndo) 
     
    8280        """ 
    8381        return an xml node containing state of the panel 
    84         that guiframe can write to file 
    85         """ 
    86         # Iterate through all pages and check for batch fitting 
    87         batch_state = None 
    88         if self.sim_page is not None: 
    89             batch_state = self.sim_page.set_state() 
    90  
     82         that guiframe can write to file 
     83        """ 
     84        msg = "" 
    9185        for uid, page in self.opened_pages.iteritems(): 
    92             data = page.get_data() 
    93             # state must be cloned 
    94             state = page.get_state().clone() 
    95             if data is not None or page.model is not None: 
    96                 new_doc = self._manager.state_reader.write_toXML(data, 
    97                                                                  state, 
    98                                                                  batch_state) 
    99                 if doc is not None and hasattr(doc, "firstChild"): 
    100                     child = new_doc.firstChild.firstChild 
    101                     doc.firstChild.appendChild(child) 
    102                 else: 
    103                     doc = new_doc 
    104  
     86            if page.batch_on: 
     87                pos = self.GetPageIndex(page) 
     88                if pos != -1 and page not in [self.sim_page, self.batch_page]: 
     89                    msg += "%s .\n" % str(self.GetPageText(pos)) 
     90            else: 
     91                data = page.get_data() 
     92                # state must be cloned 
     93                state = page.get_state().clone() 
     94                if data is not None and page.model is not None: 
     95                    new_doc = self._manager.state_reader.write_toXML(data, 
     96                                                                     state) 
     97                    if doc != None and hasattr(doc, "firstChild"): 
     98                        child = new_doc.firstChild.firstChild 
     99                        doc.firstChild.appendChild(child) 
     100                    else: 
     101                        doc = new_doc 
     102        if msg.strip() != "": 
     103            temp = "Save Project is not supported for Batch page.\n" 
     104            temp += "The following pages will not be save:\n" 
     105            message = temp + msg 
     106            wx.PostEvent(self._manager.parent, StatusEvent(status=message, 
     107                                                            info="warning")) 
    105108        return doc 
    106109 
     
    360363            panel.set_index_model(self.batch_page_index) 
    361364        else: 
    362             # Increment index of fit page 
     365            #Increment index of fit page 
    363366            panel = FitPage(parent=self) 
    364367            self.fit_page_index += 1 
     
    523526                    self.SetSelection(pos) 
    524527                    return page 
    525         # create new page and add data 
     528        #create new page and add data 
    526529        page = self.add_empty_page() 
    527530        pos = self.GetPageIndex(page) 
Note: See TracChangeset for help on using the changeset viewer.