- Timestamp:
- May 13, 2011 2:53:43 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:
- 13a63ab
- Parents:
- 248b918
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
r31f9c172 rf22e626 43 43 self._fill_datainfo_sizer() 44 44 self.is_2D = None 45 self.fit_started = False 45 46 # get smear info from data 46 47 self._get_smear_info() … … 982 983 self.bind_fit_button() 983 984 985 984 986 def bind_fit_button(self): 985 987 """ … … 988 990 self.btFit.Unbind(event=wx.EVT_BUTTON, id= self.btFit.GetId()) 989 991 if self.btFit.GetLabel().lower() == "stop": 992 self.fit_started = True 990 993 self.btFit.SetForegroundColour('red') 991 994 self.btFit.Bind(event=wx.EVT_BUTTON, handler=self._StopFit, 992 995 id=self.btFit.GetId()) 993 996 elif self.btFit.GetLabel().lower() == "fit": 997 self.fit_started = False 994 998 self.btFit.SetDefault() 995 999 self.btFit.SetForegroundColour('black') … … 1002 1006 self._manager._reset_schedule_problem(value=0) 1003 1007 1004 1005 def _StopFit(self, event): 1008 def is_fitting(self): 1009 if self.fit_started: 1010 self._StopFit(event=None) 1011 1012 def _StopFit(self, event=None): 1006 1013 """ 1007 1014 Stop fit -
sansview/perspectives/fitting/fitpanel.py
r4bee68d rf22e626 3 3 import string 4 4 import wx 5 import sys 5 6 #from wx.lib.flatnotebook import FlatNotebook as nb 6 7 from wx.aui import AuiNotebook as nb … … 46 47 self.model_list_box = self.menu_mng.get_model_list() 47 48 #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 48 pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE49 50 self.Bind( pageClosedEvent, self.on_close_page)49 self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE 50 51 self.Bind(self.pageClosedEvent, self.on_close_page) 51 52 ## save the title of the last page tab added 52 53 self.fit_page_name = {} … … 61 62 self.Bind(basepage.EVT_NEXT_STATE, self._onRedo) 62 63 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changing) 63 64 #add default pages 65 self.add_default_pages() 66 64 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_closed) 65 66 def on_closed(self, event): 67 """ 68 """ 69 print "page closed", self.GetPageCount() 70 67 71 def save_project(self, doc=None): 68 72 """ … … 116 120 def on_page_changing(self, event): 117 121 """ 122 calls the function when the current event handler has exited. avoiding 123 to call panel on focus on a panel that is currently deleted 124 """ 125 wx.CallAfter(self.helper_on_page_change) 126 127 128 def helper_on_page_change(self): 129 """ 118 130 """ 119 131 pos = self.GetSelection() … … 121 133 selected_page = self.GetPage(pos) 122 134 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page)) 123 135 136 124 137 def on_set_focus(self, event): 125 138 """ … … 157 170 return selected_page.get_state() 158 171 159 def add_default_pages(self): 160 """ 161 Add default pages such as a hint page and an empty fit page 162 """ 163 pass 164 #add default page 165 #from hint_fitpage import HintFitPage 166 #self.hint_page = HintFitPage(self) 167 #self.AddPage(self.hint_page,"Hint") 168 #self.hint_page.set_manager(self._manager) 172 169 173 170 174 def close_all(self): … … 228 232 """ 229 233 nbr_page = self.GetPageCount() 234 selected_page = self.GetPage(self.GetSelection()) 230 235 if nbr_page == 1: 231 232 event.Veto()233 return234 selected_page = self.GetPage(self.GetSelection())236 if selected_page.get_data() == None: 237 if event is not None: 238 event.Veto() 239 return 235 240 self._close_helper(selected_page=selected_page) 236 241 … … 250 255 #with no selected data 251 256 return 252 if data. name == deleted_data.name:257 if data.id == deleted_data.id: 253 258 self._close_helper(selected_page) 254 259 self.DeletePage(index) … … 294 299 self.AddPage(self.sim_page,"Simultaneous Fit", True) 295 300 self.sim_page.set_manager(self._manager) 301 self.enable_close_button() 296 302 return self.sim_page 297 303 … … 310 316 self.opened_pages[panel.uid] = panel 311 317 self.set_engine_helper(panel=panel) 318 self.enable_close_button() 312 319 return panel 313 320 321 def enable_close_button(self): 322 """ 323 display the close button on tab for more than 1 tabs else remove the 324 close button 325 """ 326 return 327 if self.GetPageCount() <= 1: 328 style = self.GetWindowStyleFlag() 329 if style & wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB == wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB: 330 style = style & ~wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB 331 self.SetWindowStyle(style) 332 else: 333 style = self.GetWindowStyleFlag() 334 if style & wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB != wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB: 335 style |= wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB 336 self.SetWindowStyle(style) 337 314 338 def delete_data(self, data): 315 339 """ 316 340 Delete the given data 317 341 """ 318 if data is None: 319 return None 342 if data.__class__.__name__ != "list": 343 raise ValueError, "Fitpanel delete_data expect list of id" 344 else: 345 n = self.GetPageCount() 346 for page in self.opened_pages.values(): 347 pos = self.GetPageIndex(page) 348 temp_data = page.get_data() 349 #stop the fitting before deleting the page 350 page.is_fitting() 351 if temp_data is not None and temp_data.id in data: 352 self.SetSelection(pos) 353 self.on_close_page(event=None) 354 temp = self.GetSelection() 355 self.DeletePage(temp) 356 if self.GetPageCount()== 0: 357 self.add_empty_page() 358 320 359 def set_data(self, data): 321 360 """ … … 435 474 for uid, list in self.opened_pages.iteritems(): 436 475 #Don't return any panel is the exact same page is created 437 438 476 if selected_page.uid == uid: 439 477 del self.opened_pages[selected_page.uid] 440 478 break 441 479 442 480 -
sansview/perspectives/fitting/fitting.py
rb92cbf61 rf22e626 227 227 loader = Loader() 228 228 loader.associate_file_reader(".fitv", self.state_reader) 229 loader.associate_file_reader(".svs", self.state_reader)229 #loader.associate_file_reader(".svs", self.state_reader) 230 230 from sans.perspectives.calculator.sld_panel import SldPanel 231 231 #Send the fitting panel to guiframe … … 266 266 if dlg.ShowModal() == wx.ID_OK: 267 267 selected_data_list = dlg.get_data() 268 dlg.Destroy() 269 268 270 else: 269 271 selected_data_list = data_list
Note: See TracChangeset
for help on using the changeset viewer.