Changeset ae84427 in sasview for fittingview/src/sans
- Timestamp:
- Apr 20, 2013 7:14:41 PM (12 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:
- ba152f1
- Parents:
- d4895dd
- Location:
- fittingview/src/sans/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/basepage.py
rcb270ad2 rae84427 713 713 msg = menu.GetHelpString(event.GetId()) 714 714 msg += " reloaded" 715 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))715 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 716 716 self.Show(False) 717 717 name = menu.GetLabel(event.GetId()) … … 746 746 if self.parent != None: 747 747 self._default_save_location = \ 748 self. parent.parent._default_save_location748 self._manager.parent._default_save_location 749 749 dlg = wx.FileDialog(self, "Choose a file", self._default_save_location, 750 750 self.window_caption, "*.fitv", wx.SAVE) … … 753 753 path = dlg.GetPath() 754 754 self._default_save_location = os.path.dirname(path) 755 self. parent.parent._default_save_location =\755 self._manager.parent._default_save_location =\ 756 756 self._default_save_location 757 757 else: … … 803 803 msg += ": No valid parameter values to paste from the clipboard..." 804 804 infor = "error" 805 wx.PostEvent(self. parent.parent,805 wx.PostEvent(self._manager.parent, 806 806 StatusEvent(status=msg, info=infor)) 807 807 raise 808 808 # inform msg to wx 809 wx.PostEvent(self. parent.parent,809 wx.PostEvent(self._manager.parent, 810 810 StatusEvent(status=msg, info=infor)) 811 811 … … 843 843 ## post help message for the selected model 844 844 msg += " Saved! right click on this page to retrieve this model" 845 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))845 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 846 846 847 847 id = wx.NewId() 848 848 self.popUpMenu.Append(id, name, str(msg)) 849 849 wx.EVT_MENU(self, id, self.onResetModel) 850 wx.PostEvent(self. parent.parent,850 wx.PostEvent(self._manager.parent, 851 851 AppendBookmarkEvent(title=name, 852 852 hint=str(msg), … … 877 877 try: 878 878 if path == None: 879 wx.PostEvent(self. parent.parent,879 wx.PostEvent(self._manager.parent, 880 880 StatusEvent(status= \ 881 881 " Selected Distribution was not loaded: %s" % path)) … … 1490 1490 if self.parent != None: 1491 1491 self._default_save_location = \ 1492 self. parent.parent.get_save_location()1492 self._manager.parent.get_save_location() 1493 1493 dlg = wx.FileDialog(self, "Choose a weight file", 1494 1494 self._default_save_location, "", … … 1702 1702 msg = "Cannot Plot or Fit :Must select a " 1703 1703 msg += " model or Fitting range is not valid!!! " 1704 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1704 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1705 1705 1706 1706 try: … … 2081 2081 except: 2082 2082 msg = "%s\n" % (sys.exc_value) 2083 wx.PostEvent(self. parent.parent,2083 wx.PostEvent(self._manager.parent, 2084 2084 StatusEvent(status=msg, info="error")) 2085 2085 self._populate_box(self.formfactorbox, m_list) … … 2188 2188 #Clear msg if previously shown. 2189 2189 msg = "" 2190 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2190 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2191 2191 # Flag to register when a parameter has changed. 2192 2192 is_modified = False … … 2223 2223 else: 2224 2224 msg = "Cannot Plot :No npts in that Qrange!!! " 2225 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2225 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2226 2226 else: 2227 2227 tcrtl.SetBackgroundColour("pink") 2228 2228 msg = "Model Error:wrong value entered!!!" 2229 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2229 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2230 2230 self.save_current_state() 2231 2231 event = PageInfoEvent(page=self) … … 2367 2367 qmax_ctrl.Refresh() 2368 2368 msg = "Invalid Q range: Q min must be smaller than Q max" 2369 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2369 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2370 2370 return False 2371 2371 return True … … 2399 2399 msg = "Npts of Data Error :" 2400 2400 msg += "No or too little npts of %s." % data.name 2401 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2401 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2402 2402 self.fitrange = False 2403 2403 flag = False … … 2434 2434 msg = "Npts of Data Error :" 2435 2435 msg += "No or too little npts of %s." % data.name 2436 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2436 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2437 2437 self.fitrange = False 2438 2438 flag = False … … 2485 2485 except: 2486 2486 msg = "Wrong Fit parameter range entered " 2487 wx.PostEvent(self. parent.parent,2487 wx.PostEvent(self._manager.parent, 2488 2488 StatusEvent(status=msg)) 2489 2489 raise ValueError, msg … … 2502 2502 except: 2503 2503 msg = "Wrong Fit parameter range entered " 2504 wx.PostEvent(self. parent.parent,2504 wx.PostEvent(self._manager.parent, 2505 2505 StatusEvent(status=msg)) 2506 2506 raise ValueError, msg … … 2511 2511 msg = "Wrong Fit range entered for parameter " 2512 2512 msg += "name %s of model %s " % (name, self.model.name) 2513 wx.PostEvent(self. parent.parent,2513 wx.PostEvent(self._manager.parent, 2514 2514 StatusEvent(status=msg)) 2515 2515 … … 2533 2533 item[2].SetBackgroundColour("pink") 2534 2534 msg = "Wrong Fit parameter value entered " 2535 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2535 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2536 2536 2537 2537 return is_modified … … 2763 2763 # Focus on Fit button so that users can see the pinky box 2764 2764 self.btFit.SetFocus() 2765 wx.PostEvent(self. parent.parent,2765 wx.PostEvent(self._manager.parent, 2766 2766 StatusEvent(status=msg, info="error")) 2767 2767 … … 2785 2785 return 2786 2786 self._default_save_location = os.path.dirname(path) 2787 if self. parent!= None:2788 self. parent.parent._default_save_location =\2787 if self._manager != None: 2788 self._manager.parent._default_save_location =\ 2789 2789 self._default_save_location 2790 2790 … … 2800 2800 # Tell the user that we are about to apply the distribution 2801 2801 msg = "Applying loaded %s distribution: %s" % (name, path) 2802 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2802 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2803 2803 self._set_array_disp_model(name=name, disp=disp, 2804 2804 values=values, weights=weights) … … 2947 2947 if flag == False: 2948 2948 msg = "Cannot Plot :Must enter a number!!! " 2949 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))2949 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2950 2950 else: 2951 2951 # set relative text ctrs. … … 2983 2983 res_item = None 2984 2984 # call gui_manager 2985 gui_manager = self. parent.parent2985 gui_manager = self._manager.parent 2986 2986 # loops through the panels [dic] 2987 2987 for _, item2 in gui_manager.plot_panels.iteritems(): -
fittingview/src/sans/perspectives/fitting/fitpage.py
r3e001f9 rae84427 68 68 #create a default data for an empty panel 69 69 self.create_default_data() 70 #self._manager.frame.Bind(wx.EVT_SET_FOCUS, self.on_set_focus) 70 71 71 72 def enable_fit_button(self): … … 985 986 if not flag: 986 987 msg = "The parameters are invalid" 987 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))988 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 988 989 return 989 990 … … 1000 1001 return 1001 1002 1002 if len(self. parent._manager.fit_thread_list) > 0 and\1003 self. parent._manager._fit_engine != "park" and\1003 if len(self._manager.fit_thread_list) > 0 and\ 1004 self._manager._fit_engine != "park" and\ 1004 1005 self._manager.sim_page != None and \ 1005 1006 self._manager.sim_page.uid == self.uid: … … 1036 1037 if not flag: 1037 1038 msg = "Fitting range or parameters are invalid" 1038 wx.PostEvent(self. parent.parent,1039 wx.PostEvent(self._manager.parent, 1039 1040 StatusEvent(status=msg, type="stop")) 1040 1041 return … … 1259 1260 #Clear msg if previously shown. 1260 1261 msg = "" 1261 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1262 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1262 1263 1263 1264 if check_float(tcrtl): … … 1301 1302 self.save_current_state() 1302 1303 msg = "Cannot Plot :Must enter a number!!! " 1303 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1304 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1304 1305 1305 1306 self.save_current_state() … … 1313 1314 #Clear msg if previously shown. 1314 1315 msg = "" 1315 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1316 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1316 1317 # Flag to register when a parameter has changed. 1317 1318 is_modified = False … … 1324 1325 tcrtl.SetBackgroundColour("pink") 1325 1326 msg = "Model Error:wrong value entered : %s" % sys.exc_value 1326 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1327 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1327 1328 return 1328 1329 else: … … 1357 1358 d_group_id = self.data.group_id 1358 1359 act_ctrl = event.GetEventObject() 1359 wx.PostEvent(self. parent.parent,1360 wx.PostEvent(self._manager.parent, 1360 1361 PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id, 1361 1362 group_id=d_group_id, leftdown=is_click, … … 1373 1374 d_id = self.data.id 1374 1375 d_group_id = self.data.group_id 1375 wx.PostEvent(self. parent.parent,1376 wx.PostEvent(self._manager.parent, 1376 1377 PlotQrangeEvent(ctrl=[self.qmin, self.qmax], id=d_id, 1377 1378 group_id=d_group_id, leftdown=False, … … 1415 1416 #Clear msg if previously shown. 1416 1417 msg = "" 1417 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1418 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1418 1419 # For theory mode 1419 1420 if not self.data.is_data: … … 1436 1437 tcrtl.SetBackgroundColour("pink") 1437 1438 msg = "Model Error:wrong value entered : %s" % sys.exc_value 1438 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1439 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1439 1440 return 1440 1441 except: 1441 1442 tcrtl.SetBackgroundColour("pink") 1442 1443 msg = "Model Error:wrong value entered : %s" % sys.exc_value 1443 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1444 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1444 1445 return 1445 1446 #Check if # of points for theory model are valid(>0). … … 1457 1458 msg = "Cannot Plot :No or too little npts in" 1458 1459 msg += " that data range!!! " 1459 wx.PostEvent(self. parent.parent,1460 wx.PostEvent(self._manager.parent, 1460 1461 StatusEvent(status=msg)) 1461 1462 return … … 1475 1476 tcrtl.SetBackgroundColour("pink") 1476 1477 msg = "Model Error:wrong value entered!!!" 1477 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1478 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1478 1479 1479 1480 self._draw_model() … … 1767 1768 self.set_npts2fit() 1768 1769 msg = "No model is found on updating MASK in the model plot... " 1769 wx.PostEvent(self. parent.parent, StatusEvent(status=msg))1770 wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 1770 1771 else: 1771 1772 event.Skip() … … 1983 1984 try: 1984 1985 wx.PostEvent(self._manager.parent, 1985 NewPlotEvent(action=" remove",1986 NewPlotEvent(action="delete", 1986 1987 group_id=old_group_id, id=old_id)) 1987 1988 except: … … 2015 2016 msg += "information.\n" 2016 2017 msg += "%s"% (sys.exc_value) 2017 wx.PostEvent(self. parent.parent,2018 wx.PostEvent(self._manager.parent, 2018 2019 StatusEvent(status=msg, info="error")) 2019 2020 self._lay_out() … … 2680 2681 if item[0] and item[0].IsShown(): 2681 2682 param2fit.append(item[1]) 2682 self. parent._manager.set_param2fit(self.uid, param2fit)2683 self._manager.set_param2fit(self.uid, param2fit) 2683 2684 2684 2685 def select_all_param(self, event): … … 2812 2813 if item[0] and item[0].IsShown(): 2813 2814 param2fit.append(item[1]) 2814 self. parent._manager.set_param2fit(self.uid, param2fit)2815 self._manager.set_param2fit(self.uid, param2fit) 2815 2816 2816 2817 def set_model_param_sizer(self, model): … … 3237 3238 infor = 'warning' 3238 3239 # inform msg to wx 3239 wx.PostEvent(self. parent.parent,3240 wx.PostEvent(self._manager.parent, 3240 3241 StatusEvent(status=msg, info=infor)) 3241 3242 -
fittingview/src/sans/perspectives/fitting/fitpanel.py
r3b148c3 rae84427 71 71 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changing) 72 72 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_closed) 73 73 74 74 def on_closed(self, event): 75 75 """ … … 161 161 if pos != -1: 162 162 selected_page = self.GetPage(pos) 163 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page)) 163 wx.PostEvent(self._manager.parent, 164 PanelOnFocusEvent(panel=selected_page)) 164 165 self.enable_close_button() 165 166 … … 170 171 if pos != -1: 171 172 selected_page = self.GetPage(pos) 172 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=selected_page)) 173 wx.PostEvent(self._manager.parent, 174 PanelOnFocusEvent(panel=selected_page)) 173 175 174 176 def get_data(self): -
fittingview/src/sans/perspectives/fitting/fitting.py
rbca2cb9 rae84427 41 41 from sans.perspectives.calculator.model_editor import TextDialog 42 42 from sans.perspectives.calculator.model_editor import EditorWindow 43 from sans.guiframe.gui_manager import MDIFrame 43 44 44 45 MAX_NBR_DATA = 4 … … 427 428 page.Refresh() 428 429 page.SetFocus() 429 self.parent._mgr.Update()430 #self.parent._mgr.Update() 430 431 msg = "%s already opened\n" % str(page.window_caption) 431 432 wx.PostEvent(self.parent, StatusEvent(status=msg)) … … 500 501 #self.parent.Bind(EVT_FITSTATE_UPDATE, self.on_set_state_helper) 501 502 # Creation of the fit panel 502 self.fit_panel = FitPanel(parent=self.parent, manager=self) 503 self.frame = MDIFrame(self.parent, None, 'None', (100, 200)) 504 self.fit_panel = FitPanel(parent=self.frame, manager=self) 505 self.frame.set_panel(self.fit_panel) 506 self._frame_set_helper() 503 507 self.on_add_new_page(event=None) 504 508 #Set the manager for the main panel … … 513 517 self.parent.Bind(EVT_SLICER_PANEL, self._on_slicer_event) 514 518 self.parent.Bind(EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PANEL) 515 self.parent._mgr.Bind(wx.aui.EVT_AUI_PANE_CLOSE,self._onclearslicer)519 #self.parent._mgr.Bind(wx.aui.EVT_AUI_PANE_CLOSE,self._onclearslicer) 516 520 #Create reader when fitting panel are created 517 521 self.state_reader = Reader(self.set_state) … … 577 581 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 578 582 579 def set_top_panel(self):580 """581 Close default (welcome) panel582 """583 if 'default' in self.parent.panels:584 self.parent.on_close_welcome_panel()585 586 587 583 def set_theory(self, theory_list=None): 588 584 """ … … 1168 1164 wx.PostEvent(self.parent, StatusEvent(status=msg, 1169 1165 info="warning")) 1170 self.set_top_panel()1171 1166 except: 1172 1167 msg = "Creating Fit page: %s"%sys.exc_value … … 1224 1219 the panel and panel_name to find the slicer 's panel concerned. 1225 1220 """ 1221 event.panel_name 1226 1222 for item in self.parent.panels: 1227 1223 name = event.panel_name … … 1229 1225 self.parent.panels[item].set_slicer(event.type, event.params) 1230 1226 1231 self.parent._mgr.Update()1227 #self.parent._mgr.Update() 1232 1228 1233 1229 def _closed_fitpage(self, event): … … 1308 1304 data = plottable 1309 1305 self.add_fit_page(data=[data]) 1310 self.set_top_panel()1311 1306 1312 1307 def update_fit(self, result=None, msg=""): … … 1689 1684 self.slicer_panels.append(event.panel) 1690 1685 # Set group ID if available 1691 event_id = self.parent.popup_panel( new_panel)1692 new_panel.uid = event_id1693 self.mypanels.append( new_panel)1686 event_id = self.parent.popup_panel(event.panel) 1687 event.panel.uid = event_id 1688 self.mypanels.append(event.panel) 1694 1689 1695 1690 def _onclearslicer(self, event): … … 1697 1692 Clear the boxslicer when close the panel associate with this slicer 1698 1693 """ 1699 name = event.Get Pane().caption1700 1694 name = event.GetEventObject().frame.GetTitle() 1695 print "name", name 1701 1696 for panel in self.slicer_panels: 1702 1697 if panel.window_caption == name: … … 1706 1701 if self.parent.panels[item].uid == panel.base.uid: 1707 1702 self.parent.panels[item].onClearSlicer(event) 1708 self.parent._mgr.Update()1703 #self.parent._mgr.Update() 1709 1704 break 1710 1705 break
Note: See TracChangeset
for help on using the changeset viewer.