Changeset a95ae9a in sasview for src/sas/sasgui/perspectives/fitting/fitpanel.py
- Timestamp:
- Oct 5, 2016 4:38:22 PM (8 years ago)
- 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- ef3e09b
- Parents:
- c1fdf84
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitpanel.py
r05228b0 ra95ae9a 13 13 from sas.sasgui.guiframe.events import StatusEvent 14 14 from sas.sasgui.guiframe.dataFitting import check_data_validity 15 from sas.sasgui.perspectives.fitting.simfitpage import SimultaneousFitPage 15 16 16 17 import basepage … … 18 19 _BOX_WIDTH = 80 19 20 21 20 22 class FitPanel(nb, PanelBase): 21 23 """ … … 26 28 27 29 """ 28 # #Internal name for the AUI manager30 # Internal name for the AUI manager 29 31 window_name = "Fit panel" 30 # #Title to appear on top of the window32 # Title to appear on top of the window 31 33 window_caption = "Fit Panel " 32 34 CENTER_PANE = True … … 40 42 wx.CLIP_CHILDREN) 41 43 PanelBase.__init__(self, parent) 42 # self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS)44 # self.SetWindowStyleFlag(style=nb.FNB_FANCY_TABS) 43 45 self._manager = manager 44 46 self.parent = parent 45 47 self.event_owner = None 46 # dictionary of miodel {model class name, model class}48 # dictionary of miodel {model class name, model class} 47 49 self.menu_mng = models.ModelManager() 48 50 self.model_list_box = self.menu_mng.get_model_list() 49 # pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING51 # pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 50 52 self.model_dictionary = self.menu_mng.get_model_dictionary() 51 53 self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE 52 54 53 55 self.Bind(self.pageClosedEvent, self.on_close_page) 54 # #save the title of the last page tab added56 # save the title of the last page tab added 55 57 self.fit_page_name = {} 56 # #list of existing fit page58 # list of existing fit page 57 59 self.opened_pages = {} 58 # index of fit page60 # index of fit page 59 61 self.fit_page_index = 0 60 # index of batch page62 # index of batch page 61 63 self.batch_page_index = 0 62 # page of simultaneous fit64 # page of simultaneous fit 63 65 self.sim_page = None 64 66 self.batch_page = None 65 # #get the state of a page67 # get the state of a page 66 68 self.Bind(basepage.EVT_PAGE_INFO, self._onGetstate) 67 69 self.Bind(basepage.EVT_PREVIOUS_STATE, self._onUndo) … … 80 82 """ 81 83 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 85 91 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 108 105 return doc 109 106 … … 363 360 panel.set_index_model(self.batch_page_index) 364 361 else: 365 # Increment index of fit page362 # Increment index of fit page 366 363 panel = FitPage(parent=self) 367 364 self.fit_page_index += 1 … … 526 523 self.SetSelection(pos) 527 524 return page 528 # create new page and add data525 # create new page and add data 529 526 page = self.add_empty_page() 530 527 pos = self.GetPageIndex(page)
Note: See TracChangeset
for help on using the changeset viewer.