Changeset 0e760e9 in sasview for src/sas/sasgui/perspectives/calculator/data_operator.py
- Timestamp:
- Aug 11, 2016 11:54:28 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 98d89df
- Parents:
- 1a696bf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/data_operator.py
re871a2d r0e760e9 15 15 from sas.sasgui.guiframe.documentation_window import DocumentationWindow 16 16 17 #Control panel width 17 #Control panel width 18 18 if sys.platform.count("win32") > 0: 19 19 PANEL_TOP = 0 … … 156 156 157 157 wx.EVT_TEXT_ENTER(self.data_namectr, -1, self.on_name) 158 wx.EVT_TEXT _ENTER(self.numberctr, -1, self.on_number)158 wx.EVT_TEXT(self.numberctr, -1, self.on_number) 159 159 wx.EVT_COMBOBOX(self.data1_cbox, -1, self.on_select_data1) 160 160 wx.EVT_COMBOBOX(self.operator_cbox, -1, self.on_select_operator) … … 235 235 self.name_sizer.Layout() 236 236 237 def on_number(self, event=None ):237 def on_number(self, event=None, control=None): 238 238 """ 239 239 On selecting Number for Data2 240 240 """ 241 241 self.send_warnings('') 242 item = event.GetEventObject() 242 item = control 243 if item is None and event is not None: 244 item = event.GetEventObject() 245 elif item is None: 246 raise ValueError("Event or control must be supplied") 243 247 text = item.GetValue().strip() 244 248 if self.numberctr.IsShown(): … … 251 255 except: 252 256 self._set_textctrl_color(self.numberctr, 'pink') 253 msg = "DataOperation: Number requires a float number." 254 self.send_warnings(msg, 'error') 255 return 257 if event is None: 258 msg = "DataOperation: Number requires a float number." 259 self.send_warnings(msg, 'error') 260 return False 256 261 else: 257 262 self._set_textctrl_color(self.numberctr, self.color) … … 263 268 self.draw_output(self.output) 264 269 self.Refresh() 270 return True 265 271 266 272 def on_select_data1(self, event=None): … … 607 613 wx.MessageBox(msg, 'Error') 608 614 return 615 if self.numberctr.IsEnabled() and self.numberctr.IsShown(): 616 valid_num = self.on_number(control=self.numberctr) 617 if not valid_num: 618 return 609 619 # send data to data manager 610 620 self.output.name = name … … 731 741 #add plot 732 742 self.graph.add(plot) 733 #draw 743 #draw 734 744 self.graph.render(self) 735 745 … … 985 995 window = DataOperatorWindow(parent=None, data=[], title="Data Editor") 986 996 app.MainLoop() 987
Note: See TracChangeset
for help on using the changeset viewer.