Changeset af84162 in sasview for src/sas/sasgui/perspectives/file_converter/converter_widgets.py
- Timestamp:
- Jul 14, 2016 11:00:04 AM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- de0df2c
- Parents:
- 3331e11
- git-author:
- Lewis O'Driscoll <lewis.o'driscoll@…> (07/14/16 10:55:32)
- git-committer:
- Lewis O'Driscoll <lewis.o'driscoll@…> (07/14/16 11:00:04)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/file_converter/converter_widgets.py
rc9a519f raf84162 25 25 self.control_name = control_name 26 26 self._callback = callback 27 self._name = control_name 28 27 29 self.labels = labels 28 30 self.z_enabled = z_enabled … … 40 42 return self._sizer 41 43 44 def GetName(self): 45 return self._name 46 42 47 def GetValue(self): 43 48 """ … … 48 53 v = Vector() 49 54 if not self.Validate(): return v 50 for direction, control in self._inputs :55 for direction, control in self._inputs.iteritems(): 51 56 try: 52 57 value = float(control.GetValue()) … … 57 62 return v 58 63 64 def SetValue(self, vector): 65 directions = ['x', 'y'] 66 if self.z_enabled: directions.append('z') 67 for direction in directions: 68 value = getattr(vector, direction) 69 if value is None: value = '' 70 self._inputs[direction].SetValue(str(value)) 71 59 72 def Validate(self): 60 73 """ 61 74 Validate the contents of the inputs 62 75 63 :return control_valid: Whether or not the inputs are valid64 :return invalid_c ontrol: Thecontrol that is not valid76 :return all_valid: Whether or not the inputs are valid 77 :return invalid_ctrl: A control that is not valid 65 78 (or None if all are valid) 66 79 """ 80 all_valid = True 81 invalid_ctrl = None 67 82 for control in self._inputs.values(): 68 83 if control.GetValue() == '': continue … … 70 85 control_valid = check_float(control) 71 86 if not control_valid: 72 return False, control 73 return True, None 87 all_valid = False 88 invalid_ctrl = control 89 return all_valid, invalid_ctrl 74 90 75 91 … … 85 101 x_input.Bind(wx.EVT_TEXT, self._callback) 86 102 87 self._sizer.AddSpacer((1 5, -1))103 self._sizer.AddSpacer((10, -1)) 88 104 89 105 y_label = wx.StaticText(self.parent, -1, self.labels[1], … … 97 113 98 114 if self.z_enabled: 99 self._sizer.AddSpacer((1 5, -1))115 self._sizer.AddSpacer((10, -1)) 100 116 101 117 z_label = wx.StaticText(self.parent, -1, self.labels[2],
Note: See TracChangeset
for help on using the changeset viewer.