- Timestamp:
- Feb 11, 2011 8:53:03 PM (14 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 229da98
- Parents:
- eec8dbb
- Location:
- sansview/perspectives/fitting
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r3cd5806 r90a7bbd 175 175 """ 176 176 """ 177 print "fitting panel", self.window_name178 177 if self._manager is not None: 179 178 wx.PostEvent(self._manager.parent, PanelOnFocusEvent(panel=self)) … … 380 379 381 380 """ 382 print "manager", manager383 381 self._manager = manager 384 382 self.state.manager = manager -
sansview/perspectives/fitting/fitpage.py
r13913ec r90a7bbd 796 796 msg="Please select a Model first..." 797 797 wx.MessageBox(msg, 'Info') 798 wx.PostEvent(self. manager.parent, StatusEvent(status=\798 wx.PostEvent(self._manager.parent, StatusEvent(status=\ 799 799 "Fit: %s"%msg)) 800 800 return … … 821 821 self.qmin_x = float(self.qmin.GetValue()) 822 822 self.qmax_x = float( self.qmax.GetValue()) 823 self. manager._reset_schedule_problem( value=0)824 self. manager.schedule_for_fit( value=1,page=self,fitproblem =None)825 self. manager.set_fit_range(page= self,qmin= self.qmin_x,823 self._manager._reset_schedule_problem( value=0) 824 self._manager.schedule_for_fit( value=1,page=self,fitproblem =None) 825 self._manager.set_fit_range(page= self,qmin= self.qmin_x, 826 826 qmax= self.qmax_x) 827 827 828 828 #single fit 829 self. manager.onFit()829 self._manager.onFit() 830 830 ## allow stopping the fit 831 831 #if self.engine_type=="scipy": … … 845 845 self.btFit.SetLabel("Fit") 846 846 if self.engine_type=="scipy": 847 self. manager.stop_fit()847 self._manager.stop_fit() 848 848 self.btFit.Unbind(event=wx.EVT_BUTTON, id=self.btFit.GetId()) 849 849 self.btFit.Bind(event=wx.EVT_BUTTON, handler=self._onFit, … … 900 900 evt = ModelEventbox(model = self.model) 901 901 902 self. manager._on_model_panel(evt = evt)902 self._manager._on_model_panel(evt = evt) 903 903 self.state.model = self.model.clone() 904 904 self.state.model.name = self.model.name … … 919 919 msg="Please select a Model first..." 920 920 wx.MessageBox(msg, 'Info') 921 #wx.PostEvent(self. manager.parent, StatusEvent(status=\921 #wx.PostEvent(self._manager.parent, StatusEvent(status=\ 922 922 # "Parameters: %s"%msg)) 923 923 return … … 928 928 #get event object 929 929 tcrtl= event.GetEventObject() 930 wx.PostEvent(self. manager.parent, StatusEvent(status=" \930 wx.PostEvent(self._manager.parent, StatusEvent(status=" \ 931 931 updating ... ",type="update")) 932 932 #Clear msg if previously shown. … … 950 950 flag = flag or flag1 951 951 elif self.data.__class__.__name__ !="Data2D": 952 self. manager.set_smearer(smearer=temp_smearer,952 self._manager.set_smearer(smearer=temp_smearer, 953 953 qmin= float(self.qmin_x), 954 954 qmax= float(self.qmax_x)) … … 1434 1434 1435 1435 if self.engine_type != None: 1436 self. manager._on_change_engine(engine=self.engine_type)1436 self._manager._on_change_engine(engine=self.engine_type) 1437 1437 1438 1438 self.select_param(event = None) … … 1623 1623 #PostStatusEvent 1624 1624 msg = "Fit completed! " 1625 wx.PostEvent(self. manager.parent, StatusEvent(status=msg))1625 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1626 1626 1627 1627 def onPinholeSmear(self, event): … … 1641 1641 msg="Please select a Model first..." 1642 1642 wx.MessageBox(msg, 'Info') 1643 wx.PostEvent(self. manager.parent, StatusEvent(status=\1643 wx.PostEvent(self._manager.parent, StatusEvent(status=\ 1644 1644 "Smear: %s"%msg)) 1645 1645 return … … 1776 1776 1777 1777 if msg != None: 1778 wx.PostEvent(self. manager.parent, StatusEvent(status = msg ))1778 wx.PostEvent(self._manager.parent, StatusEvent(status = msg )) 1779 1779 else: 1780 1780 get_pin_min.SetBackgroundColour("white") 1781 1781 get_pin_max.SetBackgroundColour("white") 1782 1782 ## set smearing value whether or not the data contain the smearing info 1783 self. manager.set_smearer(smearer=self.current_smearer, qmin= \1783 self._manager.set_smearer(smearer=self.current_smearer, qmin= \ 1784 1784 float(self.qmin_x),qmax= float(self.qmax_x)) 1785 1785 return msg … … 1820 1820 msg="Please select a Model first..." 1821 1821 wx.MessageBox(msg, 'Info') 1822 wx.PostEvent(self. manager.parent, StatusEvent(status=\1822 wx.PostEvent(self._manager.parent, StatusEvent(status=\ 1823 1823 "Smear: %s"%msg)) 1824 1824 return … … 1862 1862 wx.PostEvent(self.parent, event) 1863 1863 if msg != None: 1864 wx.PostEvent(self. manager.parent, StatusEvent(status = msg))1864 wx.PostEvent(self._manager.parent, StatusEvent(status = msg)) 1865 1865 1866 1866 def _is_changed_slit(self): … … 1951 1951 #temp_smearer = self.current_smearer 1952 1952 ## set smearing value whether or not the data contain the smearing info 1953 self. manager.set_smearer(smearer=self.current_smearer, qmin= \1953 self._manager.set_smearer(smearer=self.current_smearer, qmin= \ 1954 1954 float(self.qmin_x), qmax= float(self.qmax_x)) 1955 1955 return msg … … 1989 1989 msg="Please select a Model first..." 1990 1990 wx.MessageBox(msg, 'Info') 1991 wx.PostEvent(self. manager.parent, StatusEvent(status=\1991 wx.PostEvent(self._manager.parent, StatusEvent(status=\ 1992 1992 "Smear: %s"%msg)) 1993 1993 return … … 2018 2018 msg= ": Slit smearing parameters" 2019 2019 if self.smearer ==None: 2020 wx.PostEvent(self. manager.parent, StatusEvent(status=\2020 wx.PostEvent(self._manager.parent, StatusEvent(status=\ 2021 2021 "Data contains no smearing information")) 2022 2022 else: 2023 wx.PostEvent(self. manager.parent, StatusEvent(status=\2023 wx.PostEvent(self._manager.parent, StatusEvent(status=\ 2024 2024 "Data contains smearing information")) 2025 2025 … … 2036 2036 self.Layout() 2037 2037 ## set smearing value whether or not the data contain the smearing info 2038 self. manager.set_smearer(smearer=temp_smearer, qmin= float(self.qmin_x),2038 self._manager.set_smearer(smearer=temp_smearer, qmin= float(self.qmin_x), 2039 2039 qmax= float(self.qmax_x)) 2040 2040 … … 2185 2185 return 2186 2186 ## the panel is drawn using the current value of the fit engine 2187 if self.engine_type==None and self. manager !=None:2188 self.engine_type= self. manager._return_engine_type()2187 if self.engine_type==None and self._manager !=None: 2188 self.engine_type= self._manager._return_engine_type() 2189 2189 2190 2190 box_description= wx.StaticBox(self, -1,str("Model Parameters")) -
sansview/perspectives/fitting/fitpanel.py
r3cd5806 r90a7bbd 11 11 _BOX_WIDTH = 80 12 12 13 14 class StateIterator(object):15 """16 Contains all saved state of a given page.17 Provide position of the current state of a page, the first save state18 and the last state for a given page.19 Allow easy undo or redo for a given page20 """21 def __init__(self):22 """23 """24 self._current=025 26 def __iter__(self):27 """28 """29 return self30 31 def first(self):32 """33 """34 self._current =035 return self._current36 37 def next(self, max ):38 """39 """40 if self._current < max:41 self._current += 142 return self._current43 44 def previous(self):45 """46 """47 if self._current > 0:48 self._current = self._current -149 return self._current50 51 def currentPosition(self):52 """53 """54 return self._current55 56 def setPosition(self, value):57 """58 """59 if value >=0:60 self._current = int(value)61 62 63 class ListOfState(list):64 """65 """66 def __init__(self, *args, **kw):67 list.__init__(self, *args, **kw)68 self.iterator = StateIterator()69 70 def appendItem(self, x):71 """72 """73 self.append(x)74 self.iterator.setPosition(value= len(self)-1)75 76 def removeItem(self, x):77 """78 """79 self.iterator.previous()80 self.remove(x)81 82 def getPreviousItem(self):83 """84 """85 position = self.iterator.previous()86 87 if position < 0:88 return None89 else:90 return self[position]91 92 def getNextItem(self):93 """94 """95 position = self.iterator.next(max= len(self)-1)96 if position >= len(self):97 return None98 else:99 return self[position]100 101 def getCurrentItem(self):102 """103 """104 postion = self.iterator.currentPosition()105 if postion >= 0 and position < len(self):106 return self[postion]107 else:108 return None109 110 def getCurrentPosition(self):111 """112 """113 return self.iterator.currentPosition()114 115 13 116 14 class PageInfo(object): … … 189 87 self.Bind(basepage.EVT_PREVIOUS_STATE, self._onUndo) 190 88 self.Bind(basepage.EVT_NEXT_STATE, self._onRedo) 89 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changing) 191 90 192 91 #add default pages … … 199 98 self.Center() 200 99 100 def on_page_changing(self, event): 101 pos = self.GetSelection() 102 if pos != -1: 103 selected_page = self.GetPage(pos) 104 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page)) 201 105 def on_set_focus(self, event): 202 106 """ 203 107 """ 204 108 pos = self.GetSelection() 205 selected_page = self.GetPage(pos)206 print "panel on fogus", selected_page.window_name207 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page))109 if pos != -1: 110 selected_page = self.GetPage(pos) 111 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page)) 208 112 209 113 def get_data(self): … … 212 116 """ 213 117 pos = self.GetSelection() 214 selected_page = self.GetPage(pos) 215 return selected_page.get_data() 118 if pos != -1: 119 selected_page = self.GetPage(pos) 120 return selected_page.get_data() 216 121 217 122 def get_state(self): … … 220 125 """ 221 126 pos = self.GetSelection() 222 selected_page = self.GetPage(pos) 223 return selected_page.get_state() 127 if pos != -1: 128 selected_page = self.GetPage(pos) 129 return selected_page.get_state() 224 130 225 131 def add_default_pages(self): … … 240 146 remove all pages, used when a svs file is opened 241 147 """ 148 242 149 #get number of pages 243 150 nop = self.GetPageCount() … … 246 153 #delete the first page until no page exists 247 154 page = self.GetPage(0) 155 if self._manager.parent.panel_on_focus == page: 156 self._manager.parent.panel_on_focus = None 248 157 self._close_helper(selected_page=page) 249 158 self.DeletePage(0) 250 159 nop = nop - 1 160 251 161 ## save the title of the last page tab added 252 162 self.fit_page_name = {} … … 276 186 panel.save_current_state() 277 187 278 def clear_panel(self , format='.svs'):188 def clear_panel(self): 279 189 """ 280 190 Clear and close all panels, used by guimanager 281 191 """ 282 if format == '.svs': 283 #close all panels only when svs file opened 284 self.close_all() 285 self._manager.mypanels = [] 192 193 #close all panels only when svs file opened 194 self.close_all() 195 self._manager.mypanels = [] 196 286 197 287 198 def on_close_page(self, event=None): -
sansview/perspectives/fitting/fitting.py
r75fbd17 r90a7bbd 35 35 from sans.guiframe.events import ERR_DATA 36 36 from sans.guiframe.events import EVT_SLICER_PARS_UPDATE 37 from sans.guiframe.events import EVT_FITSTATE_UPDATE 38 39 #from sans.fit.AbstractFitEngine import Model 40 #from sans.fit.AbstractFitEngine import FitAbort 37 38 41 39 from .console import ConsoleUpdate 42 40 from .fitproblem import FitProblem … … 263 261 return self.mypanels 264 262 263 def clear_panel(self): 264 """ 265 """ 266 self.fit_panel.clear_panel(format=format) 267 265 268 def set_default_perspective(self): 266 269 """ … … 297 300 : param datainfo: data 298 301 """ 299 state = self.state_reader.get_state()302 #state = self.state_reader.get_state() 300 303 if state != None: 301 304 # store fitting state in temp_state -
sansview/perspectives/fitting/pagestate.py
r75fbd17 r90a7bbd 1173 1173 state.data.group_id = name 1174 1174 #store state in fitting 1175 #self.call_back(state=state, datainfo=output[ind],format=ext)1175 self.call_back(state=state, datainfo=output[ind],format=ext) 1176 1176 self.state= state 1177 1177 return output
Note: See TracChangeset
for help on using the changeset viewer.