Changeset 85b3971 in sasview for sansview/perspectives/fitting/basepage.py
- Timestamp:
- Dec 18, 2009 11:07:28 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:
- e051c8d
- Parents:
- 6e74ee4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r12eac73 r85b3971 7 7 import math 8 8 import string 9 from sans.guiframe.utils import format_number,check_float ,check_value9 from sans.guiframe.utils import format_number,check_float 10 10 from sans.guicomm.events import StatusEvent 11 11 import pagestate … … 935 935 # If qmin and qmax have been modified, update qmin and qmax and 936 936 # set the is_modified flag to True 937 if check_value(self.qmin, self.qmax):937 if self._validate_qrange(self.qmin, self.qmax): 938 938 tempmin = float(self.qmin.GetValue()) 939 939 if tempmin != self.qmin_x: … … 984 984 # If qmin and qmax have been modified, update qmin and qmax and 985 985 # set the is_modified flag to True 986 if check_value(self.qmin, self.qmax):986 if self._validate_qrange(self.qmin, self.qmax): 987 987 tempmin = float(self.qmin.GetValue()) 988 988 if tempmin != self.qmin_x: … … 1530 1530 self.Layout() 1531 1531 1532 1532 def _validate_qrange(self, qmin_ctrl, qmax_ctrl): 1533 """ 1534 Verify that the Q range controls have valid values 1535 and that Qmin < Qmax. 1536 1537 @param qmin_ctrl: text control for Qmin 1538 @param qmax_ctrl: text control for Qmax 1539 @return: True is the Q range is value, False otherwise 1540 """ 1541 qmin_validity = check_float(qmin_ctrl) 1542 qmax_validity = check_float(qmax_ctrl) 1543 if not (qmin_validity and qmax_validity): 1544 return False 1545 else: 1546 qmin = float(qmin_ctrl.GetValue()) 1547 qmax = float(qmax_ctrl.GetValue()) 1548 if qmin < qmax: 1549 #Make sure to set both colours white. 1550 qmin_ctrl.SetBackgroundColour(wx.WHITE) 1551 qmin_ctrl.Refresh() 1552 qmax_ctrl.SetBackgroundColour(wx.WHITE) 1553 qmax_ctrl.Refresh() 1554 else: 1555 qmin_ctrl.SetBackgroundColour("pink") 1556 qmin_ctrl.Refresh() 1557 qmax_ctrl.SetBackgroundColour("pink") 1558 qmax_ctrl.Refresh() 1559 msg= "Invalid Q range: Q min must be smaller than Q max" 1560 wx.PostEvent(self.parent.parent, StatusEvent(status = msg)) 1561 return False 1562 return True 1563 1533 1564 def _check_value_enter(self, list, modified): 1534 1565 """ … … 1590 1621 1591 1622 if param_min != None and param_max !=None: 1592 if not check_value(item[5], item[6]):1623 if not self._validate_qrange(item[5], item[6]): 1593 1624 msg= "Wrong Fit range entered for parameter " 1594 1625 msg+= "name %s of model %s "%(name, self.model.name)
Note: See TracChangeset
for help on using the changeset viewer.