Ignore:
File:
1 edited

Legend:

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

    r05228b0 ra95ae9a  
    1313from sas.sasgui.guiframe.events import StatusEvent 
    1414from sas.sasgui.guiframe.dataFitting import check_data_validity 
     15from sas.sasgui.perspectives.fitting.simfitpage import SimultaneousFitPage 
    1516 
    1617import basepage 
     
    1819_BOX_WIDTH = 80 
    1920 
     21 
    2022class FitPanel(nb, PanelBase): 
    2123    """ 
     
    2628 
    2729    """ 
    28     ## Internal name for the AUI manager 
     30    # Internal name for the AUI manager 
    2931    window_name = "Fit panel" 
    30     ## Title to appear on top of the window 
     32    # Title to appear on top of the window 
    3133    window_caption = "Fit Panel " 
    3234    CENTER_PANE = True 
     
    4042                    wx.CLIP_CHILDREN) 
    4143        PanelBase.__init__(self, parent) 
    42         #self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS) 
     44        # self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS) 
    4345        self._manager = manager 
    4446        self.parent = parent 
    4547        self.event_owner = None 
    46         #dictionary of miodel {model class name, model class} 
     48        # dictionary of miodel {model class name, model class} 
    4749        self.menu_mng = models.ModelManager() 
    4850        self.model_list_box = self.menu_mng.get_model_list() 
    49         #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 
     51        # pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 
    5052        self.model_dictionary = self.menu_mng.get_model_dictionary() 
    5153        self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE 
    5254 
    5355        self.Bind(self.pageClosedEvent, self.on_close_page) 
    54         ## save the title of the last page tab added 
     56        # save the title of the last page tab added 
    5557        self.fit_page_name = {} 
    56         ## list of existing fit page 
     58        # list of existing fit page 
    5759        self.opened_pages = {} 
    58         #index of fit page 
     60        # index of fit page 
    5961        self.fit_page_index = 0 
    60         #index of batch page 
     62        # index of batch page 
    6163        self.batch_page_index = 0 
    62         #page of simultaneous fit 
     64        # page of simultaneous fit 
    6365        self.sim_page = None 
    6466        self.batch_page = None 
    65         ## get the state of a page 
     67        # get the state of a page 
    6668        self.Bind(basepage.EVT_PAGE_INFO, self._onGetstate) 
    6769        self.Bind(basepage.EVT_PREVIOUS_STATE, self._onUndo) 
     
    8082        """ 
    8183        return an xml node containing state of the panel 
    82          that guiframe can write to file 
    83         """ 
    84         msg = "" 
     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 
    8591        for uid, page in self.opened_pages.iteritems(): 
    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")) 
     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 
    108105        return doc 
    109106 
     
    363360            panel.set_index_model(self.batch_page_index) 
    364361        else: 
    365             #Increment index of fit page 
     362            # Increment index of fit page 
    366363            panel = FitPage(parent=self) 
    367364            self.fit_page_index += 1 
     
    526523                    self.SetSelection(pos) 
    527524                    return page 
    528         #create new page and add data 
     525        # create new page and add data 
    529526        page = self.add_empty_page() 
    530527        pos = self.GetPageIndex(page) 
Note: See TracChangeset for help on using the changeset viewer.