Changeset 6e9976b in sasview for sansview/perspectives/fitting/basepage.py
- Timestamp:
- Dec 14, 2009 2:22:12 PM (15 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:
- d67fc8d
- Parents:
- fe9c19b4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r7975f2b r6e9976b 19 19 _NPTS_DEFAULT = 50 20 20 #Control panel width 21 if sys.platform.count(" win32")>0:21 if sys.platform.count("darwin")==0: 22 22 PANEL_WIDTH = 450 23 23 FONT_VARIANT = 0 … … 1420 1420 1421 1421 self._onparamEnter_helper() 1422 event.Skip()1422 #event.Skip() 1423 1423 else: 1424 1424 msg= "Cannot Plot :Must enter a number!!! " 1425 1425 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1426 event.Skip()1426 #event.Skip() 1427 1427 return 1428 1428 1429 1429 def _onQrangeEnter(self, event): 1430 """ 1431 Check validity of value enter in the Q range field 1432 """ 1433 1434 tcrtl= event.GetEventObject() 1435 #Clear msg if previously shown. 1436 msg= "" 1437 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1438 # Flag to register when a parameter has changed. 1439 is_modified = False 1440 if tcrtl.GetValue().lstrip().rstrip()!="": 1441 try: 1442 value = float(tcrtl.GetValue()) 1443 tcrtl.SetBackgroundColour(wx.WHITE) 1444 1445 # If qmin and qmax have been modified, update qmin and qmax 1446 if check_value( self.qmin, self.qmax): 1447 tempmin = float(self.qmin.GetValue()) 1448 if tempmin != self.qmin_x: 1449 self.qmin_x = tempmin 1450 tempmax = float(self.qmax.GetValue()) 1451 if tempmax != self.qmax_x: 1452 self.qmax_x = tempmax 1453 else: 1454 tcrtl.SetBackgroundColour("pink") 1455 msg= "Model Error:wrong value entered : %s"% sys.exc_value 1456 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1457 return 1458 1459 except: 1460 tcrtl.SetBackgroundColour("pink") 1461 msg= "Model Error:wrong value entered : %s"% sys.exc_value 1462 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1463 return 1464 #Check if # of points for theory model are valid(>0). 1465 if self.npts != None: 1466 if check_float(self.npts): 1467 temp_npts = float(self.npts.GetValue()) 1468 if temp_npts != self.num_points: 1469 self.num_points = temp_npts 1470 is_modified = True 1471 else: 1472 msg= "Cannot Plot :No npts in that Qrange!!! " 1473 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1474 1475 else: 1476 tcrtl.SetBackgroundColour("pink") 1477 msg= "Model Error:wrong value entered!!!" 1478 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1479 1480 #self._undo.Enable(True) 1481 self.save_current_state() 1482 event = PageInfoEvent(page = self) 1483 wx.PostEvent(self.parent, event) 1484 self.state_change= False 1485 self._sleep4sec() 1486 self.Layout() 1487 self.Refresh() 1488 1430 1489 def _on_select_model_helper(self): 1431 1490 """ … … 1504 1563 1505 1564 param_min = float(item[5].GetValue()) 1506 if check_value(item[2],item[5]):1565 if not check_value(item[5],item[2]): 1507 1566 if numpy.isfinite(param_min): 1508 1567 item[2].SetValue(format_number(param_min)) 1509 item[2].SetBackgroundColour(wx.WHITE) 1568 1569 item[5].SetBackgroundColour(wx.WHITE) 1570 item[2].SetBackgroundColour(wx.WHITE) 1571 1510 1572 except: 1511 1573 msg = "Wrong Fit parameter range entered " … … 1518 1580 try: 1519 1581 param_max = float(item[6].GetValue()) 1520 if check_value(item[6],item[2]):1582 if not check_value(item[2],item[6]): 1521 1583 if numpy.isfinite(param_max): 1522 1584 item[2].SetValue(format_number(param_max)) 1523 item[2].SetBackgroundColour(wx.WHITE) 1585 1586 item[6].SetBackgroundColour(wx.WHITE) 1587 item[2].SetBackgroundColour(wx.WHITE) 1524 1588 except: 1525 1589 msg = "Wrong Fit parameter range entered " … … 1542 1606 self.model.details [name] = ["",param_min,param_max] 1543 1607 is_modified = True 1608 try: 1609 value= float(item[2].GetValue()) 1610 1611 # If the value of the parameter has changed, 1612 # +update the model and set the is_modified flag 1613 if value != self.model.getParam(name) and numpy.isfinite(value): 1614 self.model.setParam(name,value) 1615 is_modified = True 1616 except: 1617 msg = "Wrong Fit parameter value entered " 1618 wx.PostEvent(self.parent.parent, StatusEvent(status = msg)) 1544 1619 1545 value= float(item[2].GetValue())1546 1547 # If the value of the parameter has changed,1548 # +update the model and set the is_modified flag1549 if value != self.model.getParam(name) and numpy.isfinite(value):1550 self.model.setParam(name,value)1551 is_modified = True1552 1553 1620 return is_modified 1554 1621 … … 1797 1864 boxsizer1 = box_sizer 1798 1865 1799 self.qmin = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER) 1866 self.qmin = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER, 1867 kill_focus_callback = self._onQrangeEnter, 1868 text_enter_callback = self._onQrangeEnter) 1800 1869 self.qmin.SetValue(str(self.qmin_x)) 1801 1870 self.qmin.SetToolTipString("Minimun value of Q in linear scale.") 1802 1871 1803 self.qmax = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER) 1872 self.qmax = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER, 1873 kill_focus_callback = self._onQrangeEnter, 1874 text_enter_callback = self._onQrangeEnter) 1804 1875 self.qmax.SetValue(str(self.qmax_x)) 1805 1876 self.qmax.SetToolTipString("Maximum value of Q in linear scale.")
Note: See TracChangeset
for help on using the changeset viewer.